如何使一个开放的stl文件滴水不漏



这里是新手!

我有一个STL文件,它不是防水的,间隙很大,需要用三聚体的闭合顶点来修复。

我尝试通过以下方式使用open3d,但我有以下错误:;ValueError:矢量太长";。。

有什么办法使网不透水吗?我需要计算CoM和Inertia矩阵,但如果我的网格不是防水的/封闭的表面,则这些值将不正确。

对于open3d,首先我上传了stl文件,我将其转换为numpy,然后我使用了以下代码:

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(DataNP)
o3d.io.write_point_cloud("testinggggg.ply", pcd)
poisson_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson(pcd, depth=8, width=0, scale=1.1, linear_fit=False)[0]
bbox = pcd.get_axis_aligned_bounding_box()
p_mesh_crop = poisson_mesh.crop(bbox)
o3d.io.write_triangle_mesh("output_testinggggg.ply", dec_mesh)

非常感谢您的帮助!

我已经设法使网格防水。我会在这里张贴,以防将来有人遇到麻烦。

我的网格实际上是由两个较小的网格组成的,所以我必须首先将它们合并在一起,然后使用VTK库来清理网格并填充孔。这使我的网格防水,我可以计算出我需要的一切。

这是代码:

input1 = vtk.vtkPolyData()
input2 = vtk.vtkPolyData()

input1.DeepCopy(Data1.GetOutput())
input2.DeepCopy(Data2.GetOutput())
# Append the two meshes 
appendFilter = vtk.vtkAppendPolyData()
appendFilter.AddInputData(input1)
appendFilter.AddInputData(input2)
appendFilter.Update()
#  Remove any duplicate points.
cleanFilter = vtk.vtkCleanPolyData()
cleanFilter.SetInputConnection(appendFilter.GetOutputPort())
cleanFilter.Update()

# newData = cleanFilter
fill = vtk.vtkFillHolesFilter()
fill.SetInputConnection(appendFilter.GetOutputPort())   
fill.SetHoleSize(100)    
fill.Update()

最新更新