vex: int to string? (for Font sop)

   10182   3   2
User Avatar
Member
1014 posts
Joined: April 2017
Offline
Hi!

I have a bunch of points and I would like a copy-to-point to place a number on each point (@ptnum) with the font Sop. I'm tring to find a way to convert my @ptnum to a string that I would place in a detail attribute and later pick that from info in a Font sop.

Any tips on doing this?

-Olivier
User Avatar
Member
209 posts
Joined: March 2018
Offline
Did you mean something like attached HIP file?

Attachments:
Copy Font to Points.hip (89.4 KB)

User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Hi, Olivier,

you can convert an integer to a string using the “standard” itoa function (https://www.sidefx.com/docs/houdini/vex/functions/itoa.html) - you can set the detail attribute using setdetailattrib:

setdetailattrib(0, "point-id", itoa(@ptnum), "set");

Note that this only makes sense if you have a single point per geometry … the detail-attribute name here is “point-id”.

I hope this helps,
Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
1014 posts
Joined: April 2017
Offline
This looks perfect! Thanks!

-Olivier
  • Quick Links