multiple align script

multiple align script

Anonymous
Not applicable
536 Views
1 Reply
Message 1 of 2

multiple align script

Anonymous
Not applicable
Is anyone aware of a maxscript that I can use to align an array of 400 indivudual box objects with 400 indivdual plane objects. All I need is for each object in selection a to get aligned to an object in selection B The order in which this happens doesn't matter.

I dont have any experience with maxscript but woudl be open to learning a little to write the script. Is this something that a novice could acomplish?
0 Likes
537 Views
1 Reply
Reply (1)
Message 2 of 2

Steve_Curley
Mentor
Mentor
Assumptions:-
The Boxes are Box primitives (not converted to Editable Poly or Mesh etc), same for the Planes. If they have been, then a different method of selection would be needed.
There are the same number of Planes as there are Boxes (or more, but not less).

(
local SetA = #(), SetB = #()

SetA = for obj in geometry where (classof obj == Box) collect obj
SetB = for obj in geometry where (classof obj == Plane) collect obj

for i = 1 to SetA.count do
SetA.pos = SetB.pos
)

Everything in there is covered in the Maxscript Help. Search the Help for the following terms (without the quotes) to get you started on what each statement does.

"Scope of Variables" - covers the "Local" staement and the parentheses surrounding the code
"Array values" and "Collections" - covers the #() and (partly) the for loops and the collect statements
"classof" (select the "Working with values" topic) - covers, well, the classof statement
"For Loop" - covers the collections and the array handling
"Node common properties" - the .pos

If you get stuck on anything, post back and we'll try and explain it for you, but always check the help first - it really is pretty comprehensive.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes