PDA

View Full Version : Need Help - Consistend Space


blenderman0815
04-27-2007, 05:50 AM
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

shibumenon
04-27-2007, 06:26 AM
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()

shibumenon
04-27-2007, 06:32 AM
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()

rdg
04-27-2007, 06:33 AM
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 ...

blenderman0815
04-27-2007, 07:39 AM
Hi aaaaCHoooo and Georg,

Thanks for this great (and very very fast) help, i learned today a lot. :thumbsup:

By the way: Georg i love youre psd2mat script. It is perfect. :applause:
Just one little thing is in my wishlist: normal map

Oli

rdg
04-27-2007, 10:03 AM
-- ---
-- ---
-- ---

rdg
04-27-2007, 10:32 AM
mixed pm and post ... sorry

CGTalk Moderation
04-27-2007, 10:32 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.