BasicOperations/ObjectCreation.py

BasicOperations/ObjectCreation.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 # This script shows how to use the generic FBCreateObject function to create object that
8 # are not "officially" exposed to python. This allow creation of anything that is available
9 # in the Asset browser.
10 #
11 # Topic: FBCreateObject
12 #
13 
14 from pyfbsdk import FBCreateObject
15 
16 
17 # FBCreateObject(GroupName, EntryName, ObjectName) has 3 parameters as input:
18 # GroupName: id of the group creation function. In asset Browser each group starts with "Browsing" (ex: Browsing/Templates/Elements)
19 # EntryName: This is id of the object to create. In Asset Browser this would be the name under the icon (ex: Cube)
20 # ObjectName: the name the object will have at creation
21 
22 # Create a Cube named MyCube
23 cube = FBCreateObject( "Browsing/Templates/Elements", "Cube", "MyCube" )
24 
25 # Creating a physic solver
26 solver = FBCreateObject( "Browsing/Templates/Solvers", "Physics Solver", "MySolver" )
27 
28 # I M P O R T A N T N O T E: Primitives are different, the name of the object MUST be the same name as the EntryName
29 cubeprimitives = FBCreateObject( "Browsing/Templates/Elements/Primitives", "Cube", "Cube" )
30 discprimitives = FBCreateObject( "Browsing/Templates/Elements/Primitives", "Disc", "Disc" )