[Closed] Need Help – Consistend Space
Hi,
i want a little Maxscript, to position Objects with an consistent gap. Because of my bad English knowledge I attached simply a picture to explanation.
How am I to concern that?
Thank you in advance
oli
The following code will help you to put objects between 2 other objects.
-- select 3 objects and run the script.
-- The 3rd Object will be positioned between the 1st and 2nd
tempObjAr = selection as array
try (
tempObjAr[3].pos = (tempObjAr[1].transform.pos + tempObjAr[2].transform.pos)/2
)
catch()
for multiple objects :
-- select objects in the order you want.
-- run the script.
-- This will place every object between the preceeding and next object
tempObjAr = selection as array
try
(
for i = 2 to (tempObjAr.count - 1) do
(
tempObjAr[i].pos = (tempObjAr[i-1].transform.pos + tempObjAr[i+1].transform.pos)/2
)
)
catch()
Hi Oli,
this should get you started:
(
theSel = selection as array
-- ---
theStart = theSel[1].pos.x
theEnd = theSel[theSel.count].pos.x
theDist = theEnd - theStart -- abs (theEnd - theStart)
theGap = theDist / (theSel.count - 1)
for i = 2 to (theSel.count - 1) do (
theSel[i].pos.x = theStart + theGap * (i - 1)
)
)
The script distributes selected objects evenly in x.
Be shure to select the objects with [ctrl-LMB] in the order you want them to be arranged
Just drawing a selection around the objects will result in an random order.
Hope this helps
Georg
**Edit: I removed the abs. Now the scripts works with right to left selections …
Hi aaaaCHoooo and Georg,
Thanks for this great (and very very fast) help, i learned today a lot.
By the way: Georg i love youre psd2mat script. It is perfect. :applause:
Just one little thing is in my wishlist: normal map
Oli