[vtkusers] how to get the other part from vtkclipclosedsurface

Jorge Perez josp.jorge at gmail.com
Fri Sep 2 06:10:15 EDT 2016


Hi, try inverting the normal of the plane

clipPlane.SetNormal(0,0,-1)

2016-09-02 11:48 GMT+02:00 sdpkrshnn <sdpkrshnn at gmail.com>:

> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160902/88624dbd/attachment.html>


More information about the vtkusers mailing list