Length in Meters From Prim

Hey there everyone,
I’m working on an extension for Omniverse right now that gets its models from Revit and then does some data analysis. The Revit connection is no problem, and is actually super intuitive, but my issue arises in how Omniverse seems to strip the units of measurement out from the prims.
My end goal is simply to get the surface area of a Revit floor (or anything for that matter) in Omniverse.
Can someone point me in the right direction here?

Much appriciated!

Hi @coopgod

You can get the current stage unit using the following snippet:

import omni
from pxr import UsdGeom

stage = omni.usd.get_context().get_stage()
stage_unit = UsdGeom.GetStageMetersPerUnit(stage)

For example, the stage unit in:

  • Create (centimeter as default unit): 0.01
  • Isaac Sim (meter as default unit): 1.0

Then, you can affect the measurement to obtain the final value in the expected unit.

final_value_in_meters = current_value_unitless / stage_unit
1 Like

Hey @toni.sm ,
Thanks for the response! This is super helpful!
Do you have any suggestions on how to actually get the width and height of a prim? My issue currently is that even though I don’t have a perfect square floor (let’s say 1m, 3m, 0.2m) the x, y and z will both be equal to 1 unitless.
I also can’t seem to find anything in the geometry section that would hint at a way to find the actual size of the prim.

Your help is much appreciated!

Hi @coopgod

This link may be helpful


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.