Jump to content

maxscript help? random scale selected objects.


SgWRX
 Share

Recommended Posts

undo on (For obj in selection do obj.scale *= (random 1.0 1.75))

if i paste that into the listener window and hit it works great!

 

i created a macroscript button (i have a custom tool bar and created a button for this) and it leaves me with objects that are either 100% scaled or 200% scaled. what the? any help appreciated!

 

macroScript RandomScale
category:"Steve"
tooltip:"Random Scale"

undo on (For obj in selection do obj.scale *= (random 1.0 1.75))

Link to comment
Share on other sites

thanks. i finally did a bunch. it seems pretty darned hard to manage custom toolbar buttons and even the user manual on setting up utility buttons didn't work. i didn't want to waste anymore time on this this morning, but at least got this far. bummer that it auto-creates "drag and drop" category and it names them all Macro 1 and Macro 2 etc... then you have to go find those files in windows obscura edit and re-drag and drop. ugh autodesk really irks me when it comes to UI design.

Link to comment
Share on other sites

ok so here are the ones i added today:

 

this one flattens spline in z-axis

macroScript FlattenSpline

category:"DragAndDrop"

toolTip:""

(

on isEnabled return

(

selection.count == 1 and \

(classof selection[1] == SplineShape or\

classof selection[1] == Line) \

and selection[1].modifiers.count == 0

)

on execute do

(

new_z = $.pos.z

for s = 1 to (numSplines $) do

(

for k = 1 to (numKnots $ s) do

(

knt = getKnotPoint $ s k

in_vec = getInVec $ s k

out_vec = getOutVec $ s k

knt.z = in_vec.z = out_vec.z = new_z

setInVec $ s k in_vec

setOutVec $ s k out_vec

setKnotPoint $ s k knt

)--end k loop

)--end s loop

updateshape $

)--end execute

)--end script

 

this one changes the color of the backface lines of geometry when you are in a UI scheme with a medium grey viewport background.

 

macroScript BackFaceLineColor

category:"DragAndDrop"

toolTip:""

(

NitrousGraphicsManager.DarkerEdgeOption = #off

)

 

this is random z-rotation

 

macroScript RandomZRotation

category:"DragAndDrop"

toolTip:""

(

(undo on (For i in selection do i.rotation.z_rotation = random 0.0 360.0))

)

 

get rid of materials on selected objects

 

macroScript NullMaterial

category:"DragAndDrop"

toolTip:""

(

($.material=null)

)

 

this one helped me place 5 different trees randomly everywhere there was a dummy helper objects who's name starts with Dummy. the dummy objects were RPC in revit and came into max as dummy objects. i had to select them all and re-scale via the maxscript, then use maxscript to collapse the stack.

 

macroScript RndPlacement

category:"DragAndDrop"

toolTip:""

 

(thetrees = selection as array

 

for o in $Dummy* do

(

r = random 1 thetrees.count

 

thetree = instance thetrees[r]

thetree.transform = o.transform

 

)

)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...