Additional objects like axes, legends etc..


vedo.addons.Goniometer(p1, p2, p3, font='', arcSize=0.4, fill=0.1, s=1, italic=0, rotation=0, prefix='', c=0.2, 0, 0, alpha=1, lw=1, precision=3)[source]

Build a graphical goniometer to measure the angle formed by 3 points in space.

  • p1 (list) – first point.

  • p2 (list) – the vertex point.

  • p3 (list) – the last point defining the angle.

  • font (str, optional) – Font name to be used. The default is “”.

  • arcSize (float, optional) – dimension of the arc wrt the smallest axis. The default is 0.4.

  • fill (bool, optional) – fill the arc area. The default is 0.1.

  • s (float, optional) – size of the text. The default is 1.

  • italic (float, bool, optional) – italic text. The default is 0.

  • rotation (float, optional) – rotation of text in degrees. The default is 0.

  • prefix (str, optional) – append this string to the numeric value of the angle. The default is “”.

  • c (list, optional) – color of the goniometer. The default is (0.2, 0, 0).

  • alpha (float, optional) – transparency level. The default is 1.

  • lw (float, optional) – line width. The default is 1.

  • precision (int, optional) – number of significant digits. The default is 3.


vedo.addons.Ruler(p1, p2, label='', s=None, font='', italic=0, prefix='', units='', c=0.2, 0.1, 0.1, alpha=1, lw=1, precision=3, labelRotation=0, axisRotation=0, tickAngle=90)[source]

Build a 3D ruler to indicate the distance of two points p1 and p2.

  • label (str) – alternative fixed label to be shown

  • s (float) – size of the label

  • font (str) – font name

  • italic (float) – italicness of the font [0,1]

  • units (str) – string to be appended to the numeric value

  • lw (float) – line width in pixel units

  • precision (int) – nr of significant digits to be shown

  • labelRotation (float) – initial rotation of the label around the z-axis

  • axisRotation (float) – initial rotation of the line around the main axis

  • tickAngle (float) – initial rotation of the line around the main axis


vedo.addons.addButton(fnc, states='On', 'Off', c='w', 'w', bc='dg', 'dr', pos=20, 40, size=24, font='arial', bold=False, italic=False, alpha=1, angle=0)[source]

Add a button to the renderer window.

  • states (list) – a list of possible states [‘On’, ‘Off’]

  • c – a list of colors for each state

  • bc – a list of background colors for each state

  • pos – 2D position in pixels from left-bottom corner

  • size – size of button font

  • font (str) – font type (arial, courier, times)

  • bold (bool) – bold face (False)

  • italic (bool) – italic face (False)

  • alpha (float) – opacity level

  • angle (float) – anticlockwise rotation in degrees



Create handles to cut away parts of a mesh.


vedo.addons.addIcon(mesh, pos=3, size=0.08)[source]

Add an inset icon mesh into the renderer.

  • pos – icon position in the range [1-4] indicating one of the 4 corners, or it can be a tuple (x,y) as a fraction of the renderer size.

  • size (float) – size of the icon space.





vedo.addons.addLight(pos, focalPoint=0, 0, 0, deg=180, c='white', intensity=0.4, removeOthers=False, showsource=False)[source]

Generate a source of light placed at pos, directed to focal point. Returns a vtkLight object.

  • focalPoint – focal point, if this is a vtkActor use its position.

  • deg – aperture angle of the light source

  • c – set light color

  • intensity (float) – intensity between 0 and 1.

  • removeOthers (bool) – remove all other lights in the scene

  • showsource (bool) – if True, will show a representation of the source of light as an extra Mesh



vedo.addons.addScalarBar(obj, pos=0.8, 0.05, title='', titleXOffset=0, titleYOffset=15, titleFontSize=12, nlabels=None, c=None, horizontal=False, useAlpha=True)[source]

Add a 2D scalar bar for the specified obj.


vedo.addons.addScalarBar3D(obj, pos=None, sx=None, sy=None, title='', titleFont='', titleXOffset=- 1.5, titleYOffset=0.0, titleSize=1.5, titleRotation=0.0, nlabels=9, labelFont='', labelOffset=0.375, italic=0, c=None, useAlpha=True, drawBox=True)[source]

Draw a 3D scalar bar.

