I have many planes in the same position and need to sort in a row with a gap for select them without problems (now all are coplanars)
I have studied this code form drag and drop script but I have no idea how execute this function
How can I do "sort_objects_in_a_row planes AXIS 20" where AXIS is x and gap is 20?
/**
Sorts objects on an axis with a given gap between.
planes = array of objects
axis = string "x", "y", or "z"
gap = integer number
local AXIS = "x" -- axis to align planes on
**/
fn sort_objects_in_a_row objs axis gap size=
(
local w, h, d
local oldW, oldH, oldD
local oldObject
for o in objs do
(
bb = nodeGetBoundingBox o o.transform
in coordsys o
(
-- GET WIDTH
if bb[1][1] >= bb[2][1] then
(
biggerW = bb[1][1]
smallerW = bb[2][1]
)
else
(
biggerW = bb[2][1]
smallerW = bb[1][1]
)
w = biggerW - smallerW
-- GET HEIGHT
if bb[1][2] >= bb[2][2] then
(
biggerH = bb[1][2]
smallerH = bb[2][2]
)
else
(
biggerH = bb[2][2]
smallerH = bb[1][2]
)
h = biggerH - smallerH
-- GET DEPTH
if bb[1][3] >= bb[2][3] then
(
biggerD = bb[1][3]
smallerD = bb[2][3]
)
else
(
biggerD = bb[2][3]
smallerD = bb[1][3]
)
d = biggerD - smallerD
)--end coordsys
oldObject = o
oldW = w
oldH = h
oldD = d
)--end for