Advertisement
probiner

CreateClusterConstrainedNull

Dec 26th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. ## from http://xsisupport.com/2012/03/17/python-example-constraining-nulls-to-components/  + missingkey Select new nulls.
  2. from win32com.client import constants as C
  3. si = Application
  4. log = si.LogMessage
  5. selList = []
  6.  
  7.  
  8. if si.Selection.Count > 0 and si.ClassName(si.Selection(0)) == 'CollectionItem' and si.Selection(0).SubComponent is not None:
  9.  
  10.     # pnt, poly, edge, ...
  11.     clusterType = si.Selection(0).Type.replace( 'SubComponent','' )
  12.     o = si.Selection(0).SubComponent.Parent3DObject
  13.      
  14.     for i in si.Selection(0).SubElements:
  15.         c = o.ActivePrimitive.Geometry.AddCluster( clusterType, "", [i] )
  16.         n = si.ActiveSceneRoot.AddNull()
  17.         n.Kinematics.AddConstraint( "ObjectToCluster", c )
  18.         selList.append( n )
  19.  
  20. si.SelectObj( selList )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement