# Copyright 2009 Autodesk, Inc.  All rights reserved.
# Use of this software is subject to the terms of the Autodesk license agreement 
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
# Topic: FBConstraintManager, FBPlug
#

from pyfbsdk import FBConstraintManager, FBSystem

# We create new constraints with thr constaint manager.
lMgr = FBConstraintManager()
lScene = FBSystem().Scene
# We want to create one constraint of each types that exists.
for lIdx in range( lMgr.TypeGetCount() ):

    # We create the constraint.
    lCnst = lMgr.TypeCreateConstraint( lIdx )

    # Set its name
    lCnst.Name = "%s Created by script" % lMgr.TypeGetName( lIdx )

    # The constraint has been created, but is not yet present in
    # the system. We need to do that explicitely with the following line:
    lScene.Constraints.append(lCnst)

    # User feedback, if the python console is up.
    print "Adding new constraint: '%s'" % lCnst.Name

    # Cleanup.
    del( lCnst )

# Cleanup.
del( lMgr, lIdx, FBConstraintManager )