Python - AddConstraint

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2009
Python - AddConstraint

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).
__________________
maya and zbrush training
creating CG3D since 2001

3D Models
@ Turbosquid

my Scripts
 
  04 April 2009
I think I'm figuring this out. Python doesn't think my object is a XSICollection or X3DObject or X3DObjectCollection. So, that's the problem. I duplicated an item from a collection, but didn't add the duplicate back into a collection.

Yeah, that's it.

My newObj is a duplicate. Duplicate returns a collection. doh.

so,


newObj(0)
__________________
maya and zbrush training
creating CG3D since 2001

3D Models
@ Turbosquid

my Scripts

Last edited by Stoehr : 04 April 2009 at 06:09 AM.
 
  04 April 2009
Fixed it yourself and actually could be arsed posting how you fixed it...
That's two cookie points right there
__________________
Come, Join the Cult http://www.cultofrig.com - Rigging from First Principles
 
  04 April 2009
I do like cookies.
__________________
maya and zbrush training
creating CG3D since 2001

3D Models
@ Turbosquid

my Scripts
 
  04 April 2009
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:28 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.