BasicOperations/FBComponent.py

BasicOperations/FBComponent.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 # Script description:
7 # Set the translation of a newly created cube and show how to find a model by its name
8 #
9 # Topic: FBScene, FBComponent
10 #
11 
12 from pyfbsdk import *
13 
14 gSys = FBSystem()
15 gScene = gSys.Scene
16 
17 lobj = FBModelCube('Cube')
18 lobj.Translation.SetAnimated(True)
19 lobj.Show = True
20 
21 # Going through all the items in the scene
22 for lComp in gScene.Components:
23  # in this particular case we are looking for anything with the type of FBModel
24  if lComp != None and lComp.Is(FBModel.TypeInfo):
25  if (lComp.Name == 'Cube'):
26  # Use the screen name to set the translation vector
27  ltran = lComp.PropertyList.Find ( 'Translation (Lcl)' )
28  if not ltran:
29  print "Can't find translation property"
30  else:
31  ltran.Data = FBVector3d( -10, 5, 20 )
32 
33 
34