inducer / meshpy

2D/3D simplicial mesh generator interface for Python (Triangle, TetGen, gmsh)
http://mathema.tician.de/software/meshpy
Other
518 stars 108 forks source link

triangle meshes #45

Closed steersteer closed 4 years ago

steersteer commented 4 years ago

Hi, I'm having a little trouble creating surface meshes. So far I've had good success with creating tet meshes using:

import meshpy.tet as tet from meshpy.tet import MeshInfo

verts, faces= marching_cubes_lewiner(stack, step_size=19) tetmesh_info = MeshInfo() tetmesh_info.set_points(verts) tetmesh_info.set_facets(faces) tetmesh = tet.build(tetmesh_info) tetmesh.write_vtk("Output\Meshes\{}_tetrahedral_mesh.vtk".format(name))

But when I try to create a triangle using:

import meshpy.triangle as tri from meshpy.triangle import MeshInfo

trimesh_info = tri.MeshInfo() trimesh_info.set_points(verts) trimesh_info.set_facets(faces) trimesh = tri.build(trimesh_info)

I get the error "ValueError: value must be a sequence of length self.unit"

Is there something I'm missing? Also is it possible to feed a surface mesh built with triangle into tetgen?

inducer commented 4 years ago

This issue tracker is for bugs, not technical support. Please send a message to the mailing list for tech support. One reason for this request is that I am typically the only one who sees issue email, and I am unable to handle the tech support load on my own.

verts must contain 2D points, not 3D. Some ground rules for tech support: Provide self-contained minimum working examples. (Yours isn't.) Provide full tracebacks. (I provide this advice as a courtesy. If you need to follow up, please use the mailing list.)

inducer commented 4 years ago

As for triangle -> tetgen: nothing canned exists (and likely does't make sense because you'll need to transform 2D->3D in some way).