BasicOperations/FBComponent.py
 
 
 
BasicOperations/FBComponent.py
# 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.

# Script description:
# Set the translation of a newly created cube and show how to find a model by its name
#
# Topic: FBScene, FBComponent
#

from pyfbsdk import *

gSys = FBSystem()
gScene = gSys.Scene

lobj = FBModelCube('Cube')
lobj.Translation.SetAnimated(True)
lobj.Show = True

# Going through all the items in the scene
for lComp in gScene.Components: 
    # in this particular case we are looking for anything with the type of FBModel
    if lComp != None and lComp.Is(FBModel.TypeInfo):
        if (lComp.Name == 'Cube'):
            # Use the screen name to set the translation vector
            ltran = lComp.PropertyList.Find ( 'Translation (Lcl)' )
            if not ltran:
                print "Can't find translation property"
            else:
                ltran.Data = FBVector3d( -10, 5, 20 )