Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\FBGroup.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# Create and edit Groups of cube
8#
9# Topic: FBModelCube, FBGroup, FBNamespaceAction
10#
11
12from pyfbsdk import FBModelCube, FBSystem, FBGroup, FBNamespaceAction
13
14# Setting up a test scene
15cube1 = FBModelCube ("Cube 1")
16cube1.Show = True
17cube2 = FBModelCube ("Cube 2")
18cube2.Show = True
19cube3 = FBModelCube ("Cube 3")
20cube3.Show = True
21cube4 = FBModelCube ("Cube 4")
22cube4.Show = True
23cube5 = FBModelCube ("Cube 5")
24cube5.Show = True
25cube6 = FBModelCube ("Cube 6")
26cube6.Show = True
27
28# Creating the groups
29
30# Creating Group One, which contains one cube
31lGroup1 = FBGroup ("OneCubeGroup")
32# Adding the object to the group
33lGroup1.ConnectSrc( cube1 )
34
35# Setting the attributes
36lGroup1.Show = True
37lGroup1.Pickable = False
38lGroup1.Transformable = False
39
40# Creating Group Two, which contains two cubes
41lGroup2 = FBGroup ("TwoCubeGroup")
42
43# Adding the objects to the group
44lGroup2.ConnectSrc( cube2 )
45lGroup2.ConnectSrc( cube3 )
46
47# Setting the attributes
48lGroup2.Show = True
49lGroup2.Pickable = True
50lGroup2.Transformable = False
51
52# Creating Group Three, which contains three cubes
53lGroup3 = FBGroup ("ThreeCubeGroup")
54
55# Adding the objects to the group
56lGroup3.ConnectSrc( cube4 )
57lGroup3.ConnectSrc( cube5 )
58lGroup3.ConnectSrc( cube6 )
59
60# Setting the attributes
61lGroup3.Show = True
62lGroup3.Pickable = True
63lGroup3.Transformable = True
64
65# One thing to note is normally you would use the items property to add objects
66# to the group however within Python this attribute is a Tuple so you cannot add
67# items to it, this is why we are using FBPlug methods to add items.
68
69# This is how you remove objects from the group, commented out so user can see the groups in the Viewer
70#lGroup1.DisconnectSrc( cube1 )
71#lGroup2.DisconnectSrc( cube2 )
72#lGroup2.DisconnectSrc( cube3 )
73#lGroup3.DisconnectSrc( cube4 )
74#lGroup3.DisconnectSrc( cube5 )
75#lGroup3.DisconnectSrc( cube6 )
76
77# Clean-up
78del(FBModelCube, FBSystem, FBGroup, FBNamespaceAction, cube1, cube2, cube3, cube4, cube5, cube6, lGroup1, lGroup2, lGroup3)