[vtkusers] how to get the other part from vtkclipclosedsurface
sdpkrshnn
sdpkrshnn at gmail.com
Fri Sep 2 05:48:43 EDT 2016
Hi,
I am Cutting a mesh using vtkClipClosedSurface but it is always keeping one
part and i need get the other part which is cropped ,my code is here below
quad = vtk.vtkSTLReader()
quad.SetFileName(vtkFile)
quad.Update()
mesh = quad.GetOutput()
clipPlane = vtk.vtkPlane()
clipPlane.SetOrigin(0,0,-54.3772147817)
clipPlane.SetNormal(0,0,1)
centerFilter = vtk.vtkCenterOfMass()
centerFilter.SetInput(mesh)
centerFilter.SetUseScalarsAsWeights(False)
centerFilter.Update()
center = centerFilter.GetCenter()
print center
transform = vtk.vtkTransform()
transform.Translate(-center[0], -center[1], -center[2])
transformFilter = vtk.vtkTransformPolyDataFilter()
transformFilter.SetInput(mesh)
transformFilter.SetTransform(transform)
transformFilter.Update()
centeredPolydata = transformFilter.GetOutput()
clip = vtk.vtkClipClosedSurface()
clip.SetInputConnection(transformFilter.GetOutputPort())
planes = vtk.vtkPlaneCollection()
planes.AddItem(clipPlane)
clip.SetTolerance(10e-3)
clip.SetClippingPlanes(planes)
clip.Update()
mesh = clip.GetOutput()
polyWriter = vtk.vtkSTLWriter()
polyWriter.SetInput(mesh)
polyWriter.SetFileName(vtkfile)
polyWriter.Write()
Can any one suggest any dolution
--
View this message in context: http://vtk.1045678.n5.nabble.com/how-to-get-the-other-part-from-vtkclipclosedsurface-tp5740105.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list