Graphics Module#

All of the graphics‑related classes live in the msolve.Graphics module:

Provides classes and utilities for graphical representation in multibody simulations.

This module defines classes that represent geometries within a simulated mechanical system. These graphical entities serve primarily as visual aids during post-processing.

It supports rendering of both primitive and advanced geometry types, including 1D, 2D and 3D graphic entities, such as lines, circles, boxes, spheres, cylinders, as well as more complex formats like triameshes, user-defined shapes, and CAD files.

For a complete overview of all the modeling entities and how components integrate, refer back to the msolve.Model module.

class Arc(**kwds)#

Generates an arc graphic defined by a center marker, a radius or reference marker, and an angle.

Name

Type

Required

Default

Modifiable

Designable

cm

Reference - Marker

\(\checkmark\)

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

radius

Double

0.0

\(\checkmark\)

rangle

Double

0.0

\(\checkmark\)

rm

Reference - Marker

seg

Int

100

Usage

The center of the arc is the origin of marker cm. Its radius is defined either directly with radius, or with a reference marker rm.

The arc is drawn starting from the Y axis of cm in a counter clockwise fashion. The end point of the arc is defined by rangle. The plane of the arc is normal to the Z axis of cm.

The resulting arc will be a polygonal approximation of the true arc. To get a smoother arc, you can increase seg.

Example

Define Arc geometry.#
from msolve import *
from math import pi

model = Model(output="arc_graphic")
units = Units(system="MKS")
ground = Part(ground=True)
global_frame = Marker(part=ground)

body = Part(mass=1, ip=[1e3]*3)
body.cm = Marker(qp=[1,1,1], zp=[0,0,1])

arc_rm = Arc(cm=body.cm, rm=global_frame, rangle=2*pi/3, seg=20)

arc_rad = Arc(cm=body.cm, radius=2.0, rangle=pi/2, seg=20)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (ArcFromRadius), Post: Graphic (ArcFromRm).

cm#

Marker that defines the center of the arc.

Type=Reference (Marker), Required

radius#

The radius of the arc.

Info

This attribute is mutually exclusive with rm.

Type=Double, Default=0.0, Designable

rangle#

Defines the angle subtended by the Arc, measured in rad.

Type=Double, Default=0.0, Designable

rm#

Marker used to compute the radius of the Arc.

Info

This attribute is mutually exclusive with radius.

Type=Reference (Marker)

seg#

Number of line segments used to approximate the arc.

Type=Int, Default=100

class Box(**kwds)#
Creates a rectangular 3D graphic.

The dimensions can be either defined from its geometric center or from one of its corners.

Name

Type

Required

Default

Modifiable

Designable

cm

Reference - Marker

color

Color

corner

Reference - Marker

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

refinement_level

Int

3

x

Double

0.0

\(\checkmark\)

y

Double

0.0

\(\checkmark\)

z

Double

0.0

\(\checkmark\)

Example

Create a Box graphic.#
from msolve import *

model = Model(output="box")
units=Units(system="MKS")
units.length = "MILLIMETER"

ground = Part(ground=True)
global_frame = Marker(part=ground)

part = Part(mass=1, ip=[1e3,1e3,1e3], cm=Marker(qp=[0,0,10]))

ground_geom = Box(corner=global_frame, x=10, y=10, z=1)

# assign the geometry entity to the ground body
ground.geometry = ground_geom

part_geom = Box(cm=part.cm, x=2, y=2, z=2, color='LightCyan', refinement_level=5)

H3dOutput(save=True)
cm#

Marker at the geometric center.

Info

This attribute is mutually exclusive with corner.

Type=Reference (Marker)

corner#

Marker at a geometric corner.

Info

This attribute is mutually exclusive with cm.

Type=Reference (Marker)

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. If not used for contact, the graphic will be displayed using its original analytical shape for refinement level up to 3. Greater than 3, the analytical shapes will be converted into a triamesh to enhance visualization.

Type=Int, Default=3

x#

Width of the graphic along x-axis of cm or corner.

Type=Double, Default=0.0, Designable

