Hi Pilou,

> When objects are distributed can we have an option for have regrouped objets with o distance?

> Or maybe it's yet integrated ? (but i don't find the trick with "Distribute" :)

Well, earlier in this thread I had asked:

"If I understand correctly, the first and last one stay where they are and only the interior ones move?"

The one you're showing there has the last one moving, so it doesn't fit with the requirements.

But it is possible to make some modifications to the script so it will behave like you want, try saving Distribute.js and Distribute.htm to new files DistributePilou.js and DistributePilou.htm , then on line 48 there's a section of code that calculates the space, it looks like this:

** code:**

var total_space = sorted[sorted.length-1].bounds.min[dir] - sorted[0].bounds.max[dir];
var occupied_space = 0;
for ( var i = 1; i < sorted.length-1; ++i )
occupied_space += sorted[i].bounds.max[dir] - sorted[i].bounds.min[dir];
var available_space = total_space - occupied_space;
var target_space_between = available_space / (sorted.length-1);

Comment out that entire section and replace it with just var target_space_between = 0, so it should look like this:

** code:**

/*
var total_space = sorted[sorted.length-1].bounds.min[dir] - sorted[0].bounds.max[dir];
var occupied_space = 0;
for ( var i = 1; i < sorted.length-1; ++i )
occupied_space += sorted[i].bounds.max[dir] - sorted[i].bounds.min[dir];
var available_space = total_space - occupied_space;
var target_space_between = available_space / (sorted.length-1);
*/
var target_space_between = 0;

Then the only other change is a couple lines below that is the loop that moves the objects, it looks like this:

** code:**

for ( var i = 1; i < sorted.length-1; ++i )
{

That loop needs to be adjusted to loop through sorted.length instead of sorted.length-1 , so if you take off the -1 so it looks like this:

** code:**

for ( var i = 1; i < sorted.length; ++i )
{

Then after that you should have a DistributePilou command that works like you wanted.

- Michael