<div dir="ltr"><div>Hi everyone</div>
<div> </div>
<div>I used ur advice to pick a cell but my code just got one cell and not other </div>
<div> </div>
<div>the commin is using c# but it&#39;s near to c++ if u can help me in it , and how to select region using that </div>
<div> </div>
<div>  private void button1_Click(object sender, EventArgs e)<br>        {</div>
<div>            vtkSphereSource sphere = new vtkSphereSource();</div>
<div>            vtkPolyDataMapper sphereMapper = new vtkPolyDataMapper();<br>            sphereMapper.SetInput(sphere.GetOutput());<br>            //sphereMapper.GlobalImmediateModeRenderingOn();<br>            vtkLODActor sphereActor = new vtkLODActor();<br>
            sphereActor.SetMapper(sphereMapper);</div>
<div>            // create the spikes by glyphing the sphere with a cone.  Create the mapper<br>            // and actor for the glyphs.<br>            vtkConeSource cone = new vtkConeSource();<br>            vtkGlyph3D glyph = new vtkGlyph3D();<br>
            glyph.SetInput(sphere.GetOutput());<br>            glyph.SetSource(cone.GetOutput());<br>            glyph.SetVectorModeToUseNormal();<br>            glyph.SetScaleModeToScaleByVector();<br>            glyph.SetScaleFactor(0.25);<br>
            vtkPolyDataMapper spikeMapper = new vtkPolyDataMapper();<br>            spikeMapper.SetInput(glyph.GetOutput());<br>            vtkLODActor spikeActor = new vtkLODActor();<br>            spikeActor.SetMapper(spikeMapper);<br>
            // Create a text mapper and actor to display the results of picking.<br>            textMapper = new vtkTextMapper();<br>            vtkTextProperty tprop = textMapper.GetTextProperty();<br>            tprop.SetFontFamilyToArial();<br>
            tprop.SetFontSize(12);<br>            tprop.BoldOn();<br>            //    tprop-&gt;ShadowOn();<br>            tprop.SetColor(1, 0, 0);<br>            textActor = new vtkActor2D();<br>            textActor.VisibilityOff();<br>
            textActor.SetMapper(textMapper);<br>            // Create a cell picker.<br>            picker = new vtkCellPicker();<br>            ren1 = new vtkRenderer();<br>            renWin = new vtkRenderWindow();<br>
            renWin.AddRenderer(ren1);<br>            iren = new vtkRenderWindowInteractor();<br>            iren.AddObserver((uint)vtk.EventIds.LeftButtonPressEvent, new vtk.vtkDotNetCallback(MouseRelease));<br>            iren.SetRenderWindow(renWin);<br>
            //iren.SetInteractorStyle(style);<br>            iren.SetPicker(picker);<br>            picker.AddObserver((uint)vtk.EventIds.LeftButtonPressEvent, new vtk.vtkDotNetCallback(MouseRelease));<br>            // Add the actors to the renderer, set the background and size</div>

<div>            ren1.AddActor2D(textActor);<br>            ren1.AddActor(sphereActor);<br>            ren1.AddActor(spikeActor);<br>            ren1.SetBackground(1, 1, 1);<br>            renWin.SetSize(300, 300);<br>            vtkCamera cam1 = ren1.GetActiveCamera();<br>
            cam1.Zoom(1.4);<br>            picker.Pick(85, 126, 0, ren1); ;<br>            iren.Initialize();<br>            iren.Start();</div>
<div> </div>
<div>        }<br>        public  void MouseRelease(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)<br>        {<br>            if (picker.GetCellId() &lt; 0)<br>            {</div>
<div>                textActor.VisibilityOff();<br>            }<br>            else<br>            {<br>                //double[] selpt = new double[3];<br>               <br>                double[] selpt = picker.GetSelectionPoint();<br>
                double x = selpt[0];<br>                double y = selpt[1];<br>                // double[] pickPos = new double[3];<br>                double[] pickPos = picker.GetPickPosition();<br>                double xp = pickPos[0];<br>
                double yp = pickPos[1];<br>                double zp = pickPos[2];</div>
<div>                string text = new string(new char[120]);<br>                text = string.Format(&quot;({0,5:f5},  {1,5:f5},  {2,5:f5})&quot;, xp, yp, zp);<br>                textMapper.SetInput(text);<br>                textActor.SetPosition(x, y);<br>
                textActor.VisibilityOn();<br>                <br>            }</div>
<div>          // renWin.Render();</div>
<div> </div>
<div>        }<br></div></div>