y#

Depth of the graphic along y-axis of cm or corner.

Type=Double, Default=0.0, Designable

z#

Height of the graphic along z-axis of cm or corner.

Type=Double, Default=0.0, Designable

class Circle(**kwds)#

Creates a circle graphic defined by a center marker and a radius.

Name

Type

Required

Default

Modifiable

Designable

cm

Reference - Marker

\(\checkmark\)

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

radius

Double

0.0

\(\checkmark\)

rm

Reference - Marker

seg

Int

100

Example

Create a Circle graphic.#
from msolve import *

model = Model(output='circle')

ground = Part(ground=True)
global_frame = Marker(part=ground, zp=[0, 0, 1])
mark_1 = Marker(part=ground, qp=[10,0,0], zp=[1, 0, 0])

units = Units(length = 'MILLIMETER')

circle_rad = Circle(cm=global_frame, radius=10.0)

circle_rm = Circle(cm=global_frame, rm=mark_1, seg=20)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (CircleFromRadius), Post: Graphic (CircleFromRm).

cm#

Center of Circle.

Type=Reference (Marker), Required

radius#

Radius of Circle.

Info

This attribute is mutually exclusive with rm.

Type=Double, Default=0.0, Designable

rm#

Marker used to compute the radius of Circle.

Info

This attribute is mutually exclusive with radius.

Type=Reference (Marker)

seg#

Number of line segments used to approximate circular edge.

Type=Int, Default=100

class CurveGraphic(**kwds)#

Creates a curve graphic that represents a Curve.

Name

Type

Required

Default

Modifiable

Designable

cid

Alias

color

Color

crm

Alias

curve

Reference - Curve

\(\checkmark\)

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

rm

Reference - Marker

\(\checkmark\)

seg

Int

100

Example

For an example, see Curve.

See also

For more details, see also Post: Graphic (ParamCurve).

cid#

Alias to curve.

Type=Alias

crm#

Alias to rm.

Type=Alias

curve#

The represented Curve object.

Type=Reference (Curve), Required

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

rm#

Coordinate system with respect to which the curve points are defined.

Type=Reference (Marker), Required

seg#

Number of line segments used to approximate the curve.

Type=Int, Default=100

class Cylinder(**kwds)#

Creates a 3D graphic with straight parallel sides and a circular cross-section along the z-axis of the cm Marker.

Name

Type

Required

Default

Modifiable

Designable

auto_clearance

Double

\(\checkmark\)

cm

Reference - Marker

\(\checkmark\)

color

Color

end_caps

Enum

OPEN

ends_type

Alias

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

length

Double

0.0

\(\checkmark\)

material_inside

Bool

True

name

Str

radius

Double

0.0

\(\checkmark\)

refinement_level

Int

4

Example

Create a Cylinder graphic.#
from msolve import *

model = Model(output="cylinder")

ground = Part(ground=True)
global_frame = Marker(part=ground)
Units(length="MILLIMETER")

cyl = Cylinder(cm=global_frame, radius=10, length=100, end_caps="CLOSED", material_inside=True)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Cylinder).

auto_clearance#

Automatically compute clearance when contacts are defined on cylinders.

Type=Double, Modifiable

cm#

Marker at the center of the base circular section.

Type=Reference (Marker), Required

end_caps#

Specifies if the top and bottom are closed.

Type=Enum, Default=OPEN

Permitted values are:

  • BOTTOM_ONLY

  • CLOSED

  • OPEN

  • TOP_ONLY

ends_type#

Alias to end_caps

Type=Alias

is_material_inside#

Alias to material_inside.

Type=Alias

length#

Length of Cylinder.

Type=Double, Default=0.0, Designable

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

radius#

Radius of Cylinder.

Type=Double, Default=0.0, Designable

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. If not used for contact, the graphic will be displayed using its original analytical shape for refinement level up to 3. Greater than 3, the analytical shapes will be converted into a triamesh to enhance visualization.

Type=Int, Default=4

DeformCurve#

alias of DeformableCurveGraphic

DeformSurface#