obj input can be:
  • a list of numbers,

  • a list of two numbers in the form (min, max),

  • a Mesh already containing a set of scalars associated to vertices or cells,

  • if None the last object in the list of actors will be used.

  • sx (float) – thickness of scalarbar

  • sy (float) – length of scalarbar

  • title (str) – scalar bar title

  • titleXOffset (float) – horizontal space btw title and color scalarbar

  • titleYOffset (float) – vertical space offset

  • titleSize (float) – size of title wrt numeric labels

  • titleRotation (float) – title rotation in degrees

  • nlabels (int) – number of numeric labels

  • labelOffset (float) – space btw numeric labels and scale

  • useAlpha (bool) – render transparency of the color bar, otherwise ignore

  • drawBox (bool) – draw a box around the colorbar (useful with useAlpha=True)


vedo.addons.addSlider2D(sliderfunc, xmin, xmax, value=None, pos=4, title='', font='arial', titleSize=1, c=None, showValue=True)[source]

Add a slider widget which can call an external custom function.

  • sliderfunc – external function to be called by the widget

  • xmin (float) – lower value

  • xmax (float) – upper value

  • value (float) – current value

  • pos (list) – position corner number: horizontal [1-5] or vertical [11-15] it can also be specified by corners coordinates [(x1,y1), (x2,y2)]

  • title (str) – title text

  • font (str) – title font [arial, courier]

  • titleSize (float) – title text scale [1.0]

  • showValue (bool) – if true current value is shown


vedo.addons.addSlider3D(sliderfunc, pos1, pos2, xmin, xmax, value=None, s=0.03, t=1, title='', rotation=0, c=None, showValue=True)[source]

Add a 3D slider widget which can call an external custom function.

  • sliderfunc – external function to be called by the widget

  • pos1 (list) – first position coordinates

  • pos2 (list) – second position coordinates

  • xmin (float) – lower value

  • xmax (float) – upper value

  • value (float) – initial value

  • s (float) – label scaling factor

  • t (float) – tube scaling factor

  • title (str) – title text

  • c – slider color

  • rotation (float) – title rotation around slider axis

  • showValue (bool) – if True current value is shown


vedo.addons.buildAxes(obj=None, xtitle=None, ytitle=None, ztitle=None, xrange=None, yrange=None, zrange=None, c=None, numberOfDivisions=None, digits=None, limitRatio=0.04, axesLineWidth=1, gridLineWidth=1, reorientShortTitle=True, titleDepth=0, titleFont='', textScale=1.0, xTitlePosition=0.95, yTitlePosition=0.95, zTitlePosition=0.95, xTitleOffset=0.02, yTitleOffset=0.025, zTitleOffset=0.02, xTitleJustify='top-right', yTitleJustify='bottom-right', zTitleJustify='bottom-right', xTitleRotation=0, yTitleRotation=0, zTitleRotation=0, xTitleBox=False, yTitleBox=False, xTitleSize=0.025, yTitleSize=0.025, zTitleSize=0.025, xTitleColor=None, yTitleColor=None, zTitleColor=None, xTitleBackfaceColor=None, yTitleBackfaceColor=None, zTitleBackfaceColor=None, xTitleItalic=0, yTitleItalic=0, zTitleItalic=0, xyGrid=True, yzGrid=True, zxGrid=False, xyGrid2=False, yzGrid2=False, zxGrid2=False, xyGridTransparent=False, yzGridTransparent=False, zxGridTransparent=False, xyGrid2Transparent=False, yzGrid2Transparent=False, zxGrid2Transparent=False, xyPlaneColor=None, yzPlaneColor=None, zxPlaneColor=None, xyGridColor=None, yzGridColor=None, zxGridColor=None, xyAlpha=0.05, yzAlpha=0.05, zxAlpha=0.05, xyFrameLine=None, yzFrameLine=None, zxFrameLine=None, xLineColor=None, yLineColor=None, zLineColor=None, xHighlightZero=False, yHighlightZero=False, zHighlightZero=False, xHighlightZeroColor='r', yHighlightZeroColor='g', zHighlightZeroColor='b', showTicks=True, xTickLength=0.015, yTickLength=0.015, zTickLength=0.015, xTickThickness=0.0025, yTickThickness=0.0025, zTickThickness=0.0025, xMinorTicks=1, yMinorTicks=1, zMinorTicks=1, tipSize=None, labelFont='', xLabelColor=None, yLabelColor=None, zLabelColor=None, xLabelSize=0.016, yLabelSize=0.016, zLabelSize=0.016, xLabelOffset=0.015, yLabelOffset=0.015, zLabelOffset=0.01, xLabelRotation=0, yLabelRotation=None, zLabelRotation=None, xFlipText=False, yFlipText=False, zFlipText=False, xValuesAndLabels=None, yValuesAndLabels=None, zValuesAndLabels=None, useGlobal=False, tol=0.0001)[source]

