Stoehr
04-21-2009, 08:15 AM
I can get this to work:
Application.SIApplyConstraint("Path", newObj, oCrv)
But, this OM version won't work. I read the SDK, but don't know how to implement the fix.
newObj.Kinematics.AddConstraint("Path", oCrv)
From the SDK:
ERROR : (Python) dict can not be converted to a COM VARIANT#ERROR : Traceback (most recent call last): # File "<Script Block >", line 2, in ? # <line triggering error> # File "C:\Python23\lib\site-packages\win32comext\axscript\client\pyscript.py", line 150, in __getattr__ # return getattr(self._scriptItem_.dispatchContainer,attr) # File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 150 in __getattr__ # raise AttributeError, "%s.%s" % (self._username_, attr) #AttributeError: line 150 Possible Cause
You may see an error like one of these accompanying a Traceback for a script block that tries to use a native Python dictionary for return value from a custom command.
Suggested Solution
You cannot use the native Python dictionary type as the return value for a custom command, but you can use an ActiveX Scripting Dictionary instead (see Using Python Dictionaries as Return Values (http://forums.cgsociety.org/script_python_RestrictionsonUsingSpecialPythonTypesasReturnValuesfromCustomCommands.htm#Rabj72563)).
Application.SIApplyConstraint("Path", newObj, oCrv)
But, this OM version won't work. I read the SDK, but don't know how to implement the fix.
newObj.Kinematics.AddConstraint("Path", oCrv)
From the SDK:
ERROR : (Python) dict can not be converted to a COM VARIANT#ERROR : Traceback (most recent call last): # File "<Script Block >", line 2, in ? # <line triggering error> # File "C:\Python23\lib\site-packages\win32comext\axscript\client\pyscript.py", line 150, in __getattr__ # return getattr(self._scriptItem_.dispatchContainer,attr) # File "C:\Python23\lib\site-packages\win32com\client\dynamic.py", line 150 in __getattr__ # raise AttributeError, "%s.%s" % (self._username_, attr) #AttributeError: line 150 Possible Cause
You may see an error like one of these accompanying a Traceback for a script block that tries to use a native Python dictionary for return value from a custom command.
Suggested Solution
You cannot use the native Python dictionary type as the return value for a custom command, but you can use an ActiveX Scripting Dictionary instead (see Using Python Dictionaries as Return Values (http://forums.cgsociety.org/script_python_RestrictionsonUsingSpecialPythonTypesasReturnValuesfromCustomCommands.htm#Rabj72563)).