alias of DeformableSurfaceGraphic

class DeformableCurveGraphic(**kwds)#
Creates a curve graphic that represents a DeformableCurve.

The graphic is defined by a number of straight line segments connecting vertices on the curve defined by deformable curve. The graphic deforms along with the curve as the simulation progresses.

Name

Type

Required

Default

Modifiable

Designable

color

Color

dcurve

Reference - DeformableCurve

\(\checkmark\)

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

radius

Double

0.0

seg

Int

100

Example

For an example, see DeformableCurve.

See also

For more details, see also Post: Graphic (DeformCurve).

dcurve#

Deformable Curve.

Type=Reference (DeformableCurve), Required

is_material_inside#

Type=Alias

material_inside#

Type=Bool, Default=True

radius#

The radius of the DeformableCurveGraphic.

Type=Double, Default=0.0

seg#

Number of line segments used to approximate the curves.

Type=Int, Default=100

class DeformableSurfaceGraphic(**kwds)#
Creates a surface graphic that represents a DeformableSurface.

The graphic is defined by a number of straight line segments connecting vertices on the surface defined by deformable surface. The graphic deforms along with the surface as the simulation progresses.

Name

Type

Required

Default

Modifiable

Designable

color

Color

dsurface

Reference - DeformableSurface

\(\checkmark\)

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

u_seg

Int

0

v_seg

Int

0

Example

For an example, see DeformableSurface.

See also

For more details, see also Post: Graphic (DeformSurface).

dsurface#

Deformable Curve.

Type=Reference (DeformableSurface), Required

is_material_inside#

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

u_seg#

Number of line segments used to approximate the surface.

Type=Int, Default=0

v_seg#

Number of line segments used to approximate the surface.

Type=Int, Default=0

class Ellipsoid(**kwds)#

Creates a 3D graphic where its cross-sectional planes consist of ellipses or circles, with the center aligned to the cm Marker.

Name

Type

Required

Default

Modifiable

Designable

cm

Reference - Marker

\(\checkmark\)

color

Color

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

refinement_level

Int

3

xscale

Double

0.0

\(\checkmark\)

yscale

Double

0.0

\(\checkmark\)

zscale

Double

0.0

\(\checkmark\)

Example

Create an Ellipsoid graphic.#
from msolve import *

model = Model(output="ellipsoid")

Units(length="MILLIMETER")

ground = Part(ground=True)
global_ref = Marker(body=ground)

graphic = Ellipsoid(cm=global_ref, xscale=1, yscale=1, zscale=3, color="100:200:50")

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Ellipsoid).

cm#

Marker at the center of the Ellipsoid.

Type=Reference (Marker), Required

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. If not used for contact, the graphic will be displayed using its original analytical shape for refinement level up to 3. Greater than 3, the analytical shapes will be converted into a triamesh to enhance visualization.

Type=Int, Default=3

xscale#

Diameter of the Ellipsoid graphic along the x-axis.

Type=Double, Default=0.0, Designable

yscale#

Diameter of the Ellipsoid graphic along the y-axis.

Type=Double, Default=0.0, Designable

zscale#

Diameter of the Ellipsoid graphic along the z-axis.

Type=Double, Default=0.0, Designable

class External(**kwds)#

Creates a graphic object defined using an external file.

Name

Type

Required

Default

Modifiable

Designable

color

Color

element

Str [0]

file

Str

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

refinement_level

Int

rm

Reference - Marker

\(\checkmark\)

Example

Import an external graphic object.#
from msolve import *

model = Model(output="external")

ground = Part(ground=True)
global_ref = Marker(body=ground)

# the provided file must exist in the specified directory
External(rm=global_ref, file="slotted_link.x_t", element = ['Link','Pin'])

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Parasolid).

element#

Component or element used from the external file.

Type=Str [0]

file#

Location and name of an external file.

Type=Str

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0.

Type=Int

rm#

Marker serving as a reference point for geometry data.

Type=Reference (Marker), Required

class ForceGraphic(**kwds)#
Creates an arrow representing a force acting on the specified entity.

