Hey guys,
First off, I'm a newbie. sorry.
I'm trying to learn maxscript and to create standard parametric geometries for archviz. Currently I'm working on a curtain wall plugin similar to the one that comes with Max but with more functionality for what I need. I have a pretty good handle on creating the geometry itself but I'm stuck on how to assign materials and material ids to specific faces and establish uv coordinates.
I created the following script for testing. I would like to assign a different material for each polygon. Can anybody help?
(
parameters main rollout: params(
WidthA type:#float ui:WidthA default:10
LengthA type:#float ui:LengthA default:10
)
rollout params "Test Plane"(
spinner WidthA"Width "range:[0,10000,10] tooltip:"Width"
spinner LengthA"Length "range:[0,10000,10] tooltip:"Length"
)
on buildMesh do (
vert_array = #()
face_array = #()
append vert_array[0,0,0]
append vert_array[(LengthA/2),0,0]
append vert_array[LengthA,0,0]
append vert_array[0,WidthA,0]
append vert_array[(LengthA/2),WidthA,0]
append vert_array[LengthA,WidthA,0]
append face_array[4,1,2]
append face_array[2,5,4]
append face_array[5,2,3]
append face_array[3,6,5]
setmesh mesh vertices:vert_array faces:face_array
for face = 1 to mesh.numfaces do setEdgeVis mesh face 3 false
)
tool create
(
on mousePoint click do (
case click of (
1: coordsys grid (nodeTM.translation = gridPoint)
)
)
on mouseMove click do (
case click of (
2: (LengthA = abs(gridDist.x); WidthA = abs(gridDist.y))
3: (#stop)
)
)
)
)
Thanks in advance,
Gary
barigazy · 2012-05-28