BasicOperations/ReplaceNamespace.py

BasicOperations/ReplaceNamespace.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 # For all components in a scene, replace a namespace by another.
8 #
9 # Topic: FBComponent
10 #
11 
12 from pyfbsdk import FBSystem, FBNamespaceAction
13 
14 #Change the name of the following value to match your namespaces
15 lOldNamespace = "MyOldNameSpace"
16 lNewNamespace = "MyNewNameSpace"
17 
18 for lComp in FBSystem().Scene.Components:
19  # This function is a recursive function that will go through the whole hierarchy to add or replace the prefix
20  lComp.ProcessNamespaceHierarchy (FBNamespaceAction.kFBReplaceNamespace, lOldNamespace, lNewNamespace, False)
21 
22 # Clean-up
23 del(FBSystem, FBNamespaceAction, lComp)