USD.Prim

Inherits from treenode

Description

A class that represents a USD Prim.

Properties

path The complete path for the prim.
references Allows a user to clear and set references on a USD.Prim. See USD.References for more info.

Methods

createAttribute Create a USD.Attribute on the prim.
createRelationship Create a USD.Relationship on the prim.
getProperty Get a USD.Property with a given name.
getPropertyNames Get an Array of names of properties on the prim.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.path

readonly string path

Description

The complete path for the prim.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.defaultPrim;
				string path = prim.path;
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.references

readonly references

Description

Allows a user to clear and set references on a USD.Prim. See USD.References for more info.


				// Clear the current offsets from the operator's refshape and reset them to 0
				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim refShape = stage.findPrim("/World/Operator1/shapeOffset/refShape");
				USD.Reference ref = USD.Reference("/shapes/tn__OperatorMalefbx_ZN");
				ref.layerOffset = 0;
				refShape.references.clear();
				refShape.references.add(ref);
				stage.save();
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.createAttribute()

USD.Attribute createAttribute( string attributeName , string typeName )

Parameters

attributeName The name of the new attribute.
typeName The type of attribute being created.

Returns

USD.Attribute The newly created USD.Attribute.

Description

Create a USD.Attribute on the prim.

The typeName specifices what type of attribute you want to create. For example, you can create a "string" attribute by running the code below. Basic attribute types can be found here. If the typeName is invalid, the created USD.Attribute will be invalid.

				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				USD.Attribute attribute = prim.createAttribute("testAttr", "string");
				if (attribute) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.createRelationship()

USD.Relationship createRelationship( relationshipName )

Parameters

The name of the new relationship.

Returns

USD.Relationship The newly created USD.Relationship.

Description

Create a USD.Relationship on the prim.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.definePrim("/my/test/prim", "Xform");
				USD.Relationship relationship = prim.createRelationship("myRelationship");
				if (relationship) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.getProperty()

USD.Property getProperty( string propertyName )

Parameters

propertyName The name of the property to search for.

Returns

USD.Property The newly created USD.Property.

Description

Get a USD.Property with a given name.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.findPrim("/World/Processor1");
				USD.Property property = prim.getProperty("myProperty");
				if (property) {
					...
				}
			
Do no remove, this fixes the anchor on doc.flexsim.com

USD.Prim.getPropertyNames()

Array getPropertyNames( )

Returns

Array An array of USD.Prim objects.

Description

Get an Array of names of properties on the prim.


				USD.Stage stage = Model.find("USD Stage1");
				USD.Prim prim = stage.defaultPrim;
				Array propertyNames = prim.getPropertyNames();
				for (int i = 1; i <= propertyNames.length; i++) {
					...
				}