<div dir="ltr">Dear All,<div><br></div><div>    I am trying to combine a vtkArrowSource and vtkGlyph3D. I have been (naively) thinking that by specifying a polydata with two points (start and end) and assigning its points to the vtkGlyph3D I would obtain an arrow that starts at the start point and end at the end point.</div><div><br></div><div>I have created a small, self-contained following Python script to demonstrate what I mean - I get 4 arrows, one at each point I define, instead of two arrows. What am I missing? Any suggestion is more than welcome.</div><div><br></div><div>Thank you in advance.</div><div><br></div><div>Andrea.</div><div><br></div><div><br></div><div><div><font face="monospace, monospace">import vtk</font></div><div><font face="monospace, monospace">import numpy</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># First set of points - first arrow</font></div><div><font face="monospace, monospace">points1 = numpy.array([[ 11271.915, 7538.686, 6245.661],</font></div><div><font face="monospace, monospace">                       [ 11271.915, 7538.686, 5897.034]])</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace"># Second set of points - second arrow</font></div></div><div><font face="monospace, monospace">points2 = numpy.array([[ 10532.274, 9101.572, 6313.167],</font></div><div><font face="monospace, monospace">                       [ 10532.274, 9101.572, 5964.539]])</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Create an arrow source with some attributes</font></div><div><font face="monospace, monospace">arrow_source = vtk.vtkArrowSource()</font></div><div><font face="monospace, monospace">arrow_source.SetTipRadius(0.2)</font></div><div><font face="monospace, monospace">arrow_source.SetShaftRadius(0.075)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Create the vtkGlyph3D</font></div><div><font face="monospace, monospace">arrow_glyph = vtk.vtkGlyph3D()</font></div><div><font face="monospace, monospace">arrow_glyph.SetScaleModeToDataScalingOff()</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># Usual mapper</font></div><div><font face="monospace, monospace">arrow_mapper = vtk.vtkPolyDataMapper()</font></div><div><font face="monospace, monospace">arrow_mapper.SetInputConnection(arrow_glyph.GetOutputPort())</font></div><div><br></div><div><span style="font-family:monospace,monospace"># Usual actor</span></div><div><span style="font-family:monospace,monospace">arrow_actor = vtk.vtkActor()</span><br></div><div><font face="monospace, monospace">arrow_actor.SetMapper(arrow_mapper)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">append_poly_data = vtk.vtkAppendPolyData()</font></div><div><br></div><div><font face="monospace, monospace"># Loop through points1 and points2</font></div><div><font face="monospace, monospace">for p in [points1, points2]:</font></div><div><br></div><div><font face="monospace, monospace">    arrow_poly_data = vtk.vtkPolyData()</font></div><div><font face="monospace, monospace">    vtk_arrow_lines = vtk.vtkCellArray()</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    vtk_arrow_lines.InsertNextCell(2)</font></div><div><font face="monospace, monospace">    vtk_arrow_lines.InsertCellPoint(0)</font></div><div><font face="monospace, monospace">    vtk_arrow_lines.InsertCellPoint(1)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    vtk_arrow_points = vtk.vtkPoints()</font></div><div><font face="monospace, monospace">    # Loop through the head and tail of a single arrow</font></div><div><font face="monospace, monospace">    for j in xrange(2):</font></div><div><font face="monospace, monospace">        vtk_arrow_points.InsertNextPoint(p[j])</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    arrow_poly_data.SetPoints(vtk_arrow_points)</font></div><div><font face="monospace, monospace">    arrow_poly_data.SetLines(vtk_arrow_lines)</font></div><div><font face="monospace, monospace">    append_poly_data.AddInputData(arrow_poly_data)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">arrow_glyph.SetInputConnection(append_poly_data.GetOutputPort())</font></div><div><font face="monospace, monospace">arrow_glyph.SetSourceConnection(arrow_source.GetOutputPort())</font></div><div><font face="monospace, monospace">arrow_glyph.SetScaleFactor(100)</font></div><div><font face="monospace, monospace">arrow_actor.GetProperty().SetColor(1, 1, 1)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># ------------------------------------------------------------</font></div><div><font face="monospace, monospace"># Create the RenderWindow, Renderer and both Actors</font></div><div><font face="monospace, monospace"># ------------------------------------------------------------</font></div><div><font face="monospace, monospace">ren = vtk.vtkRenderer()</font></div><div><font face="monospace, monospace">renWin = vtk.vtkRenderWindow()</font></div><div><font face="monospace, monospace">renWin.AddRenderer(ren)</font></div><div><font face="monospace, monospace">iren = vtk.vtkRenderWindowInteractor()</font></div><div><font face="monospace, monospace">iren.SetRenderWindow(renWin)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"># add actors</font></div><div><font face="monospace, monospace">ren.AddActor(arrow_actor)</font></div><div><font face="monospace, monospace">ren.ResetCamera()</font></div><div><font face="monospace, monospace">iren.Start()</font></div><div><font face="monospace, monospace"><br></font></div><font face="monospace, monospace"><br></font></div></div>