Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import omni.kit.commands
import omni.usd
from omni.isaac.core.utils.extensions import enable_extension
from pxr import Usd, UsdGeom, UsdPhysics, UsdUtils
from pxr import Tf, Usd, UsdGeom, UsdPhysics, UsdUtils

from omni.isaac.lab.sim.converters.asset_converter_base import AssetConverterBase
from omni.isaac.lab.sim.converters.mesh_converter_cfg import MeshConverterCfg
Expand Down Expand Up @@ -81,6 +81,16 @@ def _convert_asset(self, cfg: MeshConverterCfg):
mesh_file_basename, mesh_file_format = os.path.basename(cfg.asset_path).split(".")
mesh_file_format = mesh_file_format.lower()

# Check if mesh_file_basename is a valid USD identifier
if not Tf.IsValidIdentifier(mesh_file_basename):
# Correct the name to a valid identifier and update the basename
mesh_file_basename_original = mesh_file_basename
mesh_file_basename = Tf.MakeValidIdentifier(mesh_file_basename)
omni.log.warn(
f"Input file name '{mesh_file_basename_original}' is an invalid identifier for the mesh prim path."
f" Renaming it to '{mesh_file_basename}' for the conversion."
)

# Convert USD
asyncio.get_event_loop().run_until_complete(
self._convert_mesh_to_usd(
Expand Down
4 changes: 0 additions & 4 deletions source/standalone/tools/convert_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ def main():
if not os.path.isabs(dest_path):
dest_path = os.path.abspath(dest_path)

print(dest_path)
print(os.path.dirname(dest_path))
print(os.path.basename(dest_path))

# Mass properties
if args_cli.mass is not None:
mass_props = schemas_cfg.MassPropertiesCfg(mass=args_cli.mass)
Expand Down
Loading