1

新手来了!

我有一个 STL 文件,它不是水密的,并且间隙很大,可以用修剪的封闭顶点修复。

我按照这个尝试了open3d,但出现以下错误:“ValueError:向量太长”..

有什么方法可以使网眼不透水吗?我需要计算 CoM 和惯性矩阵,但如果我的网格不是水密/封闭表面,这些值将不正确。

对于 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)

非常感谢任何帮助!

4

1 回答 1

1

我设法使网状结构防水。我会在这里发帖,以防将来有人遇到麻烦。

我的网格实际上是由 2 个较小的网格组成的,所以我必须先将它们合并在一起,然后使用 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()
于 2020-11-16T08:21:11.087 回答