Load and read ply files with Pymesh
Asked Answered
S

5

7

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.

Symptomatic answered 5/5, 2016 at 14:9 Comment(1)
did you find a solution ?Taggart
C
14

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.

Conferral answered 5/12, 2016 at 6:53 Comment(2)
@Bárbara Duarte : following the build and install steps in this doc page made it work for me. I am upvoting this answer and suggest you select it as the answer.Thermosetting
This is definitely the solution to the problem. The Python Package Index page for pymesh differs is a completely different package that only supports loading STL and OBJ files. This answer links the appropriate package for the pymesh package the OP is looking for.Melitamelitopol
I
8

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.

Internalcombustion answered 24/1, 2018 at 16:4 Comment(1)
I managed to compile pymesh.readthedocs.io/en/latest with no problem. In Ubuntu 16.04 I only had to manually update my cmake to fulfill dependencies.Bastinado
B
3

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, ...
Boise answered 19/10, 2019 at 12:30 Comment(0)
C
0

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.

Conic answered 29/1, 2021 at 15:17 Comment(0)
S
-5

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.

Staten answered 5/5, 2016 at 14:28 Comment(3)
Thanks for your answer. I import pymesh and there isn't a file with name pymesh.py. The import is ok, but the error is about "load_mesh" function. I don't know if I am using the right library, because I find this pymesh.readthedocs.io/en/latest and this pypi.python.org/pypi/pymesh. Is it the same? The tutorial of each one is different.Genu
I need to open ply files, but in pymesh page (github.com/taxpon/pymesh) says that just opens STL & OBJ. I am confused.Genu
Alex's answer is more likely the case, pip install pymesh gets a different package than the one OP is looking to use (based on the doc he provides).Santoro

© 2022 - 2024 — McMap. All rights reserved.