The arrow’s direction aligns with the force, and its length is proportional to the magnitude.

Name

Type

Required

Default

Modifiable

Designable

color

Color

component

Enum

XYZ

entity

Reference - Force, Constraint

\(\checkmark\)

hidden

Bool

False

id

Int

Auto

label

Str

magnitude

Bool

False

marker

Enum

I

name

Str

radius

Double

0.0

rm

Reference - Marker

scale

Double

0.05

seg

Int

20

Example

Create a ForceGraphic.#
from msolve import *

model = Model(output="force_graphic")

ground = Part(ground=True)
global_ref = Marker(body=ground)

body=Part(mass=5, cm=Marker(qp=[0,0,40], zv=[0,0,1]), ip=[1,1,1])

Units(force="NEWTON",mass="KILOGRAM",length="METER",time="SECOND")
Accgrav(igrav=0,jgrav=0,kgrav=-9.810)
H3dOutput(save=True)

spdp = SpringDamper(type='TRANSLATION', i=body.cm, j=global_ref, k=10, c=0.1, length=40)
spdp.geo = SpringDamperGraphic(i=spdp.i, j=spdp.j, da=8, db=5, dc=3, lc=25, ld=25, coils=6)

body.geo = Box(cm=body.cm, x=15,y=15,z=15)
ground.geo = Plane(rm=global_ref, xmin=-20, xmax=+20, ymin=-20, ymax=+20)

ForceGraphic(entity=spdp, radius=2, scale=1, component="Z")
component#

Specifies the components of the entity that will be visualized.

Type=Enum, Default=XYZ

Permitted values are:

  • X

  • XY

  • XYZ

  • Y

  • YZ

  • Z

  • ZX

entity#

Specifies the entity used to extract and draw graphic forces. Valid entities are instances of Force and Constraint.

Type=Reference (Force, Constraint), Required

magnitude#

If True, a graphic of the resultant force will be created. This represents the vector sum of the 3 components, Fx, Fy, Fz.

Type=Bool, Default=False

marker#

Specifies if force is computed at the I or J marker.

Type=Enum, Default=I

Permitted values are:

  • I

  • J

rm#

Specifies the reference marker in which the force is reported.

Type=Reference (Marker)

class Frustum(**kwds)#
Creates a 3D graphic of a portion of a cone.

Its base is defined by the cm Marker and its axis by the cm z-axis.

This portion is specified as the part:

  • that remains after its upper part has been cut off by a plane parallel to its base, or,

  • that is intercepted between two such planes.

Name

Type

Required

Default

Modifiable

Designable

bottom

Double

0.0

\(\checkmark\)

cm

Reference - Marker

\(\checkmark\)

color

Color

end_caps

Enum

OPEN

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

length

Double

0.0

\(\checkmark\)

material_inside

Bool

True

name

Str

refinement_level

Int

4

top

Double

0.0

\(\checkmark\)

Example

Create a Frustum graphic.#
from msolve import *

model = Model(output="frustum")

Units(length="MILLIMETER")

ground = Part(ground=True)
global_ref = Marker(body=ground)

graphic = Frustum(cm=global_ref, top=10, bottom=50, length=100, end_caps="CLOSED")

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Frustum).

bottom#

Radius of the bottom circle.

Type=Double, Default=0.0, Designable

cm#

Marker at the center of the bottom circular face with its z-axis along the centerline of the Frustum.

Type=Reference (Marker), Required

end_caps#

Specifies if the top and bottom is closed.

Type=Enum, Default=OPEN

Permitted values are:

  • BOTTOM_ONLY

  • CLOSED

  • OPEN

  • TOP_ONLY

is_material_inside#

Alias to material_inside.

Type=Alias

length#

Length of Frustum.

Type=Double, Default=0.0, Designable

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. If not used for contact, the graphic will be displayed using its original analytical shape for refinement level up to 3. Greater than 3, the analytical shapes will be converted into a triamesh to enhance visualization.

Type=Int, Default=4

top#

Radius of the top circle.

Type=Double, Default=0.0, Designable

GraCurve#

