Let’s take a look at a question that was posted recently on the Softimage mailing list:
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of Adam Sale
Sent: Tuesday, January 08, 2013 3:40 PM
Subject: Force ppg to open on script launch
I’m a little confused as to why the following does not work:
– Get a sphere
– Run Deform > Smooth
– PPG appears and all is good.
Now, take the generated command and run it through the script editor
ApplyOp(“Smooth”, “torus”, 3, siPersistentOperation, null, 0);
This time, no PPG appears.
Any idea why? And is there a way to force a ppg launch when I tun the command from a button or from the script editor?
Matt Lind explained why on the list, but I’ll take a little more detailed look into how commands like Smooth work.
Deforms like Smooth (and Relax and Push and Bend and others) are commands that are mapped to a special handler function in $XSI_HOME\Application\DSScripts\operators.vbs.
The ApplyOpProc provides special-case handling for applying operators, and also takes care of popping up a PPG after the operator is applied.
ApplyOp is also implemented by a VBScript handler in operator.vbs. This time, it’s ApplyOpFunc, and ApplyOpFunc does not inspect the created operators.
If you want to apply a Smooth operator from your script, and pop up the PPG after, here’s one way to do it:
si = Application si.AutoInspect( si.ApplyOp("Smooth", si.Selection, 3, "siPersistentOperation", "", 0) )