BasicOperations/DeletingObjectBasedOnNameSpace.py

# 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: FBSelectObjectsByNamespace, FBComponent
#

from pyfbsdk import FBSelectObjectsByNamespace, FBSystem, FBComponent

#Change the name of the following value to match your namespace
lNamespace = "myNamespace"

# Selects all the objects that have the namespace
FBSelectObjectsByNamespace(lNamespace, True, True)

lList = []

# Going through all the components in the scene
for lComp in FBSystem().Scene.Components: 
    if lComp != None and lComp.Selected:
            # Appending to list to be deleted after
            lList.append(lComp)

# Delete the components in the list
map( FBComponent.FBDelete, lList )

# Clean-up
del(FBSelectObjectsByNamespace, FBSystem, FBComponent, lList, lComp)