ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Would like to be able to multi select objects consecutively along + or - XYZ axis. (Example: so that they are selected in order from left to right along X axis)
As it stands right now selecting multiple objects at once seems to randomize the order.
fn sortByAxis arr1 arr2 axis: maxtomin: =
(
local first, second
case axis of
((#x): (first = arr1.pos.x ; second = arr2.pos.x)(#y): (first = arr1.pos.y ; second = arr2.pos.y)(#z): (first = arr1.pos.z ; second = arr2.pos.z))
case of ((first < second): if not maxtomin then -1 else 1
(first > second): if not maxtomin then 1 else -1
default:0))-- example
delete objects
cnt = 1
objArr = for c in #(Box, Teapot, Cylinder, Cone, Sphere) collect (obj = c pos:[(cnt*50), 0, 0] ; cnt+=1 ; obj)
qsort objArr sortByAxis axis:#x maxtomin:off -- selected in order from left to right along X axisprint objArr
--qsort objArr sortByAxis axis:#x maxtomin:on -- selected in order from right to left along X axis
As you can see you can choose any axis and sorting order ei:
-> if you set #x axis and "maxtomin" argument is "off" then objects array is sorted
along x-axis from left to right
-> if you set #z axis and "maxtomin" argument is "on" then objects array is sorted
along z-axis from top to bottom
etc.
It's easy pretty much :)
Cheers!
Comments
...
This can help
bga
...
As you can see you can choose any axis and sorting order ei:
-> if you set #x axis and "maxtomin" argument is "off" then objects array is sorted
along x-axis from left to right
-> if you set #z axis and "maxtomin" argument is "on" then objects array is sorted
along z-axis from top to bottom
etc.
It's easy pretty much :)
Cheers!
bga
...
This is another example of QSort method
http://www.scriptspot.com/forums/3ds-max/general-scripting/example-how-t...
bga
This is just what I needed..
This is just what I needed.. however how do you ignore objects on hidden layers ?
...
To collect all not hidden objects just use
At least try to read MXS help
bga