# Arrow

VTKExamples/Python/GeometricObjects/Arrow

### Description¶

vtkArrowSource object appends a cylinder to a cone to form an arrow.

The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If "Invert" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

The resolution of the cone and shaft can be set and default to 6.

The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

Other Languages

See (Cxx), (Java), (CSharp)

### Code¶

Arrow.py

#!/usr/bin/env python

import vtk

# arrow.py adapted from the C++ vtk examples and translated to python.

def main():
colors = vtk.vtkNamedColors()

arrowSource = vtk.vtkArrowSource()
# arrowSource.SetTipLength(.9)

# Create a mapper and actor
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(arrowSource.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)

# Visualize
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.SetWindowName("Arrow")