Application.ClassName

Description

Returns the class name of a Softimage object. The name returned is the most derived class supported by the object.

For example, as shown in the hierarchy information, a ClusterProperty supports SIObject, ProjectItem, Property, and ClusterProperty. Because ClusterProperty is the last class listed (the "leaf" or "most-derived") it is the name returned by this method.

This method is very important for determining what type an object is and what Object Model methods and properties are available on it.

Unlike SIObject.Type, this method is available for all objects including non-SIObject ones like SIVector3, PPG, and Image.

In some cases calling this method may not return enough information to fully distinguish between different types of objects. For example, various geometries, lattices, forces all return X3DObject as their ClassName.

Note: This method returns the same information as TypeName(obj) in VBScript and can be used by languages that do not support the TypeName() function. However unlike VBScript's TypeName(), this method fails when passed strings, numbers and other standard data types. It only works for actual Softimage objects.

Note: With each release of Softimage more objects are added to the Object Model, which adds new classes to the hierarchy. This means that the value returned by this method may start returning a new ClassName, which could potentially break existing scripts that were hardcoded to expect certain behavior from this method.

C# Syntax

String Application.ClassName( Object in_pObject );

Scripting Syntax

oString = Application.ClassName( Object );

Return Value

String

Parameters

Parameter Type Description
Object Object Object to describe

Examples

1. JScript Example

/*
	This example displays the class name of an object
*/
var oObj = ActiveProject.ActiveScene.Root.AddGeometry("Sphere", "NurbsSurface");
LogMessage( "Object typename = " + Application.ClassName(oObj) );

2. Python Example

#
#	This is a basic demonstration using Application.ClassName to
#	test the type of an object
#
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 ) )

See Also

SIObject.Type Dictionary.GetObject