alias of CurveGraphic

GraForce#

alias of ForceGraphic

GraPoint#

alias of PointGraphic

GraSurface#

alias of SurfaceGraphic

class Graphics#
Base class for graphic objects.

It defines a graphic element that can be used for visualization and also for 3D rigid-rigid body contact.

The objects derived from Graphics are:

active#

Defines the state of this object.

Type=Bool, Default=True

color#

The color of the graphic for H3D animation.

Type=Color

classmethod getMsolveType()#

Return the ‘type’ strings that are passed to the API calls ie API_SendOffCommandDeactivateFlag, py_get_post_states

hidden#

Specifies whether the graphic will be visible in the H3D file.

Type=Bool, Default=False

type#

Type=Enum

Permitted values are:

  • ARC

  • BOX

  • CIRCLE

  • CURVE

  • CYLINDER

  • DEFORMCURVE

  • DEFORMSURFACE

  • ELLIPSOID

  • EXTERNAL

  • FORCE

  • FRUSTUM

  • LINEMESH

  • OUTLINE

  • PARAMCURVE

  • PARAMSURFACE

  • PLANE

  • POINT

  • SPDP

  • SPHERE

  • TRIAMESH

class LineMesh(**kwds)#

Creates a graphic that connects a number of vertices with straight lines.

Name

Type

Required

Default

Modifiable

Designable

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

rm

Reference - Marker

\(\checkmark\)

vertex

Double [0]

\(\checkmark\)

Example

Create a square LineMesh graphic.#
from msolve import *

model = Model(output="lmesh")

Units(system="MKS")
ground = Part(ground=True)
global_ref = Marker(body=ground)

body = Part(cm=Marker())

vertex1 = [0,0,0]
vertex2 = [1,0,0]
vertex3 = [1,1,0]
vertex4 = [0,1,0]

line1 = vertex1 + vertex2
line2 = vertex2 + vertex3
line3 = vertex3 + vertex4
line4 = vertex4 + vertex1

lmesh = LineMesh(rm=global_ref, vertex=line1+line2+line3+line4)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (LineMesh).

rm#

Marker with respect to which all the vertex coordinates are defined.

Type=Reference (Marker), Required

vertex#

The X,Y,Z coordinates of the vertices, with two vertices specified per line.

Type=Double [0], Designable

class Outline(**kwds)#

Creates line segments between the various cm Marker.

Name

Type

Required

Default

Modifiable

Designable

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

markers

Reference - Marker [0]

name

Str

outline

Alias

Example

Create an outline graphic.#
from msolve import *

model = Model(output="outline")

Units(length="MILLIMETER")
ground = Part(ground=True)
global_ref = Marker(part=ground)

part = Part (mass=1, ip=[1e3,1e3,1e3], cm=Marker())

outline = Outline(markers = [global_ref,
                             Marker(part=ground, qp=[10,0,0]),
                             Marker(part=ground, qp=[10,10,0]),
                             Marker(part=ground, qp=[0,10,0]),
                             part.cm]
                  )

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Outline).

markers#

List of markers whose origins shape the polyline.

Type=Reference (Marker) [0]

outline#

Alias of markers.

Type=Alias

ParamCurve#

alias of CurveGraphic

ParamCurveGraphic#

alias of CurveGraphic

ParamSurface#

alias of SurfaceGraphic

ParamSurfaceGraphic#

alias of SurfaceGraphic

class Plane(**kwds)#

Creates a plane graphic expressed in respect to the rm Marker.

Name

Type

Required

Default

Modifiable

Designable

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

refinement_level

Int

3

rm

Reference - Marker

\(\checkmark\)

xmax

Double

0.0

\(\checkmark\)

xmin

Double

0.0

\(\checkmark\)

ymax

Double

0.0

\(\checkmark\)

ymin

Double

0.0

\(\checkmark\)

Example

Create a Plane graphic.#
from msolve import *

model = Model(output="plane")

Units(length="MILLIMETER")

ground = Part(ground=True)
global_ref = Marker(body=ground)

