[Closed] How do you set Material IDs on a spline?
Hi,
This is a very simple question I’m sure, but I can’t get the correct code in maxscript to set the maetrial ID of a Editable spline. The Listener window doesn’t report back what is happening when I manually set the ID.
Thanks,
Billibong
setMaterialID <splineShape> <spline_index> <seg_index> <matID>
Sets the material ID of the specified spline segment.
getMaterialID <splineShape> <spline_index> <seg_index>
Gets the material ID of the specified spline segment.
Be sure to check the online reference that ships with max. Some people find it hard to use, but I think it’s an invaluable resource. I used the search function to find this information : “id near segment”. near is a special keyword that you can use to find two or more words that are near each other. Pressing the arrow button next to the search field displays a popup menu with some other keywords as well.
- Martijn
Martijn,
Sorry to be so thick, I did find this in the help but I don’t understand how it’s used. What is the spline_index and seg_index? Could you give me an example? I just want tro change the material ID to =4.
select $ –Editable spline selected
subobjectLevel = 3 –subobject “spline” selected
Thanks
bill
here’s a quick example how to use the setMaterialID function:
-- create a circle
c = circle radius:10
-- convert the circle to an editable spline
converttosplineshape c
-- set the material ID for the first (and only) spline, and its first segment to 1
setMaterialID c 1 1 1
-- or: set the 4 segments in the circle to material ID 5,6,7 and 8
for s = 1 to 4 do-- process all 4 segments of the circle
(
setMaterialID c 1 s (s+4) -- set material ID of segment (s) to (s + 4)
[size=2])
Hope this helps,
Martijn[/size]
Martijn,
Thank you very much for taking the time to explain, now I get it!
c = circle radius:10 –Create a circle
converttosplineshape c –Convert to spline
setMaterialID c 1 1 5 –To set segment 1, of spline1, to Material ID 5
UpdateShape c –To update the screen
ModPanel.addModToSelection (Extrude ()) ui:on –Extrude it
$.modifiers[#Extrude].mapcoords = on
$.modifiers[#Extrude].useShapeIDs = on
$.modifiers[#Extrude].matIDs = on
Thanks again
Billibong