BasicOperations/FBConstraintManager.py

BasicOperations/FBConstraintManager.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Topic: FBConstraintManager, FBPlug
7 #
8 
9 from pyfbsdk import FBConstraintManager, FBSystem
10 
11 # We create new constraints with thr constaint manager.
12 lMgr = FBConstraintManager()
13 lScene = FBSystem().Scene
14 # We want to create one constraint of each types that exists.
15 for lIdx in range( lMgr.TypeGetCount() ):
16 
17  # We create the constraint, which will be automatically added to the scene.
18  lCnst = lMgr.TypeCreateConstraint( lIdx )
19 
20  # Set its name
21  lCnst.Name = "%s Created by script" % lMgr.TypeGetName( lIdx )
22 
23  # User feedback, if the python console is up.
24  print "Adding new constraint: '%s'" % lCnst.Name
25 
26  # Cleanup.
27  del( lCnst )
28 
29 # Cleanup.
30 del( lMgr, lIdx, FBConstraintManager )