Draw axes for the input object. Returns an Assembly object.

  • xtitle, [‘x’], x-axis title text

  • xrange, [None], x-axis range in format (xmin, ymin), default is automatic.

  • numberOfDivisions, [None], approximate number of divisions on the longest axis

  • axesLineWidth, [1], width of the axes lines

  • gridLineWidth, [1], width of the grid lines

  • reorientShortTitle, [True], titles shorter than 2 letter are placed horizontally

  • titleDepth, [0], extrusion fractional depth of title text

  • xyGrid, [True], show a gridded wall on plane xy

  • yzGrid, [True], show a gridded wall on plane yz

  • zxGrid, [True], show a gridded wall on plane zx

  • zxGrid2, [False], show zx plane on opposite side of the bounding box

  • xyGridTransparent [False], make grid plane completely transparent

  • xyGrid2Transparent [False], make grid plane completely transparent on opposite side box

  • xyPlaneColor, [‘gray’], color of the plane

  • xyGridColor, [‘gray’], grid line color

  • xyAlpha, [0.15], grid plane opacity

  • xyFrameLine, [None], add a frame for the plane

  • showTicks, [True], show major ticks

  • digits, [None], use this number of significant digits in scientific notation

  • titleFont, [‘’], font for axes titles

  • labelFont, [‘’], font for numeric labels

  • textScale, [1.0], global scaling factor for text elements (titles, labels)

  • xTitlePosition, [0.32], title fractional positions along axis

  • xTitleOffset, [0.05], title fractional offset distance from axis line

  • xTitleJustify, [“top-right”], title justification

  • xTitleRotation, [0], add a rotation of the axis title

  • xTitleBox, [False], add a box around title text

  • xLineColor, [automatic], color of the x-axis

  • xTitleColor, [automatic], color of the axis title

  • xTitleBackfaceColor, [None], color of axis title on its backface

  • xTitleSize, [0.025], size of the axis title

  • ‘xTitleItalic’, [0], a bool or float to make the font italic

  • xHighlightZero, [True], draw a line highlighting zero position if in range

  • xHighlightZeroColor, [autom], color of the line highlighting the zero position

  • xTickLength, [0.005], radius of the major ticks

  • xTickThickness, [0.0025], thickness of the major ticks along their axis

  • xMinorTicks, [1], number of minor ticks between two major ticks

  • xValuesAndLabels [], assign custom tick positions and labels [(pos1, label1), …]

  • xLabelColor, [automatic], color of numeric labels and ticks

  • xLabelPrecision, [2], nr. of significative digits to be shown

  • xLabelSize, [0.015], size of the numeric labels along axis

  • ‘xLabelRotation’, [0], rotate clockwise [1] or anticlockwise [-1] by 90 degrees

  • ‘xFlipText’, [False], flip axis title and numeric labels orientation

  • xLabelOffset, [0.025], offset of numeric labels

  • tipSize, [0.01], size of the arrow tip

  • limitRatio, [0.04], below this ratio don’t plot small axis

from vedo import Box, show
b = Box(pos=(1,2,3), length=8, width=9, height=7).alpha(0)
bax = buildAxes(b, c='k')  # returns Assembly object
show(b, bax)


vedo.addons.buildRulerAxes(inputobj, xtitle='', ytitle='', ztitle='', xlabel='', ylabel='', zlabel='', xpad=0.05, ypad=0.04, zpad=0, font='Normografo', s=None, italic=0, units='', c=0.2, 0, 0, alpha=1, lw=1, precision=3, labelRotation=0, axisRotation=0, xycross=True)[source]

Build 3D rulers to indicate the sizes of the input scene or object.

  • xtitle (str) – name of the axis or title

  • xlabel (str) – alternative fixed label to be shown instead of the distance

  • xpad (float) – gap distance from the x-axis

  • s (float) – size of the label

  • font (str) – font name

  • italic (float) – italicness of the font [0,1]

  • units (str) – string to be appended to the numeric value

  • lw (float) – line width in pixel units

  • precision (int) – nr of significant digits to be shown

  • labelRotation (float) – initial rotation of the label around the z-axis

  • axisRotation (float) – initial rotation of the line around the main axis

  • xycross (bool) – show two back crossing lines in the xy plane