SelectObjectsUsingMaterial
 
 
 

SelectObjectsUsingMaterial

Introduced

v5.0

Description

Selects all the objects being 'used by' the input material(s). For a material on a polygon cluster the 3DObject is selected.

Scripting Syntax

SelectObjectsUsingMaterial( InputObjs );

Parameters

Parameter Type Description
InputObjs String List of materials

Default Value: Current selection

Examples

1. VBScript Example

' The following example creates an object, adds a material and then
' demonstates this command.
' Create an object with a material
NewScene
CreatePrim "Cube", "MeshSurface"
ApplyShader , , , , siLetLocalMaterialsOverlap
DeselectAll
' Select the object(s) using the material
SelectObjectsUsingMaterial "cube.Material"
' The 'cube' should now be selected.

2. JScript Example

// The following example creates a couple of objects and places them in a group.
// Then it creates new material in the material library and assigns that material
// to the group.  Then it demonstates this command.
// Create a couple of objects
NewScene(null, null);
CreatePrim("Cube", "MeshSurface", null, null);
Translate(null, -7.53782097226927, -0.124316224318551, 1.24316224318551E-02, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);
CreatePrim("Cube", "MeshSurface", null, null);
Translate(null, 4.3311236525746, -1.31907686094078E-16, 1.31907686094078E-17, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0, null);
// Create a new material (make it red)
SICreateMaterial(null, null, "Sources.Materials.DefaultLib", "", null, null);
SetValue("Sources.Materials.DefaultLib.Material.Phong.diffuse.red", 1, null);
SetValue("Sources.Materials.DefaultLib.Material.Phong.diffuse.green", 0, null);
SetValue("Sources.Materials.DefaultLib.Material.Phong.diffuse.blue", 0, null);
// Assign the new material to the two objects
SelectObj("cube,cube1", null, true);
SIAssignMaterial(null, "Sources.Materials.DefaultLib.Material");
DeselectAll();
// Select the object(s) using the material
SelectObjectsUsingMaterial("Sources.Materials.DefaultLib.Material");
// The objects cube and cube1 should now be selected.

See Also

SelectMaterialsUsedBy