AssignMaterial

Introduced

v4.0

Description

Assigns a Material to set of objects. If a material is present in the selection it is used; otherwise, a picking session starts. If only one material is present in the scene then picking occurs only for the objects.

Scripting Syntax

AssignMaterial( [InputObjs], [ActionWhenLocalMaterialsOverlap] );

Parameters

Parameter Type Description
InputObjs String Object with material

Default Value: If not specified, the user is prompted to pick one.

ActionWhenLocalMaterialsOverlap siActionWhenLocalMaterialsOverlap Action take when local materials overlap

Default Value: siPromptUser

Examples

VBScript Example

NewScene

CreatePrim "Sphere", "MeshSurface"

SetDisplayMode "Camera", "textured"

ApplyShader , , , , siLetLocalMaterialsOverlap

SetValue "sphere.Material.Phong.diffuse.green", 0.142

SetValue "sphere.Material.Phong.diffuse.red", 0.142

CreatePrim "Sphere", "MeshSurface"

Translate , 5.63213947844487, 0.195950637814795, -1.95950637814795E-02, siRelative, siView, siObj, siXYZ, , , , , , , , , , 0

DeselectAll

AssignMaterial "sphere.Material,sphere1"