Jump to content

[SOLVED]Zero Padding For Pieces?


Atom

Recommended Posts

Hello All,

 

I have a fracture that is generating pieces for groups. They are automatically named without zero padding. For frame numbers I know I can use $F4 for instance. Is there some similar mechanism for zero padding piece names?

 

I would like my piece names to be something like this...

piece_0001

piece_0002

etc...

 

instead of...

piece1

piece2

Edited by Atom
Link to comment
Share on other sites

Hello All,

 

I have a fracture that is generating pieces for groups. They are automatically named without zero padding. For frame numbers I know I can use $F4 for instance. Is there some similar mechanism for zero padding piece names?

 

I would like my piece names to be something like this...

piece_0001

piece_0002

etc...

 

instead of...

piece1

piece2

Hi!

 

Not the most elegant way but works!

 

Cheers!

padding.hip

Link to comment
Share on other sites

Thanks Pazuzu. While not exactly a fit, it got me thinking about how to use the padzero.

 

I used a FOREACH, running over groups, with a GROUP inside. However, instead of creating a group (turn that off) I used the Rename feature under the Edit Groups tab. Because the FOREACH supplies the index I could pass that to the padzero.

piece_`padzero(3,stamps ("../", "FORIDXVALUE", 0))`

ap_zero_padding.hipnc

Edited by Atom
Link to comment
Share on other sites

I would avoid slow for each loop whenever it's possible.

 

Voronoi Pieces will generate name attribute. You can set group membership (with padding) with primitive wrangle like this:

string group_name = sprintf("piece_%04d",opdigits(@name));
setprimgroup(0, group_name, @primnum, 1, "set");

s@name = group_name; //update name

It's much faster. But if you don't have to, just use that attribute directly.

  • Like 3
Link to comment
Share on other sites

I would avoid slow for each loop whenever it's possible.

 

Voronoi Pieces will generate name attribute. You can set group membership (with padding) with primitive wrangle like this:

string group_name = sprintf("piece_%04d",opdigits(@name));
setprimgroup(0, group_name, @primnum, 1, "set");

s@name = group_name; //update name

It's much faster. But if you don't have to, just use that attribute directly.

Nice solution as always!!

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...