PDA

View Full Version : Maxscript Extrude.


hiphopclown
02-23-2005, 01:08 AM
Hi,

Im new to the maxscripting world so you might have to bear with me.

Anyway Im trying to write a small script that will extrude imported shapes from autocad at a random height.

So far I have this:

----

global rExtrudeLowerLimit=1.0

global rExtrudeUpperLimit=10.0



modPanel.addModToSelection (Extrude ()) ui:on

$.modifiers[#Extrude].amount = (random rExtrudeLowerLimit rExtrudeUpperLimit)

----

Now the problem is, this works fine if i have selected 1 shape. If i want to extrude multiple shapes all at random heights, it doesnt work. Now i can sort of understand in my head why, however I wouldnt have a clue how to rectify this.

The next step Im hoping to work out is to then 'drape' those extruded shapes onto a surface but first things first, the extrude is my main priority at this stage.

I figure this is a relatively simple operation but as i said, Im new.

Any help would be greatly appreciated!

Ah lastly, before you say to search the help files, Im using VIZ and there doesnt seem to be any maxscript help in the helpfiles.

Cheers for any help you can provide!

galagast
02-23-2005, 02:33 AM
bobo posted a link to the max7 maxscript help file:
ftp://ftp.discreet.com/pub2/web/pro...pdated_help.exe

im using max6, i cud still use that helpfile coz it indicates entries that are new to max7, plus, the readability has improved, lots of new samples, and stuff, excellent resource.

im not sure if viz also has a separate help file for maxscript, but usually they come in seperate files.. a file for max, maxscript, character studio, and reactor... have tried looking at the max root folder under help (c:\3dsmax\help)? im not really particular with how or where viz installs its directories, but im just just assuming that its basically the same..

best bet is to look for "for loops"
very simple example...

for i in 1 to 10 do
(
print i
)


prints the numbers 1 to 10 in the listener...

hope this helps!

prettyPixel
02-23-2005, 03:03 AM
to help you:

for obj in selection do
(
addmodifier obj (Extrude ()) -- each modifier will be different
obj.modifiers[#Extrude].amount = (random rExtrudeLowerLimit rExtrudeUpperLimit)
)

hiphopclown
02-23-2005, 05:25 AM
Fantastic,


I found the help file (was looking in the wrong spot) and both those examples have helped me.

Thanks very much :)

krembo99
07-01-2005, 11:55 AM
i had the same need ..

i was just typing
for obj in selection do addmodifier obj (Extrude ())
OK

and then

for obj in selection do obj.modifiers[#Extrude].amount=(random WhateverLow WhateverHigh)
OK


the strange thing is that when i combined those two into one command, and tried to do the same, it failed ... and such a simple command .

Maybe it has something to do with some problems in autocad files, (unclosed polylines for example) , or maybe something else .

But i do not really know .

When i will have some time i will try to post the final version.. :-)

CGTalk Moderation
07-01-2005, 11:55 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.