Shapes

–– For Solid and Visual ––

Sphere

Sphere

Modia3D.Shapes.SphereType
Sphere(; diameter=1.0)

Generate a new solid or visual shape representing a sphere. The reference frame = Object3D frame is located at the center of the sphere.

Arguments

  • diameter defines the diameter of the sphere.
source

Ellipsoid

Ellipsoid

Modia3D.Shapes.EllipsoidType
Ellipsoid(; lengthX=1.0, lengthY=1.0, lengthZ=1.0)

Generate a new solid or visual shape representing an ellipsoid. The reference frame = Object3D frame is located at the center of the ellipsoid.

Arguments

  • lengthX defines the length of the ellipsoid in x-direction.
  • lengthY defines the length of the ellipsoid in y-direction.
  • lengthZ defines the length of the ellipsoid in z-direction.
source

Box

Box

Modia3D.Shapes.BoxType
Box(; lengthX=1.0, lengthY=1.0, lengthZ=1.0)

Generate a new solid or visual shape representing a box. The reference frame = Object3D frame is located at the center of the box.

Arguments

  • lengthX defines the length of the box in x-direction.
  • lengthY defines the length of the box in y-direction.
  • lengthZ defines the length of the box in z-direction.
source

Cylinder

Cylinder

Modia3D.Shapes.CylinderType
Cylinder(; axis=3, diameter=1.0, length=1.0, innerDiameter=0.0)

Generate a new solid or visual shape representing a cylinder. The reference frame = Object3D frame is located at the center of the cylinder.

Arguments

  • axis defines the rotation axis of the cylinder: 1=x; 2=y; 3=z.
  • diameter defines the diameter of the cylinder.
  • length defines the length of the cylinder.
  • innerDiameter defines the inner diameter of the cylinder (where innerDiameter=0 defines a full cylinder).

Notes

  • innerDiameter is not supported by collision.
source

Cone

Cone

Modia3D.Shapes.ConeType
Cone(; axis=3, diameter=1.0, length=1.0, topDiameter=0.0)

Generate a new solid or visual shape representing a circular cone or a frustum of a circular cone. The reference frame = Object3D frame is located at the center of the base circle of the cone/frustum.

Arguments

  • axis defines the rotation axis of the cone/frustum: 1=x; 2=y; 3=z.
  • diameter defines the diameter of the base circle of the cone/frustum.
  • length defines the length of the cone/frustum.
  • topDiameter defines the diameter of the top circle of the frustum (where topDiameter=0 defines a right cone).
source

Capsule

Capsule

Modia3D.Shapes.CapsuleType
Capsule(; axis=3, diameter=1.0, length=1.0)

Generate a new solid or visual shape representing a capsule assembled by a cylinder and two half spheres. The reference frame = Object3D frame is located at the center of the capsule.

Arguments

  • axis defines the rotation axis of the capsule: 1=x; 2=y; 3=z.
  • diameter defines the diameter of the capsule.
  • length defines the length of the middle cylindrical part of the capsule.

Notes

source

Beam

Beam

Modia3D.Shapes.BeamType
Beam(; axis=3, length=1.0, width=0.2, thickness=0.1)

Generate a new solid or visual shape representing a beam assembled by a box and two half cylinders. The reference frame = Object3D frame is located at the center of the beam.

Arguments

  • axis defines the longitudinal axis of the beam: 1=x; 2=y; 3=z.
  • length defines the box length of the beam. The total length of the beam is length + width.
  • width defines the width (= cylinder diameter) of the beam.
  • thickness defines the thickness of the beam.

The dimension directions depend on axis by circularly shift:

axislengthwidththickness
1xyz
2yzx
3zxy
source

FileMesh

FileMesh

Modia3D.Shapes.FileMeshType
FileMesh(; filename::AbstractString="", scale=SVector{3,Float64}(1.0,1.0,1.0),
doubleSided::Bool=false, useMaterialColor::Bool=false, smoothNormals::Bool=false, convexPartition::Bool=false)

Generate a new solid or visual shape representing a mesh. The reference frame = Object3D frame is defined by the mesh data.

Arguments

  • filename defines the name of the mesh file.
  • scale defines the scaling factors to be applied in x-, y- and z-direction.
  • useMaterialColor defines if the material color of the shape is to be considered.
  • doubleSided defines if rendering of mesh backside is enabled.
  • smoothNormals defines if smoothing of mesh normals is active.
  • convexPartition defines if partitioning into convex sub meshes is active.

Notes

source

–– Only for Visual ––

CoordinateSystem

CoordinateSystem

Modia3D.Shapes.CoordinateSystemType
CoordinateSystem(; length=1.0)

Generate a new visual shape representing a coordinate system. The reference frame = Object3D frame coincides with the coordinate system.

Arguments

  • length defines the length of the coordinate system axes.
source

Grid

Grid

Modia3D.Shapes.GridType
Grid(; axis=3, length=1.0, width=0.6, distance=0.1, lineWidth=1.0)

Generate a new visual shape representing a planar grid. The reference frame = Object3D frame is located at the center of the grid.

