Script Operator accessing scene object properties
#2
Accessing regular max properties within a Script operator is more complex than regular maxscript access, but possible.

The following code could be used to access the "width" property of a rectangle named "Rectangle001" in the scene:

Code:
var global = GlobalInterface.Instance;
    
var pointHelper = global.COREInterface.GetINodeByName("Rectangle001"); //get the IINode of the rectangle
    
var pointRef = pointHelper.ObjectRef; //Get the IObjectRef of the IINode
    
var pblock = (Autodesk.Max.Wrappers.IParamBlock)pointRef.GetReference(1); //paramblock 1 of a shape object is its shape property paramblock (paramblock 0 of a shape is its renderable geometry properties)
        
Print (pblock.GetFloat(1,0)); //the width property is the second parameter in the paramblock, so we reference it with ID "1", since its property IDs are 0-based
  Reply


Messages In This Thread
RE: Script Operator accessing scene object properties - by tyFlow - 06-14-2021, 04:13 PM

Forum Jump: