![]() |
Script Operator accessing scene object properties - Printable Version +- tyFlow Forum (https://forum.tyflow.com) +-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html) +--- Forum: General Discussion (https://forum.tyflow.com/forum-2.html) +--- Thread: Script Operator accessing scene object properties (/thread-2459.html) |
Script Operator accessing scene object properties - henning - 06-14-2021 Hi! I have no knowledge about using C# in 3dsmax. How would I access for example a rectangle's .width value inside a script operator? RE: Script Operator accessing scene object properties - tyFlow - 06-14-2021 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; RE: Script Operator accessing scene object properties - henning - 06-14-2021 yay, its possible! So I have to reference this assembly, right? "$MaxRoot\bin\assemblies\Autodesk.Max.Wrappers.dll" But then I get this error Quote:-- Runtime error: „NET runtime exception: Unable to cast object of type 'Autodesk.Max.Wrappers.ReferenceTarget' to type "Autodesk.Max.Wrappers.IParamBlock‘ caused by Code: var pblock = (Autodesk.Max.Wrappers.IParamBlock)pointRef.GetReference(1); ok, the problem occurs when the rectangle as modifiers, so maybe I need to get to the baseobject... RE: Script Operator accessing scene object properties - henning - 06-16-2021 Okay, it's working now. Some objects have different paramblocks... RE: Script Operator accessing scene object properties - tyFlow - 06-16-2021 Oh woops, yea...forgot to mention you have to reference the assembly. I'll add that assembly to the list of defaults in the next build, since it's a pretty common one to use. |