graphic = Plane(rm=global_ref, xmin=-50, ymin=-100, xmax=+50, ymax=+100)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Plane).

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0.

Type=Int, Default=3

rm#

Marker serving as a reference point for geometry data.

Type=Reference (Marker), Required

xmax#

End of the spatial extent in x-direction, defined in the rm coordinate system.

Type=Double, Default=0.0, Designable

xmin#

Start of the spatial extent in x-direction, defined in the rm coordinate system.

Type=Double, Default=0.0, Designable

ymax#

End of the spatial extent in y-direction, defined in the rm coordinate system.

Type=Double, Default=0.0, Designable

ymin#

Start of the spatial extent in y-direction, defined in the rm coordinate system.

Type=Double, Default=0.0, Designable

class PointGraphic(**kwds)#

Creates a graphic point located at the origin of the reference Marker.

Name

Type

Required

Default

Modifiable

Designable

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

rm

Reference - Marker

\(\checkmark\)

See also

For more details, see also Post: Graphic (Point).

rm#

Coordinate system defining the location of this graphic entity.

Type=Reference (Marker), Required

class RotAxis(**kwds)#
Calculate and display the instantaneous axis of rotation.

Select a rigid body as body and a cylinder representing the instantaneous axis of rotation for this body relative to ground will be generated.

For more information see Definition.

Name

Type

Required

Default

Modifiable

Designable

body

Reference - Body

\(\checkmark\)

color

Color

hidden

Bool

False

id

Int

Auto

label

Str

name

Str

radius

Double

0.0

scale

Double

0.05

seg

Int

20

Example

Create a Instantaneous Axis of Rotation graphic.#
from msolve import *

model = createDemoPendulum()

# create a rotational axis graphic on the pendulum part
rotAxis = RotAxis(
  body   = model.getChild(type=Part, name="part_1"),
  radius = 0.4,
  scale  = 10.0,
  seg    = 15,
  color  = 'Red',
  )

H3dOutput(save = True)
model.simulate(type="TRANSIENT", end=2, steps=200)

# the rotAxis should appear as a red cylinder and at every frame
# it represents the instantaneous axis of rotation of the selected body
model.generateOutput(visualize=True)
body#

The part whose instantaneous axis of rotation is computed and displayed.

Type=Reference (Body), Required

Spdp#

alias of SpringDamperGraphic

class Sphere(**kwds)#

Creates a 3D graphic whose plane sections are circles and cm Marker at its center.

Name

Type

Required

Default

Modifiable

Designable

cm

Reference - Marker

\(\checkmark\)

color

Color

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

radius

Double

0.0

\(\checkmark\)

refinement_level

Int

3

Example

Create a Sphere graphic.#
from msolve import *

model = Model(output="sphere")

Units(system="MKS")
ground = Part(ground=True)
global_ref = Marker(body=ground)

body_1 = Part(mass=10, ip=[1e3]*3, cm=Marker(zv=[0,0,1]))

body_1.geo = sphere = Sphere(cm=body_1.cm, radius=2, refinement_level=4)

H3dOutput(save=True)

See also

For more details, see also Post: Graphic (Sphere).

cm#

Marker at the geometric center.

Type=Reference (Marker), Required

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

radius#

Radius of Sphere.

Type=Double, Default=0.0, Designable

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. If not used for contact, the graphic will be displayed using its original analytical shape for refinement level up to 3. Greater than 3, the analytical shapes will be converted into a triamesh to enhance visualization.

Type=Int, Default=3

class SpringDamperGraphic(**kwds)#

Creates a spring damper geometry.

Name

Type

Required

Default

Modifiable

Designable

coils

Int

0

color

Color

da

Double

0.0

\(\checkmark\)

db

Double

0.0

\(\checkmark\)

dc

Double

0.0

\(\checkmark\)

hidden

Bool

False

i

Reference - Marker

\(\checkmark\)

id

Int

Auto

j

Reference - Marker

\(\checkmark\)

la

Double

0.0

\(\checkmark\)

label

Str

lb

Double

0.0

\(\checkmark\)

lc

Double

