symbrim.utilities.plotting.PlotModel¶
- class symbrim.utilities.plotting.PlotModel(inertial_frame: ReferenceFrame, zero_point: Point, model: ModelBase, plot_load_groups: bool = True)¶
Bases:
PlotBrimMixin
,MplPlotBase
Plot object of a SymBRiM model.
Attributes
Coordinate where the annotation text is displayed.
Artists used to plot the object.
Child objects in the plot hierarchy.
Plot objects of the connections.
The reference frame with respect to which the object is oriented.
Plot objects of the load groups.
The SymBRiM model, which is being plotted.
Name of the plot object.
Plot objects.
Plot objects of the submodels.
The absolute origin with respect to which the object is positioned.
List of evaluated values for the object's variables.
If the object is be visible in the plot.
The absolute origin with respect to which the object is positioned.
Methods
Initialize a plot object of a model.
Add an artist to the plot object.
Add a sympy body to the scene.
Add a sympy ReferenceFrame to the scene.
Add a sympy Vector to the scene.
Add a plot object to the scene.
Add a sympy Vector to the scene.
Add a sympy Vector to the scene.
Boolean whether one of the artists contains the event.
Return a tuple of the necessary expressions for plotting.
Return the plot_object based on a sympy object.
Get coordinate of the point as expressions.
Plot the associated plot objects.
Update the objects on the scene, based on the currect values.
- __init__(inertial_frame: ReferenceFrame, zero_point: Point, model: ModelBase, plot_load_groups: bool = True) None ¶
Initialize a plot object of a model.
- Parameters:
inertial_frame (ReferenceFrame) – The reference frame with respect to which all objects will be oriented.
zero_point (Point) – The absolute origin with respect to which all objects will be positioned.
model (ModelBase) – The SymBRiM model, which is being plotted.
plot_load_groups (bool, optional) – Whether to plot the load groups, by default True.
- __repr__()¶
Representation showing some basic information of the instance.
- __str__()¶
Return str(self).
- __weakref__¶
list of weak references to the object (if defined)
- add_artist(artist: ArtistBase, exprs: Expr | tuple[Expr, ...])¶
Add an artist to the plot object.
- Parameters:
artist (ArtistBase) – The artist to be added.
exprs (expression or tuple of expressions) – Args used to update the artist in the form of expressions.
- add_body(body, **kwargs)¶
Add a sympy body to the scene.
- Parameters:
body (RigidBody or Particle) – The body that should be plotted.
**kwargs (dict, optional) – Kwargs that are parsed to both internally used plot objects.
- Returns:
The added plot object.
- Return type:
PlotBody
- add_frame(frame: ReferenceFrame, origin: Point | Vector | None = None, **kwargs)¶
Add a sympy ReferenceFrame to the scene.
- Parameters:
frame (ReferenceFrame) – The reference frame that should be plotted.
origin (Point, Vector, optional) – The origin of the reference frame. Default is the zero_point.
**kwargs (dict, optional) – Kwargs that are parsed to plot object.
- Returns:
The added plot object.
- Return type:
PlotFrame
- add_line(points: Iterable[Point | Vector], name: str | None = None, **kwargs)¶
Add a sympy Vector to the scene.
- add_plot_object(plot_object: PlotBase)¶
Add a plot object to the scene.
- Parameters:
plot_object (PlotBase) – The plot object that should be added.
- add_point(point: Point | Vector, **kwargs) type[PlotBase] ¶
Add a sympy Vector to the scene.
- Parameters:
point (Point or Vector) – The point or vector to be plotted as point in space.
**kwargs – Keyword arguments are parsed to the plot object.
- Returns:
The added plot object.
- Return type:
PlotPoint
- add_vector(vector: Vector, origin: Point | Vector | None = None, **kwargs)¶
Add a sympy Vector to the scene.
- Parameters:
vector (Vector) – The vector that should be plotted with respect to the zero_point.
origin (Point, Vector, optional) – The origin of the reference frame. Default is the zero_point.
**kwargs (dict, optional) – Kwargs that are parsed to the plot object.
- Returns:
The added plot object.
- Return type:
PlotVector
- property artists: tuple[ArtistBase, ...]¶
Artists used to plot the object.
- property connections: tuple[PlotConnection, ...]¶
Plot objects of the connections.
- contains(event)¶
Boolean whether one of the artists contains the event.
- get_plot_object(sympy_object: Any | str) PlotBase | None ¶
Return the plot_object based on a sympy object.
Explanation
Return the
plot_object
based on a provided sympy object. For exampleReferenceFrame('N')
will give thePlotFrame
of that reference frame. If theplot_object
has not been added it will returnNone
.- Parameters:
sympy_object (Any or str) – SymPy object to search for. If it is a string it will search for the name.
- Returns:
Retrieved plot object.
- Return type:
PlotBase or None
- property inertial_frame: ReferenceFrame¶
The reference frame with respect to which the object is oriented.
- property load_groups: tuple[PlotLoadGroup, ...]¶
Plot objects of the load groups.
- plot(ax=None)¶
Plot the associated plot objects.
Explanation
Add the objects artists to the matplotlib axes. Note that the object should be evaluated before plotting.
- Parameters:
ax (matplotlib.axes._subplots.Axes3DSubplot, optional) – Axes on which the artist should be added. The default is the active axes.