Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\FBGetSelectedModels.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# Topic: FBModelList, FBGroup, FBNamespaceAction
7#
8
9from pyfbsdk import FBModelList, FBGetSelectedModels, FBMessageBox
10
11lModelList = FBModelList()
12
13# Get the selected models.
14FBGetSelectedModels( lModelList )
15
16# Show the list to the user.
17if len( lModelList ) == 0:
18 FBMessageBox( "Message", "Nothing selected", "OK", None, None )
19else:
20 lMessage = "%d selected models:" % len( lModelList )
21
22 # Okay, the following line looks a bit complicated... but we just
23 # build a string with all the selected object's name. One per line.
24 lMessage += ''.join( map( lambda pModel: "\n " + pModel.Name, lModelList ))
25
26 # And bring up the pop-up...
27 FBMessageBox( "Message", lMessage, "OK", None, None )
28 del( lMessage )
29
30# Cleanup.
31del( lModelList, FBModelList, FBGetSelectedModels, FBMessageBox )
FBGetSelectedModels(FBModelList pList, FBModel pParent=None, bool pSelected=True, bool pSortBySelectOrder=False)
Find all models that are selected (if pSelected is true) Searches recursively from a root model for m...
int FBMessageBox(str pBoxTitle, str pMessage, str pButton1Str, str pButton2Str=None, str pButton3Str=None, int pDefaultButton=0, int pScrolledMessage=0)
Dialog popup box.