# 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: # Delete selected object that have a specified namespace. # # Topic: NamespaceSelectContent, FBComponent # from pyfbsdk import FBSystem, FBComponent, FBObjectFlag #Change the name of the following value to match your namespace lNamespace = "myNamespace" # Deselect all other objects before selecting objects in the scene for lComp in FBSystem().Scene.Components: if lComp != None and lComp.Selected: lComp.Selected = False # Selects all the objects that have the namespace FBSystem().Scene.NamespaceSelectContent(lNamespace, True) lList = [] # Going through all the components in the scene for lComp in FBSystem().Scene.Components: if lComp != None and lComp.Selected and lComp.HasObjectFlags(FBObjectFlag.kFBFlagDeletable): # Appending to list to be deleted after lList.append(lComp) # Delete the components in the list map( FBComponent.FBDelete, lList ) # Clean-up del(FBSystem, FBComponent, FBObjectFlag, lList, lComp)