PDA

View Full Version : Help with my first script


jwilson02
11-12-2005, 12:23 AM
Im writing a script that creates prefabbed Wheels. What I want to do with it now is to have a spinner that creates the number of spokes.

How would I go about selecting only every other side of a editable mesh cylinder that has say 20 sides. I want to do this without selecting either the top or bottom.

So with this I can then somehow link it to the spinner. I do this because selecting everyother side, I can extrude them to create the spokes. Using the spinner I want to change the number of spokes in real time.

Any help on the subject for a nooby would be greatly appreciated!

Heres the script so far:
rollout rim "Rim-Maker"
(
button c "Create"
spinner spokes "#Spokes" range:[2,20,5] type:#integer
on c pressed do
(
Cyl = cylinder height:13 sides:12
Tub = tube radius1:90 radius2:88 height:70 sides:30
Tub.pos = [0,0,-20]
Tub1 = tube radius1:97 radius2:89 height:4 sides:30
Tub1.pos = [0,0,48]
Tub2 = tube radius1:97 radius2:89 height:4 sides:30
Tub2.pos = [0,0,-20]
Tub3 = tube radius1:89 radius2:82 height:30 sides:30
Tub3.pos = [0,0,0]
)
)-- end rollout

Newfloater = newrolloutfloater "Rims" 300 300
addrollout rim Newfloater

jwilson02
11-12-2005, 02:29 AM
Well Ive gotten thus far with the script. I personally dont think its all that bad seeing as how I started on maxscript yesterday. I really want to learn how to interactivly change the spokes though. Please dont make too much fun!

rollout rim "Rim-Maker"
(
button c "Create"
spinner spokes "#Spokes" range:[2,20,5] type:#integer
on c pressed do
(
Csides = spokes.value
Cyl = cylinder height:13 sides:Csides
Tub = tube radius1:90 radius2:88 height:70 sides:30
Tub.pos = [0,0,-20]
Tub1 = tube radius1:97 radius2:89 height:4 sides:30
Tub1.pos = [0,0,48]
Tub2 = tube radius1:97 radius2:89 height:4 sides:30
Tub2.pos = [0,0,-20]
Tub3 = tube radius1:89 radius2:82 height:30 sides:30
Tub3.pos = [0,0,0]

convertTo Cyl (Editable_Poly)
f = polyop.getnumfaces Cyl
z = f-2
for i in 1 to z do
(
polyop.setfaceselection Cyl #{i}
cyl.extrudefaces 65
)-- end for loop
)-- end create

)-- end rollout

Newfloater = newrolloutfloater "Rims" 300 300
addrollout rim Newfloater

CGTalk Moderation
11-12-2005, 02:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.