0.0

\(\checkmark\)

ld

Double

0.0

\(\checkmark\)

name

Str

Example

For an example, see SpringDamper.

See also

For more details, see also Post: Graphic (SPDP).

coils#

Number of coils of the spring graphic.

Type=Int, Default=0

da#

Diameter of the spring graphic.

Type=Double, Default=0.0, Designable

db#

Diameter of the damper graphic at the i marker.

Type=Double, Default=0.0, Designable

dc#

Diameter of the damper graphic at the j marker.

Type=Double, Default=0.0, Designable

i#

Start connection Marker for the SpringDamperGraphic.

Type=Reference (Marker), Required

j#

End connection Marker for the SpringDamperGraphic.

Type=Reference (Marker), Required

la#

Distance between i marker and the end of the closest damper graphic.

Type=Double, Default=0.0, Designable

lb#

Distance between j marker and the end of the closest damper graphic.

Type=Double, Default=0.0, Designable

lc#

Height of the damper graphic at the i marker.

Type=Double, Default=0.0, Designable

ld#

Height of the damper graphic at the j marker.

Type=Double, Default=0.0, Designable

class SurfaceGraphic(**kwds)#

Creates a surface graphic that represents a Surface.

Name

Type

Required

Default

Modifiable

Designable

color

Color

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

rm

Reference - Marker

\(\checkmark\)

surface

Reference - Surface

\(\checkmark\)

u_seg

Int

10

v_seg

Int

10

Example

For an example, see Surface.

See also

For more details, see also Post: Graphic (ParamSurface).

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

rm#

Coordinate system with respect to which the surface is defined.

Type=Reference (Marker), Required

surface#

The represented Surface object.

Type=Reference (Surface), Required

u_seg#

Number of line segments used to approximate the surface.

Type=Int, Default=10

v_seg#

Number of line segments used to approximate the surface.

Type=Int, Default=10

class Triamesh(**kwds)#
Creates a graphic object defined using ‘Nodes’ and ‘Faces’. You can populate

nodes and faces manually, via a callable function, or by providing a mesh file. Supported mesh file formats include JSON and HDF5.

Name

Type

Required

Default

Modifiable

Designable

auto_clearance

Double

\(\checkmark\)

centerline_marker

Reference - Marker

\(\checkmark\)

color

Color

faces

FastList

file

Str

function

Function

hidden

Bool

False

id

Int

Auto

is_material_inside

Alias

label

Str

material_inside

Bool

True

name

Str

nodes

FastList

output_file

Str

refinement_level

Int

0

rm

Reference - Marker

\(\checkmark\)

routine

Routine

save

Bool

False

script

Script

Method Name

Method Description

write_to_file (self, file_name, step=0, file_type=’h5’)

Method Details

write_to_file(file_name, step=0, file_type='h5')

Writes the mesh data to a specified file. Nodal coordinates will always be written in global so a Matrix44 XFORM is performed.

Parameters:
  • step (int) – the simulation step at which nodal coordinates are serialized.

  • file_name (str) – The name of the file to write the mesh data to.

  • file_type (str, optional) – The type of file to write. Defaults to ‘h5’. Valid options are ‘json’ and ‘h5’.

Raises:

ValueError – If an unsupported file type is specified.

The mesh data includes nodes and faces. When the file type is ‘json’, the data is saved in JSON format. When the file type is ‘h5’, the data is saved in HDF5 format with compression.

Example

Create a triangular surface mesh.#
from msolve import *
model = Model(output="triamesh")
ground = Part(ground=True)
Units()
H3dOutput(save=True)

# node_id   0        1        2       3        4        5        6         7
nodes = [[0,0,0],[0.5,0,0],[0,1,0],[0,0,1],[0.5,1,0],[0,1,1],[0.5,0,1],[0.5,1,1]]
faces = [[0,1,2],[0,1,3],[0,2,3],
         [7,4,5],[7,4,6],[7,5,6],
         [1,2,4],[2,3,5],[3,1,6],
         [4,5,2],[5,6,3],[6,4,1]
         ]

