compas_cem.plotters
¤
Two-dimensional drawing of topology and form diagrams.
Classes¤
DiagramPlotterObject
¤
DiagramPlotterObject(
nodesize=0.1,
edgewidth=1.0,
nodetext=None,
edgetext=None,
show_nodetext=False,
show_edgetext=False,
sizepolicy="relative",
**kwargs,
)
A scene object that draws a diagram in a plotter.
Parameters:
-
nodesize–The radius of the node markers.
-
edgewidth–The width of the edges. A pair is read as the bounds to spread the edge forces over.
-
nodetext–A tag naming what to label the nodes with, or a mapping of nodes to labels.
-
edgetext–A tag naming what to label the edges with, or a mapping of edges to labels.
-
show_nodetext–Whether to draw the node labels.
-
show_edgetext–Whether to draw the edge labels.
-
sizepolicy–If
relative, the node size is divided by the number of nodes. Ifabsolute, it is divided by the resolution of the plotter.
Notes
The size policy defaults to relative, which is what the diagram artists
of the 1.x plotter used. The upstream scene object defaults to absolute
instead, which makes the same node size read two orders of magnitude
smaller.
Source code in src/compas_cem/plotters/scene_objects.py
Attributes¤
Methods:¤
default_edge_textlabels
¤
The edge labels used when no tag names something else to show.
default_node_textlabels
¤
The node labels used when no tag names something else to show.
draw
¤
Draw the diagram, its forces and its labels.
Source code in src/compas_cem/plotters/scene_objects.py
draw_forces
¤
edge_linestyles
¤
The line style to draw every edge with.
Returns:
-
linestyles–A mapping of edges to matplotlib line styles, or
Noneto draw every edge solid.
edge_textlabel_formatters
¤
edge_textlabels
¤
Build the labels to draw on the edges.
Parameters:
-
tag–A tag naming what to label the edges with, or a mapping of edges to labels, which is returned unchanged.
Returns:
-
labels–A mapping of edges to labels, or
Noneif the tag is unsupported.
Source code in src/compas_cem/plotters/scene_objects.py
edge_widths
¤
The width to draw every edge with.
Returns:
-
widths–A mapping of edges to widths.
Notes
A single width is used for every edge unless a pair of bounds is given, in which case the absolute edge forces are spread linearly over them.
Source code in src/compas_cem/plotters/scene_objects.py
node_textlabel_formatters
¤
The supported node label tags and the formatter of each.
Source code in src/compas_cem/plotters/scene_objects.py
node_textlabels
¤
Build the labels to draw on the nodes.
Parameters:
-
tag–A tag naming what to label the nodes with, or a mapping of nodes to labels, which is returned unchanged.
Returns:
-
labels–A mapping of nodes to labels, or
Noneif the tag is unsupported.
Source code in src/compas_cem/plotters/scene_objects.py
resolve_style
¤
Derive the styling of the diagram from its current state.
Notes
The styling is resolved on every draw rather than at construction, so a redraw picks up changes made to the diagram in between.
Source code in src/compas_cem/plotters/scene_objects.py
FormPlotterObject
¤
FormPlotterObject(
loadtol=0.001,
loadscale=1.0,
reactiontol=0.001,
reactionscale=1.0,
show_loads=True,
show_reactions=True,
**kwargs,
)
A scene object that draws a form diagram in a plotter.
Parameters:
-
loadtol–The smallest load magnitude worth drawing.
-
loadscale–The factor to scale the load vectors by.
-
reactiontol–The smallest reaction force magnitude worth drawing.
-
reactionscale–The factor to scale the reaction force vectors by.
-
show_loads–Whether to draw the loads.
-
show_reactions–Whether to draw the reaction forces.
Source code in src/compas_cem/plotters/scene_objects.py
Attributes¤
Methods:¤
draw_forces
¤
Draw the loads and the reaction forces of the form diagram.
Source code in src/compas_cem/plotters/scene_objects.py
edge_textlabel_formatters
¤
The supported edge label tags and the formatter of each.
Source code in src/compas_cem/plotters/scene_objects.py
resolve_style
¤
Color the nodes by support and the edges by their force state.
Source code in src/compas_cem/plotters/scene_objects.py
Plotter
¤
TopologyPlotterObject
¤
A scene object that draws a topology diagram in a plotter.
Parameters:
-
nodecolor–What to color the nodes by, either
typeorsequence. -
edgecolor–What to color the edges by, either
stateortype. -
show_loads–Whether to draw the loads.
Source code in src/compas_cem/plotters/scene_objects.py
Attributes¤
Methods:¤
draw_forces
¤
Draw the loaded nodes as crosses inscribed in a circle.
Notes
The crosses are drawn straight onto the canvas rather than added to the scene, because a line scene object fixes its own stacking order and would end up underneath the opaque node markers.
Source code in src/compas_cem/plotters/scene_objects.py
edge_linestyles
¤
Draw the trail edges solid and the deviation edges dashed.
Source code in src/compas_cem/plotters/scene_objects.py
edge_textlabel_formatters
¤
The supported edge label tags and the formatter of each.
Source code in src/compas_cem/plotters/scene_objects.py
node_textlabel_formatters
¤
The supported node label tags and the formatter of each.