[Closed] Cannot access to modifiers array?
Hi
I’m just learning maxscript.
I’ve created a circle, selected it, and run these lines:
m=Extrude()
addModifier selection m
All ok, the circle gets an Extrude modifier.
Then I try to find how to deal with it:
print selection.modifiers
print selection.modifiers[#Extrude]
print selection.modifiers.count
… and so on, these ones are just an example of all I’ve tried, and this is the message I always get:
-- Error occurred in anonymous codeblock; filename: C:\web\_scripts\3dsmax est.ms; position: 217; line: 13
-- Unknown property: "modifiers" in $selection
Any idea about what am I doing wrong?
Thanks
accessing individual modifiers is done like the example in the maxscript reference
http://docs.autodesk.com/3DSMAX/14/ENU/MAXScript%20Help%202012//index.html?query=addModifier
$foo.modifiers[2].enabled = false– turn off 2nd modifier
or try something like this instead
c = circle()
m = extrude amount:25
addModifier c m
print c.modifiers
print c.modifiers[#Extrude]
print c.modifiers.count
Selection is a collection or array, even if it is only one object. You need to identify a single object in the selection to access those properties. Try:
print selection[1].modifiers
print selection[1].modifiers[#Extrude]
print selection[1].modifiers.count
That code will get the first object in the selection array.
-Eric