part = Part(mass = 1, ip = [0.1,0.1,0.1], cm=Marker())
fixed = Joint(i=part.cm, j=Marker(part=ground))
rm = Marker(part=ground)

triamesh = Triamesh(rm    = rm,
                    nodes = nodes,
                    faces = faces,
                    centerline_marker = part.cm,
                    auto_clearance    = 0
                    )

See also

For more details, see also Post: Graphic (Triamesh).

auto_clearance#

Specifies the clearance of a cylindrical hole that has been meshed with Triamesh. It superimposes clearance to the triangle meshed body measured from the centerline that is being defined by the z-axis of centerline_marker. The value must be larger or equal to 0.

Type=Double, Modifiable

centerline_marker#

The z-axis of this Marker defines the centerline for auto_clearance.

Type=Reference (Marker), Modifiable

faces#

List of nodes indexes that define the face for the triamesh.

Type=FastList

file#

Optional path to a mesh file (.json or .h5) to load nodes and faces.

Type=Str

function#

Parameters passed to user defined subroutine.

Type=Function

is_material_inside#

Alias to material_inside.

Type=Alias

material_inside#

When set to True, the geometry is considered filled with material, with its exterior devoid of material. This results in outward-pointing surface normals. False signifies the opposite.

Type=Bool, Default=True

nodes#

List of node coordinates that define the triamesh.

Type=FastList

output_file#

Optional path to a serialized mesh file (.json or .h5) to load nodes and faces. If save=True the file will contain a timehistories of the node coordinates expressed in global reference frame.

Type=Str

refinement_level#

Mesh density used for visualization and, when applicable, for 3D body contact. Must be larger or equal to 0. Increasing the level by 1 results in each triangle being divided into 4.

Type=Int, Default=0

rm#

Marker defining the coordinate system for all node coordinates.

Type=Reference (Marker), Required

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

save#

If set to True, nodal coordinates will be saved to output_file at each output step during simulation. The coordinates are written in global reference frame to h5 file. This enables time-history visualization or later reloading via the file attribute.

Type=Bool, Default=False

script#

Path and name of the script that contains the routine.

Type=Script

write_to_file(file_name, step=0, file_type='h5')#

Writes the mesh data to a specified file. Nodal coordinates will always be written in global so a Matrix44 XFORM is performed.

Parameters:
  • step (int) – the simulation step at which nodal coordinates are serialized.

  • file_name (str) – The name of the file to write the mesh data to.

  • file_type (str, optional) – The type of file to write. Defaults to ‘h5’. Valid options are ‘json’ and ‘h5’.

Raises:

ValueError – If an unsupported file type is specified.

The mesh data includes nodes and faces. When the file type is ‘json’, the data is saved in JSON format. When the file type is ‘h5’, the data is saved in HDF5 format with compression.

class UserGraphic(**kwds)#

Creates a user-defined (Grasub) geometry.

Name

Type

Required

Default

Modifiable

Designable

color

Color

function

Function

hidden

Bool

False

id

Int

Auto

increment

Int

4

label

Str

name

Str

rm

Reference - Marker

\(\checkmark\)

routine

Routine

script

Script

See also

For more details, see also Post: Graphic (UserGra).

User Subroutine

The following user subroutine template expects the function signature and return value(s) as shown. Note that this is a placeholder implementation for reference purposes only.

def GRASUB(id, time, par, npar, iflag):
  # create nodes and triangles during iflag by calling
  # `py_add_gra_node`, `py_add_gra_tria`
  # update node positions at runtime by calling `py_set_gra_node`
  return

For more information, see MotionSolve Subroutines.

function#

Parameters passed to user defined subroutine.

Type=Function

increment#

The increment in which the GRASUB will be called.

Type=Int, Default=4

rm#

Marker used as coordinate system.

Type=Reference (Marker), Required

routine#

The value can be a callable Python function, a Matlab/OML script, or a string that includes the name of a DLL/SO file and the corresponding function name, separated by ‘::’.

Type=Routine

script#

Path and name of the script that contains the routine.

Type=Script