![](https://secure.gravatar.com/avatar/267dc7344d6b3d9faa64ac7d1f532c92.jpg?s=120&d=mm&r=g)
Hello everybody, First, thanks a lot for your neat work on openmesh! I am creating meshes for 3D modelling as a part of my masters thesis and I am glad to use a well written library. I am able to build many things and play with it thanks to openmesh, however I encounter some troubles from time to time. I asked some communities (stackoverflow for instance) but the subject does not seem to be hot right now, and experts are hard to find, so I am asking you. I use openmesh with Python 3.6. Openmesh was installed with a 'pip install openmesh' : *1/ First*, I wanted to add custom propetries to vertices of the mesh, it does work but does not write in the file, or it is not read when the file is re-opened, here is my code : import openmesh as OM import numpy as np mesh = OM.TriMesh() #Add some vertices vh0 = mesh.add_vertex(np.array([0,0,0])); vh1 = mesh.add_vertex(np.array([1,0,0])); vh2 = mesh.add_vertex(np.array([1,1,0])); vh3 = mesh.add_vertex(np.array([0,1,0])); #Create some data data = np.arange(mesh.n_vertices) #Add custom property for vh in mesh.vertices(): mesh.set_vertex_property('prop1', vh, data[vh.idx()]) #Check properties have been added correctly print(mesh.vertex_property('prop1')) #prints data matrix OM.write_mesh('mesh.om',mesh) #Re-load mesh in another instance : mesh1 = OM.TriMesh() mesh1 = OM.read_trimesh('mesh.om') #Check property is still there print(mesh1.vertex_property('prop1')) #Prints a matrix of 'None'... So, I cannot save then read a custom property. (So far, I save custom properties into a csv file, which is okay but not convienient.) *2/ Another issue* I encounter is when I want to save a mesh into a vtk file. The writter writes nothing . Here is my code : import openmesh as OM mesh = OM.TriMesh() #Add some vertices vh0 = mesh.add_vertex([0,0,0]) vh1 = mesh.add_vertex([0,1,1]) vh2 = mesh.add_vertex([1,0,1]) vh3 = mesh.add_vertex([1,1,0]) #Add some faces (we are building a tetrahedron here) mesh.add_face(vh0,vh1,vh2) mesh.add_face(vh0,vh2,vh3) mesh.add_face(vh0,vh3,vh1) mesh.add_face(vh1,vh3,vh2) OM.write_mesh('TEST_MESH.vtk',mesh) Nothing is written. (When I put .ply or .om ... instead of .vtk, it works just fine) According to the documentation, it should work, so I don't know what I am doing wrong. If you have any tips or advices, it would be very appreciated, Thank you for your time, thank you for your help, Charles Duvert.
![](https://secure.gravatar.com/avatar/aeb9e2320d0205798d52a04d9d30f7c7.jpg?s=120&d=mm&r=g)
Hi Charles, you probably already saw this but for completeness sake, the questions were answered here: https://stackoverflow.com/questions/51174821/is-it-possible-to-save-a-mesh-i... https://stackoverflow.com/questions/50413319/how-to-save-custom-vertex-prope... Regards, - Isaak Lim On 07/04/2018 04:19 PM, Charles Duvert wrote:
Hello everybody,
First, thanks a lot for your neat work on openmesh! I am creating meshes for 3D modelling as a part of my masters thesis and I am glad to use a well written library.
I am able to build many things and play with it thanks to openmesh, however I encounter some troubles from time to time. I asked some communities (stackoverflow for instance) but the subject does not seem to be hot right now, and experts are hard to find, so I am asking you.
I use openmesh with Python 3.6. Openmesh was installed with a 'pip install openmesh' :
*1/ First*, I wanted to add custom propetries to vertices of the mesh, it does work but does not write in the file, or it is not read when the file is re-opened, here is my code :
|importopenmesh asOM importnumpy asnp mesh =OM.TriMesh()#Add some verticesvh0 =mesh.add_vertex(np.array([0,0,0]));vh1 =mesh.add_vertex(np.array([1,0,0]));vh2 =mesh.add_vertex(np.array([1,1,0]));vh3 =mesh.add_vertex(np.array([0,1,0]));#Create some datadata =np.arange(mesh.n_vertices)#Add custom propertyforvh inmesh.vertices():mesh.set_vertex_property('prop1',vh,data[vh.idx()])#Check properties have been added correctlyprint(mesh.vertex_property('prop1'))#prints data matrix OM.write_mesh('mesh.om <http://mesh.om>',mesh)|
|#Re-load mesh in another instance : |
|mesh1 =OM.TriMesh()mesh1 =OM.read_trimesh('mesh.om <http://mesh.om>')#Check property is still there print(mesh1.vertex_property('prop1')) |
|#Prints a matrix of 'None'... |
So, I cannot save then read a custom property. (So far, I save custom properties into a csv file, which is okay but not convienient.)
*2/ Another issue* I encounter is when I want to save a mesh into a vtk file. The writter writes nothing . Here is my code :
|importopenmesh asOM mesh =OM.TriMesh()#Add some verticesvh0 =mesh.add_vertex([0,0,0])vh1 =mesh.add_vertex([0,1,1])vh2 =mesh.add_vertex([1,0,1])vh3 =mesh.add_vertex([1,1,0])#Add some faces (we are building a tetrahedron here)mesh.add_face(vh0,vh1,vh2)mesh.add_face(vh0,vh2,vh3)mesh.add_face(vh0,vh3,vh1)mesh.add_face(vh1,vh3,vh2)OM.write_mesh('TEST_MESH.vtk',mesh)
|
|Nothing is written. (When I put .ply or .om ... instead of .vtk, it works just fine) |
According to the documentation, it should work, so I don't know what I am doing wrong. If you have any tips or advices, it would be very appreciated,
Thank you for your time, thank you for your help,
Charles Duvert.
_______________________________________________ OpenMesh mailing list -- openmesh@lists.rwth-aachen.de To unsubscribe send an email to openmesh-leave@lists.rwth-aachen.de %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
-- Isaak Lim, M.Sc. RWTH Aachen University Visual Computing Institute Graphics, Geometry and Multimedia Ahornstraße 55 52074 Aachen Room 109 Phone: +49 241 8021805
participants (2)
-
Charles Duvert
-
Isaak Lim