Visualisation

Visualisation

class PyMbs.Input.MbsSystem.AddVisualisation(world)

Class that provides functions to create visual shapes

Arrow(cs, size=1, name=None)

Add a arrow graphical representation to a coordinate system given by cs.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • radius (int/float.) – Radius of the circular groundplane.
  • length – Length of the Arrow.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
Box(cs, length=1, width=1, height=1, name=None, color=None)

Add a line object which whose dimensions are called: * x - length * y - width * z - height The origin of this graphical representation lies in the centre of the objet.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • length (int/float.) – Length (x-dimension) of the box.
  • width (int/float.) – Width (y-dimension) of the box.
  • height (int/float.) – Height (z-dimension) of the box.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
  • color (List, Tuple, VTK Color) – Apply a specific color to a visualisation. You can use either an RGB list, e.g. color=[0.7, 0.3, 0.1], or any VTK color (from vtk.util.colors).
Cylinder(cs, radius=1, height=1, res=20, name=None, color=None)

Add a cylindrical graphical representation to a coordinate system given by cs. Its groundplane forms a circle with the radius given by radius and lies in the x-y-plane. The origin lies directly in the centre, at half of the height.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • radius (int/float.) – Radius of the circular groundplane.
  • height (int/float.) – Height of the cylinder.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
  • color (List, Tuple, VTK Color) – Apply a specific color to a visualisation. You can use either an RGB list, e.g. color=[0.7, 0.3, 0.1], or any VTK color (from vtk.util.colors).
File(cs, fileName, scale=1, name=None, color=None)

Attach a File-Object given by fileName to the Coordinate System given by cs. Since the python visualisation is based on VTK, all file formats that are compatible to VTK are supported. MATLAB Animations, however, only support STL-Files.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • fileName (String.) – Filename of the graphics file.
  • scale (int/float.) – Can be used to scale down the Graphic. Use 1000 if the graphic information is stored in millimeters, for example.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
  • color (List, Tuple, VTK Color) – Apply a specific color to a visualisation. You can use either an RGB list, e.g. color=[0.7, 0.3, 0.1], or any VTK color (from vtk.util.colors).
Frame(cs, size=1, name=None)

Attaches a graphical representation of a coordinate system. It consists of three lines, each pointing in the direction of an axis. Use size to vary the length of the lines.

The axes can be distinguished by their color:
x-axis: red y-axis: yellow z-axis: green
Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • size (int/float.) – length of an axis of this coordinate system.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
Line(cs, length=1, name=None, color=None)

Add a line object which starts at [0,0,0] and ends at [length,0,0], i.e. spans in x-direction.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • length (int/float.) – Length of the line.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
  • color (List, Tuple, VTK Color) – Apply a specific color to a visualisation. You can use either an RGB list, e.g. color=[0.7, 0.3, 0.1], or any VTK color (from vtk.util.colors).
Sphere(cs, radius=1, res=50, name=None, color=None)

Attaches a sphere with the radius radius to a given coordinate system cs. The origin lies directly in the middle of the sphere.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • radius (int/float.) – Radius of the sphere.
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.
  • color (List, Tuple, VTK Color) – Apply a specific color to a visualisation. You can use either an RGB list, e.g. color=[0.7, 0.3, 0.1], or any VTK color (from vtk.util.colors).
flexible_Body(cs, flex_Body, name=None)

Add a flexible body graphical representation to a coordinate system given by cs.

Parameters:
  • cs (MbsSystem, Body, Coordinate System.) – Coordinate System to which the Graphical Object shall be attached.
  • pos_nodes (tupel?) – position of the node frames (bodyframe/inertial?)
  • name (String.) – A name may be assigned to each visualistion. If no name is given, then a name like visual_1 is generated automatically. The name is used for the sensor and thus for code generation.