Re: [Jmol-developers] myJmol as variable in Jmol.script
Hi Klaus Go to http://chemapps.stolaf.edu/jmol/docs/ and search for "rotationRadius" You will see there is "set rotationRadius" therefore you can try show rotationRadius and it works! Examples of use: show rotationRadius // rotationRadius = 20.94923 rr = rotationRadius; print rr; // 20.94923 -- What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e ___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers
Re: [Jmol-developers] myJmol as variable in Jmol.script
yes, if you check show orientation you will see a parameter "rotation radius" You can set that to a new number, then disable zoom. It sets the magnification for "100%". -- Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers
Re: [Jmol-developers] myJmol as variable in Jmol.script
Klaus, When you create an applet, it automatically creates a top-level object with the name of your applet. However, you can't do anything with that object until it is at least started to be created. Have you tried any of the html files in the jsmol/ directory? There are plenty of examples of this. One that comes to mind is http://chemapps.stolaf.edu/jmol/jsmol/simple2_old.htm I do not recommend eval(name), and I have never needed it. On Mon, May 9, 2016 at 2:25 AM, Klaus Schaperwrote: > Hi everybody, > > > > Thanks to Rolf, that did the trick! I successfully converted a little bit > of script to the new syntax and the other functions will hopefully cause no > problems. > > > > > > However, one more problem remains. After converting the script to the new > syntax using > > > > 1) Jmol.getApplet(Ziel, Info); > > > > and > > > > 2) Jmol.script(eval(name), commands); > > > > The code will run in my JSmol enviiroment, but not in the Jmol environment. > > > > My conclusion is, that > > either the new syntax is not compatible to the old Jmol using JAVA, > > or that I did not include all necessary files in my html document. Which > files (beside the old Jmol.js) do I have to include? > > > > Klaus > > > > > > > > > > > > > PD Dr. Klaus Schaper > > > > http://www.photochemie.hhu.de/ oder http://www.klaus-schaper.de > > > > e-mail: scha...@klaus-schaper.de > > > > Arbeitsgruppe für Organische Photochemie > > Institut für Organische Chemie und Makromolekulare Chemie I > > Raum 26.43.00.27 > > > > Heinrich-Heine-Universität Düsseldorf > > Universitätsstr. 1 > > D-40225 Düsseldorf > > Deutschland > > > > Telefon: +49 211 81 12571 > > FAX: +49 211 81 14324 > > > > > > > > > > > > -- > Find and fix application performance issues faster with Applications > Manager > Applications Manager provides deep performance insights into multiple > tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z > ___ > Jmol-developers mailing list > Jmol-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jmol-developers > > -- Robert M. Hanson Larson-Anderson Professor of Chemistry Chair, Department of Chemistry St. Olaf College Northfield, MN http://www.stolaf.edu/people/hansonr If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 -- Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers
Re: [Jmol-developers] myJmol as variable in Jmol.script
Hello Klaus I think that it should be possible to do what you want without using eval(), which is usually not recommended by javascript gurus. The variable is indeed an object and not a string, but that is what Jmol expects. There may be a problem when the variable has not been defined beforehand; not sure if it will be your case. The trick in that case is to define it first like myJmol = "myJmol" Better: I made a page with your functions and it is working as desired when I use it like this but I get the error when I use it like this: So the issue would be you must pass the object, not the name. If you don't want to write the object manually, like I did, I suggest that you use the following instead of eval; one way to refer to objects ny their name is to use window[objectname] That would allow for example this to apply to all Jmol objects named A, B, C, D: function setAll() { for (i=65; i<69; i++) { KS_AtomeHervorheben( window[String.fromCharCode(i)] ) } } > However, one more problem remains. After converting the script to the new > syntax using > The code will run in my JSmol enviiroment, but not in the Jmol > environment. > either the new syntax is not compatible to the old Jmol using JAVA, > or that I did not include all necessary files in my html document. Which > files (beside the old Jmol.js) do I have to include? It is compatible, but you must be moving to new syntax also for the Java mode. You must not use Jmol.js any longer, instead just change: Info.use = 'java' Info.use = 'html5' // default -- Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j ___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers
Re: [Jmol-developers] myJmol as variable in Jmol.script
I would put a line alert(name) in that function to see what that variable is. Perhaps it is not defined at the time you are making the call. Also, I don't recommend giving an applet a name like "A" or "B" -- to easy to use a variable that is used by something else. I would suggest "jmolA" "jmolB" or something like that. What most people do is "jmolApplet1" "jmolApplet2" . Bob -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers
Re: [Jmol-developers] myJmol as variable in Jmol.script
Am 07.05.16 um 10:22 schrieb Klaus Schaper: > Hi everybody, > > I just decided as recommended to switch from jmolScript to the modern > Jmol.script syntax. > > I create to applets with the following function: > > function KS_ErzeugeAppRechteck(Ziel) > > { > > var Info = {src: "Ethan.xyz"}; > > Info.j2sPath > ="http://schelm.hhu.de/home/Lehre/scheLM_Test/_INCLUDE/JSMOL/j2s;; > > Jmol.getApplet(Ziel, Info); > > } > > I call this function twice from my webpage: > > KS_ErzeugeAppRechteck('A'); > > KS_ErzeugeAppRechteck('B'); > > Thus creating to applets with the name A and B. > > If I run the following function I can set the color of two atoms in A to > blue: > > function KS_AtomeHervorheben() > > { > > Jmol.script(A, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > __ > > If I change myJmol to B I can change the color of two atoms in B > > __ > > function KS_AtomeHervorheben() > > { > > Jmol.script(B, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > However, what I really would like to do is to pass the name of the > applet by the function call and parse it into the jmol.script command. > > function KS_AtomeHervorheben(name) > > { > > Jmol.script(name, "select hydrogen;color white;select > atomno=3,atomno=6; color atoms blue"); > > } > > However, I get the following error “TypeError: a._checkDeferred is not a > function”. > > Is there any way to path the name of the app by the function call to the > Jmol.script command or is there any other way to get the job done. I > have webpages containing 7 Jsmol apps and I do not want to write the > same commands 7 times. > Klaus, I think 'A' and 'B' are objects and not just names. So you could try to use the 'eval' function to address the objects: Jmol.script(eval(name), "select hydrogen;color white;select atomno=3,atomno=6; color atoms blue"); Regards, Rolf -- Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z ___ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers