[vtkusers] Filling contour with edge visibility on

Bill Lorensen bill.lorensen at gmail.com
Sat Jun 5 12:03:50 EDT 2010


Can you post an image of what you get?

On Sat, Jun 5, 2010 at 11:34 AM, Jothy <jothybasu at gmail.com> wrote:
> Here is it!
>
> # A simple script to demonstrate the vtkCutter function
> import vtk
>
>
> #Create a cube
> cube=vtk.vtkSphereSource()
> cube.SetRadius(50)
> cube.SetThetaResolution(200)
> cube.SetPhiResolution(200)
> cubeMapper=vtk.vtkPolyDataMapper()
> cubeMapper.SetInputConnection(cube.GetOutputPort())
>
> #create a plane to cut,here it cuts in the XZ direction (xz
> normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)
> plane=vtk.vtkPlane()
> plane.SetOrigin(10,0,0)
> plane.SetNormal(1,0,0)
>
> #create cutter
> cutter=vtk.vtkCutter()
> cutter.SetCutFunction(plane)
> cutter.SetInput(cubeMapper.GetInput())
> cutter.Update()
>
> FeatureEdges=vtk.vtkFeatureEdges()
> FeatureEdges.SetInputConnection(cutter.GetOutputPort())
> FeatureEdges.BoundaryEdgesOn()
> FeatureEdges.FeatureEdgesOff()
> FeatureEdges.NonManifoldEdgesOff()
> FeatureEdges.ManifoldEdgesOff()
> FeatureEdges.Update()
>
>
>
>
> cutMapper=vtk.vtkPolyDataMapper()
> cutMapper.SetInput(FeatureEdges.GetOutput())
> cutActor=vtk.vtkActor()
> cutActor.GetProperty().SetColor(1,1,0)
> cutActor.GetProperty().SetEdgeColor(1,0.5,0)
> cutActor.GetProperty().SetLineWidth(2)
> cutActor.GetProperty().EdgeVisibilityOn()
> cutActor.GetProperty().SetOpacity(0.7)
> cutActor.SetMapper(cutMapper)
>
>
> #create renderers and add actors of plane and cube
> ren = vtk.vtkRenderer()
> ren.AddActor(cutActor)
>
>
> #Add renderer to renderwindow and render
> renWin = vtk.vtkRenderWindow()
> renWin.AddRenderer(ren)
> renWin.SetSize(600, 600)
> iren = vtk.vtkRenderWindowInteractor()
> iren.SetRenderWindow(renWin)
> ren.SetBackground(0,0,0)
> renWin.Render()
>
> On Fri, Jun 4, 2010 at 10:07 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> From the output of vtkCutter, insert vtkFeatureEdges with
>> BoundaryEdgesOn()
>> FeatureEdgesOff()
>> NonManifoldEdgesOff()
>> ManifoldEdgesOff()
>>
>>
>>
>> On Fri, Jun 4, 2010 at 4:16 PM, Jothy <jothybasu at gmail.com> wrote:
>> > Hi all,
>> >
>> > With the help of CapCow.tcl example I am able to fill the contour I got
>> > from
>> > vtkCutter. But, the problem is I am the edge to be visible, so I set
>> > edge
>> > visibility on, it makes all the triangle edges on. I want only the
>> > outline
>> > on.
>> >
>> > Any suggestions?
>> >
>> > Thanks,
>> >
>> > Jothy
>> >
>> > _______________________________________________
>> > 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
>> >
>> >
>
>



More information about the vtkusers mailing list