vedo icon indicating copy to clipboard operation
vedo copied to clipboard

selecting a surface on the mesh

Open smoothumut opened this issue 2 years ago • 2 comments
trafficstars

Hi Marco,

I would love to get your help, I just need your direction.

I have a mesh and It has holes on it. I want to fill the holes but not all of them. I want user to select surface on the mesh and I want to fill the hole/holes on it I get the vertices to select the surface. I have 2 questions 1- how can I get the surface with selection of vertices. I can get the vertices/faces by selecting them with mouse, but how can I connect them to get my surface 2- how can I fill that hole with given surface. ( I guess vtkFillHolesFilter would do it if I can provide surface data)

thanks in advance and regards

EDIT: I have found some great examples in advance section.

smoothumut avatar Jun 23 '23 07:06 smoothumut

Hi Marco, I have been trying to implement your "cut_with_point_loop" function, But I am having some troubles about what I want.

here is the code I applied vpts => are 3d point array where I select by mouse

spol = vtk.vtkSelectPolyData() spol.SetLoop(vpts) spol.GenerateSelectionScalarsOn() spol.GenerateUnselectedOutputOff() spol.SetInputData(self.mesh.polydata()) spol.Update()

clipper = vtk.vtkClipPolyData() clipper.SetInputData(spol.GetOutput()) clipper.SetInsideOut(not invert) clipper.SetValue(0.0) clipper.Update() cpoly = clipper.GetOutput()

I am getting vtkpolydata as a result, I want to get cell Ids of that selected area of mesh to color them. But the cpoly gives me new cellIds starts from 0 I want to select and color those cells in the current mesh, I want to label them lets say. what am I doing wrong, am I missing something? how can I just select the cells or points in that area to move forward

smoothumut avatar Jun 23 '23 14:06 smoothumut

You are right... for some reason vtkSelectPolyData does not pass the data associated to points and faces (it should)... What about creating a point id array and then interpolating it: mesh1.add_ids() cut it and then use mesh1cut.interpolate_data_from(mesh1, n=1)

marcomusy avatar Jun 28 '23 19:06 marcomusy