<div dir="ltr"><div> static vtkBoxWidget boxWidget;</div><div><br></div><div>        static vtkPlanes planes;</div><div><br></div><div>       static  vtkLODActor selectActor;</div><div><br></div><div>        static void Main(string[] args)</div>
<div>        {</div><div>            //Create a mace out of filters.</div><div><br></div><div>            vtkSphereSource sphere = new vtkSphereSource();</div><div>            vtkConeSource cone = new vtkConeSource();</div>
<div>            vtkGlyph3D glyph = new vtkGlyph3D();</div><div>            glyph.SetInputConnection(sphere.GetOutputPort());</div><div>            glyph.SetSource(cone.GetOutput());</div><div>            glyph.SetVectorModeToUseNormal();</div>
<div>            glyph.SetScaleModeToScaleByVector();</div><div>            glyph.SetScaleFactor(0.25);</div><div><br></div><div>            //The sphere and spikes are appended into a single polydata. This just makes things</div>
<div>            //simpler to manage.</div><div>            vtkAppendPolyData apd = new vtkAppendPolyData();</div><div>            apd.AddInput(glyph.GetOutput());</div><div>            apd.AddInput(sphere.GetOutput());</div>
<div>            vtkPolyDataMapper maceMapper = new vtkPolyDataMapper();</div><div>            maceMapper.SetInputConnection(apd.GetOutputPort());</div><div>            vtkLODActor maceActor = new vtkLODActor();</div><div>
            maceActor.SetMapper(maceMapper);</div><div>            maceActor.VisibilityOn();</div><div><br></div><div><br></div><div>            //This portion of the code clips the mace with the vtkPlanes implicit function.</div>
<div>            //The clipped region is colored green.</div><div>             planes = new vtkPlanes();</div><div>            vtkClipPolyData clipper = new vtkClipPolyData();</div><div>            clipper.SetInputConnection(apd.GetOutputPort());</div>
<div>            clipper.SetClipFunction(planes);</div><div>            clipper.InsideOutOn();</div><div>            vtkPolyDataMapper selectMapper = new vtkPolyDataMapper();</div><div>            selectMapper.SetInputConnection(clipper.GetOutputPort());</div>
<div>             selectActor = new vtkLODActor();</div><div>            selectActor.SetMapper(selectMapper);</div><div>            selectActor.GetProperty().SetColor(0, 1, 0);</div><div>            selectActor.VisibilityOff();</div>
<div>            selectActor.SetScale(1.01, 1.01, 1.01);</div><div><br></div><div>            //Create the RenderWindow, Renderer and both Actors</div><div><br></div><div>            vtkRenderer ren1 = new vtkRenderer();</div>
<div>            vtkRenderWindow renWin = new vtkRenderWindow();</div><div>            renWin.AddRenderer(ren1);</div><div><br></div><div>            vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();</div>
<div>            iren.SetRenderWindow(renWin);</div><div><br></div><div>            //The SetInteractor method is how 3D widgets are associated with the render</div><div>            //window interactor. Internally, SetInteractor sets up a bunch of callbacks</div>
<div>            //using the Command/Observer mechanism (AddObserver()).</div><div>            boxWidget = new vtkBoxWidget();</div><div>            boxWidget.SetInteractor(iren);</div><div>            boxWidget.SetPlaceFactor(1.25);</div>
<div><br></div><div>            ren1.AddActor(maceActor);</div><div>            ren1.AddActor(selectActor);</div><div><br></div><div>            //Add the actors to the renderer, set the background and size</div><div><br>
</div><div>            ren1.SetBackground(0.1, 0.2, 0.4);</div><div>            renWin.SetSize(300, 300);</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>            //Place the interactor initially. The input to a 3D widget is used to </div>
<div>            //initially position and scale the widget. The EndInteractionEvent is</div><div>            //observed which invokes the SelectPolygons callback.</div><div>            boxWidget.SetInput(glyph.GetOutput());</div>
<div>            boxWidget.PlaceWidget();</div><div>            iren.AddObserver((uint)vtk.EventIds.EndInteractionEvent, new vtk.vtkDotNetCallback(SelectPolygons));</div><div>            iren.Initialize();</div><div><br></div>
<div>            </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>        }</div><div>        public static void SelectPolygons(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)</div>
<div>        {</div><div>               boxWidget.GetPlanes( planes);</div><div>               selectActor.VisibilityOn();</div><div>        }</div><br><div class="gmail_quote">On Sat, Jun 26, 2010 at 5:57 PM, Ali Habib <span dir="ltr">&lt;<a href="mailto:ali.mahmoud.habib@gmail.com">ali.mahmoud.habib@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">this is the complete code <div><br></div><div><div><div></div><div class="h5"><div>        static vtkBoxWidget boxWidget;</div>
<div><br></div><div>        static vtkPlanes planes;</div><div><br></div><div>       static  vtkLODActor selectActor;</div>
<div><br></div><div>        static void Main(string[] args)</div><div>        {</div><div>            //Create a mace out of filters.</div><div><br></div><div>            vtkSphereSource sphere = new vtkSphereSource();</div>

<div>            vtkConeSource cone = new vtkConeSource();</div><div>            vtkGlyph3D glyph = new vtkGlyph3D();</div><div>            glyph.SetInputConnection(sphere.GetOutputPort());</div><div>            glyph.SetSource(cone.GetOutput());</div>

<div>            glyph.SetVectorModeToUseNormal();</div><div>            glyph.SetScaleModeToScaleByVector();</div><div>            glyph.SetScaleFactor(0.25);</div><div><br></div><div>            //The sphere and spikes are appended into a single polydata. This just makes things</div>

<div>            //simpler to manage.</div><div>            vtkAppendPolyData apd = new vtkAppendPolyData();</div><div>            apd.AddInput(glyph.GetOutput());</div><div>            apd.AddInput(sphere.GetOutput());</div>

<div>            vtkPolyDataMapper maceMapper = new vtkPolyDataMapper();</div><div>            maceMapper.SetInputConnection(apd.GetOutputPort());</div><div>            vtkLODActor maceActor = new vtkLODActor();</div><div>

            maceActor.SetMapper(maceMapper);</div><div>            maceActor.VisibilityOn();</div><div><br></div><div><br></div><div>            //This portion of the code clips the mace with the vtkPlanes implicit function.</div>

<div>            //The clipped region is colored green.</div></div></div><div>             planes = new vtkPlanes();</div><div>            vtkClipPolyData clipper = new vtkClipPolyData();</div><div>            clipper.SetInputConnection(apd.GetOutputPort());</div>

<div>            clipper.SetClipFunction(planes);</div><div>            clipper.InsideOutOn();</div><div>            vtkPolyDataMapper selectMapper = new vtkPolyDataMapper();</div><div>            selectMapper.SetInputConnection(clipper.GetOutputPort());</div>

<div>             selectActor = new vtkLODActor();</div><div>            selectActor.SetMapper(selectMapper);</div><div>            selectActor.GetProperty().SetColor(0, 1, 0);</div><div>            selectActor.VisibilityOff();</div>

<div>            selectActor.SetScale(1.01, 1.01, 1.01);</div><div><div></div><div class="h5"><div><br></div><div>            //Create the RenderWindow, Renderer and both Actors</div><div><br></div><div>            vtkRenderer ren1 = new vtkRenderer();</div>

<div>            vtkRenderWindow renWin = new vtkRenderWindow();</div><div>            renWin.AddRenderer(ren1);</div><div><br></div><div>            vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();</div>

<div>            iren.SetRenderWindow(renWin);</div><div><br></div><div>            //The SetInteractor method is how 3D widgets are associated with the render</div><div>            //window interactor. Internally, SetInteractor sets up a bunch of callbacks</div>

<div>            //using the Command/Observer mechanism (AddObserver()).</div><div>            boxWidget = new vtkBoxWidget();</div><div>            boxWidget.SetInteractor(iren);</div><div>            boxWidget.SetPlaceFactor(1.25);</div>

<div><br></div><div>            ren1.AddActor(maceActor);</div><div>            ren1.AddActor(selectActor);</div><div><br></div><div>            //Add the actors to the renderer, set the background and size</div><div><br>

</div><div>            ren1.SetBackground(0.1, 0.2, 0.4);</div><div>            renWin.SetSize(300, 300);</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>            //Place the interactor initially. The input to a 3D widget is used to </div>

<div>            //initially position and scale the widget. The EndInteractionEvent is</div><div>            //observed which invokes the SelectPolygons callback.</div><div>            boxWidget.SetInput(glyph.GetOutput());</div>

<div>            boxWidget.PlaceWidget();</div><div>            iren.AddObserver((uint)vtk.EventIds.EndInteractionEvent, new vtk.vtkDotNetCallback(SelectPolygons));</div><div>            iren.Initialize();</div><div><br>
</div>
<div>            </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>        }</div><div>        public static void SelectPolygons(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)</div>

