So my class attribute number starts with a "0" but I would like to take the class attribute that start with 0 and make it with a padding of 2 and make it a 00, then 01, 02, 03... ...10, 11, 12 and so on.
Can anyone help with this?
Class Attribute With A Padding of 2
3227 4 0-
- VGriffith
- Member
- 134 posts
- Joined: Sept. 2018
- Offline
-
- TRex92
- Member
- 43 posts
- Joined: Dec. 2012
- Offline
-
- VGriffith
- Member
- 134 posts
- Joined: Sept. 2018
- Offline
TRex92
Are you in vex, python = v1.zfill(10), or hscript = padzero(size, value)? Also it would have to be a string instead of an int or float I believe.
I am currently using the connectivity sop, setting connectivity type to Primitive, and that is creating a class attribute. I have a prefix with "Mesh_". I just need the class attribute to be Mesh_00 instead of Mesh_0.
Edited by VGriffith - Nov. 4, 2021 18:16:12
-
- Andr
- Member
- 899 posts
- Joined: Feb. 2016
- Offline
Side note regarding string based workflows: try to avoid using string for your classes, and prefer using integers when you can.
It seems that string classes are slower to work with.
For a simple comparison, you can just run a plain for-loop over string and integer classes: the latter should iterate much faster.
It seems that string classes are slower to work with.
For a simple comparison, you can just run a plain for-loop over string and integer classes: the latter should iterate much faster.
-
- animatrix_
- Member
- 5100 posts
- Joined: Feb. 2012
- Offline
Hi,
You can do it like this:
You can do it like this:
s@id = sprintf("Mesh_%02d", i@class);
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
-
- Quick Links



