clintonman
03-14-2012, 12:21 AM
I tried to simulate the File > New Object using python but it didn't work for me. I don't get any errors but I dont get a new object either. Any ideas?
#! /usr/bin/env python
# -*- Mode: Python -*-
# -*- coding: ascii -*-
"""
This is a LightWave Command Sequence plug-in (Modeler) that
runs some test
"""
import sys
import math
import lwsdk
__author__ = "Clinton Reese"
__date__ = "Mar 13 2012"
__copyright__ = "Copyright (C) 2012 Clinton's 3D Creations"
__version__ = "1.0"
__maintainer__ = "Clinton Reese"
__email__ = "[email protected]"
__status__ = "Example modified 3"
__lwver__ = "11"
class random_test(lwsdk.ICommandSequence):
def __init__(self, context):
super(random_test, self).__init__()
def get_commands(self, mod_command):
command_list = {} #LWCommandCode
# /LightWave11.0/sdk/lwsdk11.0/html/commands/modeler.html
for command in ["SETLAYER",
"SETLAYERNAME",
"NEW"]:
command_list[command] = mod_command.lookup(mod_command.data, command)
return command_list
# LWCommandSequence -----------------------------------
def process(self, mod_command):
cs_dict = self.get_commands(mod_command)
#new model - not working new model not created
cs_options = lwsdk.marshall_dynavalues(None)
result = mod_command.execute(mod_command.data, cs_dict["NEW"], cs_options, lwsdk.OPSEL_USER)
print 'complete'
return lwsdk.AFUNC_OK
# /LightWave11.0/sdk/lwsdk11.0/html/server.html
ServerTagInfo = [
( "Python RandomTest", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
( "Random Test", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )
]
ServerRecord = { lwsdk.CommandSequenceFactory("LW_PyRandomTest", random_test) : ServerTagInfo }
#! /usr/bin/env python
# -*- Mode: Python -*-
# -*- coding: ascii -*-
"""
This is a LightWave Command Sequence plug-in (Modeler) that
runs some test
"""
import sys
import math
import lwsdk
__author__ = "Clinton Reese"
__date__ = "Mar 13 2012"
__copyright__ = "Copyright (C) 2012 Clinton's 3D Creations"
__version__ = "1.0"
__maintainer__ = "Clinton Reese"
__email__ = "[email protected]"
__status__ = "Example modified 3"
__lwver__ = "11"
class random_test(lwsdk.ICommandSequence):
def __init__(self, context):
super(random_test, self).__init__()
def get_commands(self, mod_command):
command_list = {} #LWCommandCode
# /LightWave11.0/sdk/lwsdk11.0/html/commands/modeler.html
for command in ["SETLAYER",
"SETLAYERNAME",
"NEW"]:
command_list[command] = mod_command.lookup(mod_command.data, command)
return command_list
# LWCommandSequence -----------------------------------
def process(self, mod_command):
cs_dict = self.get_commands(mod_command)
#new model - not working new model not created
cs_options = lwsdk.marshall_dynavalues(None)
result = mod_command.execute(mod_command.data, cs_dict["NEW"], cs_options, lwsdk.OPSEL_USER)
print 'complete'
return lwsdk.AFUNC_OK
# /LightWave11.0/sdk/lwsdk11.0/html/server.html
ServerTagInfo = [
( "Python RandomTest", lwsdk.SRVTAG_USERNAME | lwsdk.LANGID_USENGLISH ),
( "Random Test", lwsdk.SRVTAG_BUTTONNAME | lwsdk.LANGID_USENGLISH ),
( "Utilities/Python", lwsdk.SRVTAG_MENU | lwsdk.LANGID_USENGLISH )
]
ServerRecord = { lwsdk.CommandSequenceFactory("LW_PyRandomTest", random_test) : ServerTagInfo }