Setting Options can be a powerful tool when automating complex operations. From importing your data to inspecting your parts. But if you are running a batch process, how do you change an option mid-stream? In short...here is the nugget:


Q: Can I set options with a macro or script?

A: Yes, options found in the Option Dialog Swirl Button->Options can be 'get' and 'set' using the geo.get_option() and geo.set_option() macros.

Each option in the Options Dialog has an entry in the user-specific geomagic.iniml file. On a Windows 7 system, this file can be found here:

 C:\Users\\AppData\Roaming\Geomagic\Geomagic Studio 2012\geomagic.iniml  

Currently, the quickest way to find out which setting in the INML correlates to the desired options in the Options Dialog is to look for changes in the INIML file. Here are the recommended steps to set and get options with scripting:

1) Backup the current INIML file

2) Using the Options Dialog, return all options to their default settings and close the application

3) Copy the geomagic.iniml file and rename the copy to something else (e.g., geomagic.iniml_old)

4) Open the application and make any changes to the options you want and exit the application. This will save the geomagic.iniml file with your changes.

For example, open the Options Dialog and under File I/O browse to the Ordered Data section, then un-check Always Prompt User, set Sampling to , and change the Filter Angle to 65.0.

5) OK' out of the dialog and exit the application.

6) With a tool like WinMerge or favorite editor look for differences between geomagi.iniml_old and geomagic.iniml. Look for changes that are related to the changes you made. There is not a direct letter-for-letter correlation. The Options Dialog and the geomagic.iniml do not share the text that appears in the windows interface.

The common factor is the Command Reference name. This name=' parameter and its parent

in the INIML file is the partial XML"path" and is the first parameter in the set_option and get_option macro. For instance, the following could be used to set the options from above with script:

filterAngle = geoapp.gui.quickinput.getFloat(u'Input Filter Angle (0 to 90):', 65.0, 0.0, 90.0)
geo.set_option("Advanced/Filter Angle", filterAngle )
geo.set_option("General /Scan Load Prompt User", 0 )
geo.set_option("General /Scan Load Sample Ratio", 2 ) 

The quickinput asks the operator for the Filter Angle value. In this case the quickinput return value will default to 65.0 degrees. Also a static value (not using the quick dialog) could also be used.

Note that the drop down widget for Sample Ratio needs to be passed a integer. This corresponds to the index of the item in the drop down widget item list. In this case the integer 2 is equivalent to the 1/4 entry seen in the Options Dialog.

Just as with most parameters in the scripting environment, options can be both set and 'get.' The get_option macro can be used to read or get the current setting as well:

filterAngle = get_option("Advanced/Filter Angle")