Arguments

  • axis defines the normal axis of the grid: 1=x; 2=y; 3=z.
  • length defines the length of the grid.
  • width defines the width of the grid.
  • distance defines the distance of the grid lines.
  • lineWidth defines the line width of the grid.

The dimension directions depend on axis by circularly shift:

axislengthwidth
1yz
2zx
3xy
source

Spring

Spring

Modia3D.Shapes.SpringType
Spring(; axis=3, length=1.0, diameter=1.0, wireDiameter=0.05, windings=5)

Generate a new visual shape representing a helical spiral spring. The reference frame = Object3D frame is located at the center of the base circle of the spring.

Arguments

  • axis defines the axis of the spring: 1=x; 2=y; 3=z.
  • length defines the length of the spring.
  • diameter defines the diameter of the spring.
  • wireDiameter defines the diameter of the spring wire.
  • windings defines the number of windings of the spring.

Notes

source

GearWheel

GearWheel

Modia3D.Shapes.GearWheelType
GearWheel(; axis=3, diameter=1.0, length=1.0, innerDiameter=0.0, angle=0.0, teeth=20)

Generate a new visual shape representing a gearwheel. The reference frame = Object3D frame is located at the center of the gearwheel.

Arguments

  • axis defines the rotation axis of the gearwheel: 1=x; 2=y; 3=z.
  • diameter defines the diameter of the gearwheel.
  • length defines the length of the gearwheel.
  • innerDiameter defines the inner diameter of the gearwheel (where innerDiameter=0 defines a full gearwheel).
  • rootDiameterdefines the root circle diameter of the gearwheel.
  • angle defines the bevel angle of the gearwheel (where angle=0 defines a cylindrical gearwheel).
  • teeth defines the number of teeth of the gearwheel.

Notes

source

TextShape

TextShape

Modia3D.Shapes.TextShapeType
TextShape(; text="Hello world", font=Font(), offset=[0.0,0.0,0.0],
            axisAlignment=Screen, alignment=Center)

Generate a new visual shape representing a text shape.

Arguments

  • text::AbstractString: String of the text
  • font::Font: Font of the text
  • offset: a 3D vector as offset from origin to text alignment point
  • axisAlignment::Modia3D.AxisAlignment: alignment of text
    • Modia3D.Screen: parallel to screen
    • Modia3D.XY_Plane: in xy-planes of Object3D
    • Modia3D.XZ_Plane: in xz-planes of Object3D
    • Modia3D.YZ_Plane: in yz-planes of Object3D
  • axisAlignment::Modia3D.Alignment: defines the direction the text is displayed, relative to its origin
    • Modia3D.Left, Modia3D.Right or Modia3D.Center

Notes

Examples

import Modia3D
font  = Font(fontFamily="Arial", charSize=0.4, color="MediumVioletRed")
text1 = TextShape("This is a box")
text2 = TextShape("This is the xy plane";
                   font = font, axisAlignment=Modia3D.XY_Plane,
                   alignment = Modia3D.Left)
source
Modia3D.Shapes.FontType
Font(; fontFamily="FreeSans", bold=false, italic=false,
       charSize=0.1, color=defaultColor(), transparency=0.0)

Generate a Font.

Arguments

  • fontFamily: name of the font family
    • "FreeSans", "FreeSerif", "Arial", "ArialNarrow", "CourierNew", "TimesNewRoman", or "Verdana"

fontFamily Courtesy to DLR Visualization Library

  • bold: if true, the text is displayed in bold font.
  • italic: if true, the text is displayed in italic font.
  • charSize: character size in [m].
  • color defines the material color as a String or RGB values. In case of Strings the color is constructed using Colors.jl. So named colors and many other kinds of color specifications are available. In addition, colors can be directly defined by a vector of RGB values. E.g. color="MediumVioletRed" or color=[255, 0, 0].
  • transparency: transparency of the fon , 0.0 (opaque) ... 1.0 (transparent)

Notes

  • fontFamily like "Arial", "Verdana" are only supported under Windows.

Examples

import Modia3D
font1 = Font()
font2 = Font(fontFamily="Arial", bold=true, charSize=0.2,
             color="LightBlue", transparency=0.5)
source

ModelicaShape

Modia3D.Shapes.ModelicaShapeType
ModelicaShape(; type=1, lengthX=1.0, lengthY=1.0, lengthZ=1.0, extra=[0.0, 0.0, 0.0])

Generate a new visual shape according to the Modelica.Mechanicis.MultiBody.Visualizers.Advanced.Shape model of the Modelica Standard Library.

Arguments

  • type defines the type of the shape: 1=box; 2=sphere; 3=cylinder; 4=cone; 5=capsule; 6=coordinate system; 7=spring; 8=gearwheel; 9=pipe; 10=grid; 11=beam.
  • lengthX defines the length of the shape in x-direction.
  • lengthY defines the length of the shape in y-direction.
  • lengthZ defines the length of the shape in z-direction.
  • extra defines extra parameters for cone, pipe, spring and gearwheel.

Notes

source