dhart.geometry.LoadOBJ

dhart.geometry.LoadOBJ(path: str, group_type: OBJGroupType = 0, rotation: Tuple[float, float, float] = (0, 0, 0)) MeshInfo | List[MeshInfo]

Load an obj file from the given path.

Parameters:
  • path – The path to a valid OBJ file.

  • group_type – (NOT IMPLEMENTED) How IDs will be assigned to different parts of the mesh

  • rotation – Rotation in degrees to be performed on the OBJ after it is loaded. Useful for converting models from Y-Up to Z-Up.

Returns:

A new meshinfo object containing a the vertices and triangles

for the obj in path. If group_type is not ONLY_FILE, a list of meshes may be returned if submeshes are found.

Return type:

MeshInfo

Raises:

Example

Load plane.obj from a folder titled “Example Models” but fail because that file doesn’t exist

>>> import dhart
>>> from dhart.geometry import LoadOBJ
>>> obj = dhart.get_sample_model("not_real.obj")
>>> MI = LoadOBJ(obj)
Traceback (most recent call last):
...
dhart.Exceptions.FileNotFoundException
>>> import dhart
>>> from dhart.geometry import LoadOBJ
>>> obj = dhart.get_sample_model("plane.obj")
>>> MI = LoadOBJ(obj)
>>> MI
(EntireFile, 0)