Jump to content

cermmid

Recommended Posts

Merge all objects, pack them after connectivity and lay them out with a for loop which sums up all widths plus the spacing.

This detail wrangle code is not sufficient but should give you an idea:

float space = chf('space');
float shift = 0.0;
for(int i = 0; i < npoints(0); i++){
    float bounds[] = primintrinsic(0, 'packedbounds', i);
    float width = bounds[1] + abs(bounds[0]);
    vector pos = set(shift, 0.0, 0.0);
    setpointattrib(0, 'P', i, pos, 'add');
    shift += width + space;
}

 

distribute_objects.hiplc

  • Like 1
Link to comment
Share on other sites

here is slightly modified code to Konstantin's answer to account for pivots and real bounds in case your packed pieces are already transformed

float space = chf('space');
vector offset = 0.0;
for(int i = 0; i < npoints(0); i++){
    float bounds[] = primintrinsic(0, 'bounds', i);
    vector pivot = set(bounds[0], 0, 0);
    setpointattrib(0, 'P', i, offset-pivot, 'add');
    float width = bounds[1] - bounds[0];
    offset.x += width + space;
}

 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...