Round decimal size, position, rotation.

   994   1   2
User Avatar
Member
4 posts
Joined: Feb. 2023
Offline
Houdini Round Decimal Size, Position and Rotation Geometries

Hello. I need help. I need to round geometry size, position and rotation values.

Before:

Example of 3D geometry with non-rounded size:
X 200,134 cm
Y 200,321 cm
Z 200,432 cm

After:

Example of 3D geometry with rounded size:
X 200 cm
Y 200cm
Z 200 cm

or

x 200.1cm
Y 200.3 cm
Z 200.4cm


I need to round the size by controlling the number of decimals, using VEX or Python in Houdini.
When exporting in FBX, USD or ABC, 3D geometry in CAD/3D software appears with rounded size, position and rotation.

The script should work for all geometries of various sizes, position and rotation. Not just the example.

Attachments:
Screenshot_20231109_035157_TeamViewer.jpg (517.9 KB)

User Avatar
Member
68 posts
Joined: Nov. 2021
Offline
in VEX rint(value) rounds value to closest whole number, to get decimals, use multiplications and divisions


rint(0.5215) -> 1
rint(0.5215 * 10) / 10 -> 0.5
rint(0.5215 * 100) / 100 -> 0.52
rint(0.5215 * 1000) / 1000 -> 0.522
  • Quick Links