# 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:
# For all components in a scene, replace a namespace by another.
#
# Topic: FBComponent
#

from pyfbsdk import FBSystem, FBNamespaceAction

#Change the name of the following value to match your namespaces
lOldNamespace = "MyOldNameSpace"
lNewNamespace = "MyNewNameSpace"

for lComp in FBSystem().Scene.Components:
        # This function is a recursive function that will go through the whole hierarchy to add or replace the prefix
        lComp.ProcessNamespaceHierarchy (FBNamespaceAction.kFBReplaceNamespace, lOldNamespace, lNewNamespace, False)

# Clean-up
del(FBSystem, FBNamespaceAction, lComp)