PDA

View Full Version : Python load object



bradcarvey
05-30-2012, 07:27 PM
How can one load and save an object in Modeler, with python?

The LOAD command has a single argument (string filename)

cs_options = lwsdk.marshall_dynavalues('C4_005.obj')
cs_loadObject = mod_command.lookup(mod_command.data, "LOAD")

result, dyna_value = mod_command.execute(mod_command.data, cs_loadObject, cs_options, lwsdk.OPSEL_USER)

This is a snippet from code that runs without error. All other commands execute, including "MERGEPOINTS", which is also a general modeler command, like LOAD.

bradcarvey
05-30-2012, 07:48 PM
There are some issues with restarting modeler between each change to the source code. I got the load to work and it was one of the obvious test, that I thought I had already tried. I added the full path and it worked.

cs_options = lwsdk.marshall_dynavalues('F:\LW11Projects\Plate\O bjects\C4\C4_005.obj')
cs_loadObject = mod_command.lookup(mod_command.data, "LOAD")
result, dyna_value = mod_command.execute(mod_command.data, cs_loadObject, cs_options, lwsdk.OPSEL_USER)