PDA

View Full Version : More than one object equal portions of the problem


su37
07-07-2011, 05:42 AM
Hi all
I have a question ,Hope helps ,Thanks
My english is poor
Please see Picture.

stefan
07-07-2011, 09:02 AM
SelA=Selection as array
NumA=0.0
DistanceA=100
For i = 1 to SelA.count do
(
SelA[i].pos.x = NumA + DistanceA+ (SelA[i].pos.x-SelA[i].min.x)
NumA= SelA[i].Max.x
)

su37
07-08-2011, 02:43 AM
Hi stefan Thank you.
Maybe I did not say understand,
The first object's position and the last object's position is fixed (Unchanged).

stefan
07-08-2011, 09:41 AM
SelA=Selection as array
ObjXDim=0.0
For i = 2 to (SelA.count-1) do
(
ObjXDim=ObjXDim+(SelA[i].max.x-SelA[i].min.x)
)
XStart=SelA[1].max.x
For i = 2 to (SelA.count-1) do
(
FromMinToPivot=(SelA[i].pos.x-SelA[i].min.x)
SelA[i].pos.x=XStart+(((SelA[SelA.count].min.x - SelA[1].max.x)-ObjXDim)/(SelA.count-1))+FromMinToPivot
XStart=SelA[i].max.x
)

su37
07-08-2011, 04:26 PM
Hi stefan
After my test, your script is not correct.
Please see picture !

denisT
07-08-2011, 05:48 PM
here is a basic idea:

fn x_spaceObjects nodes space:20 pos:[0,0,0] =
(
for node in nodes do
(
size = (node.max - node.min)
node.center = [pos.x + size.x*0.5, pos.y, pos.z + size.z*0.5]
pos.x += size.x + space
)
)
/*
(
delete objects
classes = #(box, teapot, sphere, cylinder, cone)
nodes = for k=1 to 20 collect
(
node = classes[random 1 classes.count] scale:([1,1,1]*(random 0.5 2.0)) wirecolor:(random white black)
)
x_spaceObjects nodes
)
*/


anything else do yourself.

stefan
07-08-2011, 10:41 PM
it is for multiple objects
select 3-100 objects run script and it
-takes x width of objects.
-subtract it from space between first and last obj selected. Divide it by number of objects
-moves objects one by one and leaves equal space between them
it depends on selection order,
but I probably do not understand so...

CGTalk Moderation
07-08-2011, 10:41 PM
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.