Bárbara Duarte
Bárbara Duarte

Reputation: 589

Load and read ply files with Pymesh

I am trying to load/read a ply file using PyMesh and this line command:

mesh = pymesh.load_mesh("model.obj")

as it is in http://pymesh.readthedocs.io/en/latest/basic.html.

But this gives me an error "AttributeError: 'module' object has no attribute 'load_mesh'".

Am I doing anything wrong? Also I want to know if PyMesh really allows to visualize in 3d the objects.

Thank you.

Upvotes: 7

Views: 27228

Answers (5)

Sankios
Sankios

Reputation: 181

Since you are look for load_mesh() method, i think that you are looking for this library. This is the related doc.

If true, you have to install pymesh2

pip install pymesh2

Otherwise you have to follow the instructions contained in that page as already suggested, but they are more complex.

Upvotes: 0

Nico Schlömer
Nico Schlömer

Reputation: 58881

On a side note, meshio (one of my projects) now supports PLY as well. Install with

pip3 install meshio

and use on the command line like

meshio-convert in.ply out.vtk

or from within Python like

import meshio

mesh = meshio.read("in.ply")
# mesh.points, mesh.cells, ...

Upvotes: 3

G M
G M

Reputation: 22510

There are actually two modules named pymesh.

Pymesh by Takuro Wada

If you install pymesh using pip you are installing this one which has the following GitHub page.

It reads: .sty and .obj

Pymesh by Qingnan Zhou

If you want to install http://pymesh.readthedocs.io/en/latest/ you have to follow the installation guidelines here.

It is more complex, I never manage to get it working, but it should read also .ply.

Upvotes: 8

Alex Kelly
Alex Kelly

Reputation: 141

If you installed with pip, you might not have gotten the pymesh module you were intending to use. Since you're looking for the load_mesh() method, you'll want to use this installation guide: http://pymesh.readthedocs.io/en/latest/installation.html.

Upvotes: 14

hungry_python
hungry_python

Reputation: 13

Either you have not imported the pymesh library

import pymesh

OR

You have a file named pymesh.py in your directory where you are executing this file.

If this is the case, then rename the file to some other name.

Upvotes: -5

Related Questions