<div>        {</div><div>               boxWidget.GetPlanes( planes);</div><div>               selectActor.VisibilityOn();</div><div>        }</div><div><br></div></div></div><div>Best regards </div><div><div></div><div class="h5">
<br><div class="gmail_quote">On Sat, Jun 26, 2010 at 1:21 PM, Ali Habib <span dir="ltr">&lt;<a href="mailto:ali.mahmoud.habib@gmail.com" target="_blank">ali.mahmoud.habib@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I wante to cut part using vtk box widget , but the pipeline always fail any suggestion please<div><br></div>

<div>the code is </div><div><br></div><div><div>        static vtkBoxWidget boxWidget;</div><div><br>
</div><div>        static vtkPlanes planes;</div><div><br></div><div>       static  vtkLODActor selectActor;</div><div><br></div><div>        static void Main(string[] args)</div><div>        {</div><div>            //Create a mace out of filters.</div>


<div><br></div><div>            vtkSphereSource sphere = new vtkSphereSource();</div><div>            vtkConeSource cone = new vtkConeSource();</div><div>            vtkGlyph3D glyph = new vtkGlyph3D();</div><div>            glyph.SetInputConnection(sphere.GetOutputPort());</div>


<div>            glyph.SetSource(cone.GetOutput());</div><div>            glyph.SetVectorModeToUseNormal();</div><div>            glyph.SetScaleModeToScaleByVector();</div><div>            glyph.SetScaleFactor(0.25);</div>


<div><br></div><div>            //The sphere and spikes are appended into a single polydata. This just makes things</div><div>            //simpler to manage.</div><div>            vtkAppendPolyData apd = new vtkAppendPolyData();</div>


<div>            apd.AddInput(glyph.GetOutput());</div><div>            apd.AddInput(sphere.GetOutput());</div><div>            vtkPolyDataMapper maceMapper = new vtkPolyDataMapper();</div><div>            maceMapper.SetInputConnection(apd.GetOutputPort());</div>


<div>            vtkLODActor maceActor = new vtkLODActor();</div><div>            maceActor.SetMapper(maceMapper);</div><div>            maceActor.VisibilityOn();</div><div><br></div><div><br></div><div>            //This portion of the code clips the mace with the vtkPlanes implicit function.</div>


<div>            //The clipped region is colored green.</div><div><br></div><div><br></div><div>            //Create the RenderWindow, Renderer and both Actors</div><div><br></div><div>            vtkRenderer ren1 = new vtkRenderer();</div>


<div>            vtkRenderWindow renWin = new vtkRenderWindow();</div><div>            renWin.AddRenderer(ren1);</div><div><br></div><div>            vtkRenderWindowInteractor iren = new vtkRenderWindowInteractor();</div>


<div>            iren.SetRenderWindow(renWin);</div><div><br></div><div>            //The SetInteractor method is how 3D widgets are associated with the render</div><div>            //window interactor. Internally, SetInteractor sets up a bunch of callbacks</div>


<div>            //using the Command/Observer mechanism (AddObserver()).</div><div>            boxWidget = new vtkBoxWidget();</div><div>            boxWidget.SetInteractor(iren);</div><div>            boxWidget.SetPlaceFactor(1.25);</div>


<div><br></div><div>            ren1.AddActor(maceActor);</div><div>            ren1.AddActor(selectActor);</div><div><br></div><div>            //Add the actors to the renderer, set the background and size</div><div><br>


</div><div>            ren1.SetBackground(0.1, 0.2, 0.4);</div><div>            renWin.SetSize(300, 300);</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>            //Place the interactor initially. The input to a 3D widget is used to </div>


<div>            //initially position and scale the widget. The EndInteractionEvent is</div><div>            //observed which invokes the SelectPolygons callback.</div><div>            boxWidget.SetInput(glyph.GetOutput());</div>


<div>            boxWidget.PlaceWidget();</div><div>            iren.AddObserver((uint)vtk.EventIds.EndInteractionEvent, new vtk.vtkDotNetCallback(SelectPolygons));</div><div>            iren.Initialize();</div><div><br>

</div>
<div>            </div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>        }</div><div>        public static void SelectPolygons(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)</div>


<div>        {</div><div>               boxWidget.GetPlanes( planes);</div><div>               selectActor.VisibilityOn();</div><div>        }</div></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>