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
1330 4 0- VGriffith
- Member
- 128 posts
- Joined: 9月 2018
- Offline
- TRex92
- Member
- 35 posts
- Joined: 12月 2012
- Offline
- VGriffith
- Member
- 128 posts
- Joined: 9月 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 - 2021年11月4日 18:16:12
- Andr
- Member
- 900 posts
- Joined: 2月 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
- 4521 posts
- Joined: 2月 2012
- Online
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]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]
youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
-
- Quick Links