pyvista.Plotter.import_obj

pyvista.Plotter.import_obj#

Plotter.import_obj(filename, filename_mtl=None) None[source]#

Import from .obj wavefront files.

Added in version 0.44.0.

Parameters:
filenamestr | Path

Path to the .obj file.

filename_mtlstr, optional

Path to the .mtl file.

Examples

>>> import pyvista as pv
>>> from pyvista import examples
>>> download_obj_file = examples.download_room_surface_mesh(load=False)
>>> pl = pv.Plotter()
>>> pl.import_obj(download_obj_file)
>>> pl.show()
../../../_images/pyvista-Plotter-import_obj-1_00_00.png

Import an .obj file with a texture.

>>> from pathlib import Path
>>> filename = examples.download_doorman(load=False)
>>> pl = pv.Plotter()
>>> pl.import_obj(filename)
>>> pl.show(cpos='xy')
../../../_images/pyvista-Plotter-import_obj-1_01_00.png