[vtkusers] How to get poits of the output polydata of a vtkcutter( has pieces instead of points)?

Jothybasu Selvaraj jothybasu at gmail.com
Thu Feb 16 04:20:27 EST 2012


Something like this should help you.

Please make an example in wiki if this works.

OutlineVertices=list()
    Bounds=Object.GetBounds()
    s1=np.round(Bounds[4])
    s2=np.round(Bounds[5])
    #print s1,s2,'s1,s2'
    #print Bounds,'Bounds'
    for x in np.arange(s1-2,s2+2,0.5):
        plane=vtk.vtkPlane()
        plane.SetOrigin(0,0,x)
        plane.SetNormal(0,0,1)

        cutter=vtk.vtkCutter()
        cutter.SetCutFunction(plane)
        cutter.SetInput(Object)
        cutter.Update()

        out=cutter.GetOutput()
        points=out.GetPoints()
        NumPts=points.GetNumberOfPoints()
        #print NumPts,'npts'
        OutlinePts=np.zeros([NumPts,3])
        for n in range(0,NumPts,1):
            OutlinePts[n,:]=np.round(points.GetPoint(n))
        OutlineVertices.append(OutlinePts)
    return OutlineVertices


Jothy

On Thu, Feb 16, 2012 at 4:15 AM, soheilghafurian
<soheilghafurian at yahoo.com>wrote:

> I used the vtkCutter to build a contour on my poly data. I want to access
> the
> points of the contour but the polydata I get from vtkCutter->GetOutput()
> doesn't have points and has one piece instead.
>
> It would be great if someone told me how I can convert this polydata to a
> polydata which has points like polydata normaly does.
>
> Thanks a lot
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/How-to-get-poits-of-the-output-polydata-of-a-vtkcutter-has-pieces-instead-of-points-tp5488457p5488457.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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120216/66d54752/attachment.htm>


More information about the vtkusers mailing list