Shapes
–– For Solid and Visual ––
Sphere
Modia3D.Shapes.Sphere
— TypeSphere(; 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.
Ellipsoid
Modia3D.Shapes.Ellipsoid
— TypeEllipsoid(; 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.
Box
Modia3D.Shapes.Box
— TypeBox(; 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.
Cylinder
Modia3D.Shapes.Cylinder
— TypeCylinder(; 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 (whereinnerDiameter=0
defines a full cylinder).
Notes
innerDiameter
is not supported by collision.
Cone
Modia3D.Shapes.Cone
— TypeCone(; 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 (wheretopDiameter=0
defines a right cone).
Capsule
Modia3D.Shapes.Capsule
— TypeCapsule(; 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
- Some versions of SimVis visualize half ellipsoids with semi-axis length
length/2
instead of spheres with diameterdiameter
.
Beam
Modia3D.Shapes.Beam
— TypeBeam(; 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 islength + 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:
axis | length | width | thickness |
---|---|---|---|
1 | x | y | z |
2 | y | z | x |
3 | z | x | y |
FileMesh
Modia3D.Shapes.FileMesh
— TypeFileMesh(; 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
- Solid features are supported for MeshIO.jl file formats including obj and stl.
- Visual features are supported for SimVis file formats 3ds, dxf, obj and stl.
- FileMesh is not directly supported by animation export. You have to convert your mesh file into the three.js json object scene format first and store it in the same folder as your mesh file.
–– Only for Visual ––
CoordinateSystem
Modia3D.Shapes.CoordinateSystem
— TypeCoordinateSystem(; 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.
Grid
Modia3D.Shapes.Grid
— TypeGrid(; 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:
axis | length | width |
---|---|---|
1 | y | z |
2 | z | x |
3 | x | y |
Spring
Modia3D.Shapes.Spring
— TypeSpring(; 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
- SimVis visualizes whole-numbered values of
windings
. - Spring is not supported by animation export.
GearWheel
Modia3D.Shapes.GearWheel
— TypeGearWheel(; 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 (whereinnerDiameter=0
defines a full gearwheel).rootDiameter
defines the root circle diameter of the gearwheel.angle
defines the bevel angle of the gearwheel (whereangle=0
defines a cylindrical gearwheel).teeth
defines the number of teeth of the gearwheel.
Notes
- GearWheel is not supported by animation export.
TextShape
Modia3D.Shapes.TextShape
— TypeTextShape(; 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 textfont::
Font
:Font
of the textoffset
: a 3D vector as offset from origin to text alignment pointaxisAlignment::Modia3D.AxisAlignment
: alignment of textModia3D.Screen
: parallel to screenModia3D.XY_Plane
: in xy-planes of Object3DModia3D.XZ_Plane
: in xz-planes of Object3DModia3D.YZ_Plane
: in yz-planes of Object3D
axisAlignment::Modia3D.Alignment
: defines the direction the text is displayed, relative to its originModia3D.Left
,Modia3D.Right
orModia3D.Center
Notes
- TextShape is not supported by the community edition of SimVis.
- TextShape is not supported by animation export.
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)
Modia3D.Shapes.Font
— TypeFont(; 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"
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"
orcolor=[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)
ModelicaShape
Modia3D.Shapes.ModelicaShape
— TypeModelicaShape(; 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
- ModelicaShape is intended for import of Modelica models and not for Modia3D models.
- ModelicaShape is not yet supported by animation export.