[Closed] Problem with Array
Hi, there
I´m working on a school project but I got stucked in a problem that I can´t simply solve by myself. So if you got the time I would be happy if could help me.
I´m learning Maxscript for 6 months, it may be that I just not skilled enough, so if you can please help me.
So, now lets get to the point:
I have a mesh object, previously it was a box, now its a mesh extruded 20 times in one direction. So it has 20*4 polygons that are important. I want to select a polygon and extrude it. Then extrude some other polygons BUT each one has to be 4 or more polygons distant from the previous extruded one.
This is an easy part, but now it starts to be difficult:
First 4 polygons should not be extruded, the extrusion must start on 5th outher polygon. This polygon must be extruded 6 times (example), next polygon that ought to be extruded is 9th (this only 5 times), next polygon is 14 (4 times), etc. Every next polygon must be extruded less times then the previous one.
Well, I´ve started writing a script like this:
I´ve created an array with numbers of faces , these are the one for extrusion. But I cant do the trick with the specific extrusion.
k=(random 15 23)
case d of
(
5: case m of – first polygon that should be extruded is fifth
1: (
polyop.SetFaceSelection p#(k+1,k+3,k+8,k+10,k+15,k+20,k+25,k+28,k+34,k+41,k+44,k+47,k+54,k+56,k+59,k+61,k+68,k+70,k+75,k+77)
– these are the selected polygons in array , there are 20 polygons altogether,
v=#(k+1,k+3,k+8,k+10,k+15,k+20,k+25,k+28,k+34,k+41,k+44,k+47,k+54,k+56,k+59,k+61,k+68,k+70,k+75,k+77)
for i=1 to v.count do p.ExtrudeFaces i – this extrudes each element of array BUT it extrudes extrudes 20 times and thats WRONG
So, thats all. If you can solve my problem it would be great.If you had any questions write a mail to kitsune1@szm.sk.
THANK YOU for your help.
Maybe I’m just going stupid, but any of the extrudeFaces functions I lookup require more parameters then you are providing…
polyOp.extrudeFaces <Poly poly> <facelist> <float amount>
Also, this doesn’t really make scense…
for i=1 to v.count do p.ExtrudeFaces i
Now, again, I could be just going stupid, but shouldn’t it be more like
for faceIndex in v do p.ExtrudeFaces faceIndex
You were passing the “array index” (ie 1 thru v.count) to the extrudefaces function, which is NOT the value in the array…another way to do it would be
for i=1 to v.count do p.ExtrudeFaces v[i]
Not really sure if any of that helps…
Shane