Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

MaxPlus, setting parameters on objects

MaxPlus, setting parameters on objects

malcomarmstrong
Advocate Advocate
834 Views
1 Reply
Message 1 of 2

MaxPlus, setting parameters on objects

malcomarmstrong
Advocate
Advocate

 

 

I have been trying to create and set parameters on a point object, but setting some attributes do not work. I can create and set position and name, but cant access the parameter to turn it to a box, cross, 

 

import MaxPlus    
aColour = MaxPlus.Color(128,0,0)
d = mxp.Factory.CreateHelperObject(mxp.ClassIds.Point)
d.cross = False # does not get set
d.box = True # does not get set
derp = mxp.Factory.CreateNode(d, "myPointObject")
derp.Position = MaxPlus.Point3(0, 0, 0) # Works fine
derp.Size = 1500.0 # does not get set
derp.wirecolor = aColour # does not get set # derp.ParameterBlock.Parameters.Box.Value = True # throws error 1 # derp.Parameters.Box.Value = True # throws error 2
derp.box = True # does not get set
derp.cross = False # does not get set for d in d.ParameterBlock.Parameters: print d.Name, d.Value

print out of for loop:

size 20.0

centermarker False

axistripod False

cross True

box False

constantscreensize False

drawontop False

error 1:

AttributeError: 'generator' object has no attribute 'Box'

-- MAXScript callstack: -- thread data: threadID:58484


-- [stack level: 0] -- In top-level

error 2:

AttributeError: 'INode' object has no attribute 'Parameters'

-- MAXScript callstack: -- thread data: threadID:58484

0 Likes
Accepted solutions (1)
835 Views
1 Reply
Reply (1)
Message 2 of 2

malcomarmstrong
Advocate
Advocate
Accepted solution

Ah man, must have been looking at this too long. The solution that I used that seems to work is to do the following after declaring it. D`Oh!

 

d = mxp.Factory.CreateHelperObject(mxp.ClassIds.Point)
d.ParameterBlock.Cross.Value = False
d.ParameterBlock.Box.Value = True

0 Likes