Application.ClassName.2.pys Example
Applies To
Application.ClassName method
Description
This is a basic demonstration using Application.ClassName to test the type of an object
Code
def IsModel( in_obj ) : # There are no classes which derive from model so this is # a safe way to test the object try: return ( Application.ClassName( in_obj ) == "Model" ) except: #Exception will occur if in_obj isn't really an COM object return False oSceneRoot = Application.ActiveSceneRoot oNull = oSceneRoot.AddNull() oModel = oSceneRoot.AddModel() # This is a model (prints "True") Application.LogMessage( IsModel( oSceneRoot ) ) Application.LogMessage( IsModel( oModel ) ) # These are not models (prints "False") Application.LogMessage( IsModel( Application ) ) Application.LogMessage( IsModel( oNull ) ) # These are not even Softimage objects (prints "False") Application.LogMessage( IsModel( "not even an object" ) ) Application.LogMessage( IsModel( 22 ) )
Related Examples
Keywords
Application ClassName
Autodesk Softimage 2011