cermmid Posted February 11, 2019 Share Posted February 11, 2019 Hello, I've got 3 boxes first is 15x20, second 20x20, and third 30x30. I want to distribute them in one direction in right orded but also to have even spaces between them. Anybody ecnountered similiar problem? Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted February 16, 2019 Share Posted February 16, 2019 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 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted February 17, 2019 Share Posted February 17, 2019 in Point, change Axis..and Offset = Gap (this does not have 'order by size' logic in it) vu_Stacker.hipnc Quote Link to comment Share on other sites More sharing options...
anim Posted February 17, 2019 Share Posted February 17, 2019 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; } 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.