[vtkusers] Filling contour with edge visibility on
Jothy
jothybasu at gmail.com
Sat Jun 5 14:39:38 EDT 2010
Both, I will study.
Thanks,
Jothy
On Sat, Jun 5, 2010 at 7:38 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
> What do you want? A filled contour? Or a boundary of the contour? Or both?
>
> All are possible with the pipelines you have.
>
> Please study and experiment on your own for a while.
>
> On Sat, Jun 5, 2010 at 2:28 PM, Jothy <jothybasu at gmail.com> wrote:
> > But I should see it as a filled contour.
> >
> > On Sat, Jun 5, 2010 at 6:48 PM, Bill Lorensen <bill.lorensen at gmail.com>
> > wrote:
> >>
> >> That is exactly what it should show. I guess I am misunderstanding your
> >> problem
> >>
> >> On Sat, Jun 5, 2010 at 1:40 PM, Jothy <jothybasu at gmail.com> wrote:
> >> > Sorry,
> >> >
> >> > I meant , I don't understand the featureEdges behaviour.
> >> >
> >> > On Sat, Jun 5, 2010 at 6:39 PM, Jothy <jothybasu at gmail.com> wrote:
> >> >>
> >> >> No Bill, this shows only the edge (outline) in surface and wireframe
> >> >> mode
> >> >>
> >> >> I really understand the behaviour of fretureEdges.
> >> >>
> >> >> see the attached screenshot.
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Jothy
> >> >>
> >> >>
> >> >>
> >> >> On Sat, Jun 5, 2010 at 6:25 PM, Bill Lorensen <
> bill.lorensen at gmail.com>
> >> >> wrote:
> >> >>>
> >> >>> If this does not work, I'll convert python to C++ (I am not a python
> >> >>> guy). Maybe in the next day or so.
> >> >>>
> >> >>> On Sat, Jun 5, 2010 at 1:24 PM, Bill Lorensen
> >> >>> <bill.lorensen at gmail.com>
> >> >>> wrote:
> >> >>> > Try
> >> >>> > cutter->Stripper->cutPoly->TriangleFilter->FeatureEdges->Mapper
> >> >>> >
> >> >>> > On Sat, Jun 5, 2010 at 1:13 PM, Jothy <jothybasu at gmail.com>
> wrote:
> >> >>> >> Here is the code
> >> >>> >>
> >> >>> >> # A simple script to demonstrate the vtkCutter function
> >> >>> >> import vtk
> >> >>> >>
> >> >>> >>
> >> >>> >> #Create a cube
> >> >>> >> cube=vtk.vtkSphereSource()
> >> >>> >> cube.SetRadius(50)
> >> >>> >> cube.SetThetaResolution(100)
> >> >>> >> cube.SetPhiResolution(100)
> >> >>> >> 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(20,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()
> >> >>> >>
> >> >>> >> cutStrips=vtk.vtkStripper() ; #Forms loops (closed polylines)
> from
> >> >>> >> cutter
> >> >>> >> cutStrips.SetInputConnection(cutter.GetOutputPort())
> >> >>> >> cutStrips.Update()
> >> >>> >> cutPoly=vtk.vtkPolyData() ; #This trick defines polygons as
> >> >>> >> polyline
> >> >>> >> loop
> >> >>> >> cutPoly.SetPoints((cutStrips.GetOutput()).GetPoints())
> >> >>> >> cutPoly.SetPolys((cutStrips.GetOutput()).GetLines())
> >> >>> >>
> >> >>> >>
> >> >>> >> cutMapper=vtk.vtkPolyDataMapper()
> >> >>> >> #cutMapper.SetInput(FeatureEdges.GetOutput())
> >> >>> >> cutMapper.SetInput(cutPoly)
> >> >>> >> cutActor=vtk.vtkActor()
> >> >>> >> cutActor.GetProperty().SetColor(1,1,0)
> >> >>> >> cutActor.GetProperty().SetEdgeColor(0,1,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()
> >> >>> >>
> >> >>> >> What's the problem then?
> >> >>> >>
> >> >>> >> Thank you,
> >> >>> >>
> >> >>> >> Jothy
> >> >>> >>
> >> >>> >> On Sat, Jun 5, 2010 at 6:10 PM, Bill Lorensen
> >> >>> >> <bill.lorensen at gmail.com>
> >> >>> >> wrote:
> >> >>> >>>
> >> >>> >>> No, it should not modify its input.
> >> >>> >>>
> >> >>> >>> On Sat, Jun 5, 2010 at 12:34 PM, Jothy <jothybasu at gmail.com>
> >> >>> >>> wrote:
> >> >>> >>> > Got it Bill!
> >> >>> >>> >
> >> >>> >>> > There is a trick
> >> >>> >>> >
> >> >>> >>> > pipeline is as I uesd before from capCow.tcl but introducin
> >> >>> >>> > vtkfeatureEdges
> >> >>> >>> > after vtkCutter and setting the stripper input from cutter not
> >> >>> >>> > from
> >> >>> >>> > featureEdges.
> >> >>> >>> >
> >> >>> >>> > I am bit confused, does this featureedges modifies the cutter
> >> >>> >>> > output
> >> >>> >>> > and makes this modified outpur available to
> cutter->GetOutput()
> >> >>> >>> >
> >> >>> >>> > Seems to be special type of operation ( or is it a bug!).
> >> >>> >>> >
> >> >>> >>> > Here is the screenshot
> >> >>> >>> >
> >> >>> >>> > I will add an example to wiki.
> >> >>> >>> >
> >> >>> >>> >
> >> >>> >>> > Thanks,
> >> >>> >>> >
> >> >>> >>> >
> >> >>> >>> > On Sat, Jun 5, 2010 at 5:03 PM, Bill Lorensen
> >> >>> >>> > <bill.lorensen at gmail.com>
> >> >>> >>> > wrote:
> >> >>> >>> >>
> >> >>> >>> >> 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
> >> >>> >>> >> >> >
> >> >>> >>> >> >> >
> >> >>> >>> >> >
> >> >>> >>> >> >
> >> >>> >>> >
> >> >>> >>> >
> >> >>> >>
> >> >>> >>
> >> >>> >
> >> >>
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100605/a0dc9a05/attachment.htm>
More information about the vtkusers
mailing list