It wasn't that your script didn't work, it was my modified script that didn't work (i.e. using the atom sites that correspond to the initial min max positions in subsequent calls):
rotate best; # moved here startZoom = 100; zoom {visible} @startZoom; # rotate best; # if done here the initial coords dont seem to be updated margin=15; c=0; function getScreenBoundary(atomSet) { if (atomSet.type == "bitset") { var screenMinX = ""; var screenMaxX = ""; var screenMinY = ""; var screenMaxY = ""; var minXsite=""; var maxXsite=""; var minYsite=""; var maxYsite=""; for (var i from [1 atomSet.size]) { var screenXYZ = point(atomSet[i].xyz, true); if (screenMinX == "") { screenMinX = screenXYZ.x; screenMaxX = screenXYZ.x; screenMinY = screenXYZ.y; screenMaxY = screenXYZ.y; minXsite=atomSet[i]; maxXsite=atomSet[i]; minYsite=atomSet[i]; maxYsite=atomSet[i]; } else { if (screenXYZ.x<screenMinX) { screenMinX=screenXYZ.x; minXsite=atomSet[i]; } if (screenXYZ.x>screenMaxX) { screenMaxX=screenXYZ.x; maxXsite=atomSet[i]; } if (screenXYZ.y<screenMinY) { screenMinY=screenXYZ.y; minYsite=atomSet[i]; } if (screenXYZ.y>screenMaxY) { screenMaxY=screenXYZ.y; maxYsite=atomSet[i]; } } } return [screenMinX, screenMaxX, screenMinY, screenMaxY, minXsite, maxXsite, minYsite, maxYsite]; } } sxInfo = getScreenBoundary({visible}); selectionHalos ON; # just to see whats selected select @{sxInfo[5]}, @{sxInfo[6]}, @{sxInfo[7]}, @{sxInfo[8]}; while (sxInfo[2] < _width-margin && sxInfo[1] > margin && sxInfo[4] < _height-margin && sxInfo[3] > margin ) { zm=startZoom+c; zoom {visible} @zm; c=c+1; if (c>100) {break;} sxInfo = getScreenBoundary({selected}); } print "c=" + c; # extra translation to center the model horizontally (yuk) rm=_width-sxInfo[2]; lm=sxInfo[1]; t=(rm-lm)/2;tp=t/_width*100; translate x @tp; print "c=" + c; I was testing using the console and e.g. http://publcif.iucr.org/cifmoldb/gui/cifjmol.php?jsmol=y&cifid=av1222 If I swap the position of 'rotate best' the selected atoms no longer appear at the min max positions (at least in my browser)... Cheers Simon Quoting Rolf Huehne <rhue...@leibniz-fli.de>: > Am 05.12.15 um 13:49 schrieb si...@publcif.co.uk: >> Curiously this showed that the 'rotate best' needed to be done first >> (before the initial zoom) otherwise the coordinates did not reflect >> the rotated model. >> Perhaps the subsequent zoom forces a refresh... >> > It seemed to work at least for my example '1DEH' also the other way > round. Otherwise it must have been cropped because the initial view is > quadratic and after rotate best one side is about twice as large as the > other. > Simon, can you name an example were it didn't work for you? > > Regards, > Rolf > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > _______________________________________________ > Jmol-users mailing list > Jmol-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-users > ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users