# Sort objects in a row with a gap

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 >= bb then
(
biggerW = bb
smallerW = bb
)
else
(
biggerW = bb
smallerW = bb
)
w = biggerW - smallerW

-- GET HEIGHT
if bb >= bb then
(
biggerH = bb
smallerH = bb
)
else
(
biggerH = bb
smallerH = bb
)
h = biggerH - smallerH

-- GET DEPTH
if bb >= bb then
(
biggerD = bb
smallerD = bb
)
else
(
biggerD = bb
smallerD = bb
)
d = biggerD - smallerD
)--end coordsys

oldObject = o
oldW = w
oldH = h
oldD = d
)--end for```

## Comment viewing options ### .

Thanks, I resolve it with the help of a friend in a simpler way, not perfect but works

local gap = 150
x=0
refplane.pos = [x,0,0]
x = x+gap ### `

if yuo want to sort selected objects you need to add below function :

`sort_objects_in_a_row selection "x" 20 20`

but I see this is not a full code of function... is it all you have ?