compas_cem.diagrams
¤
Topology and form diagrams.
Classes¤
Diagram
¤
Base class that shares functionality across diagrams.
Source code in src/compas_cem/diagrams/diagram.py
Attributes¤
gkey_node
property
¤
A dictionary that maps geometric keys to node keys.
Notes
This shadows the base graph method of the same name. The mapping here is a cache maintained as elements are added, rather than one recomputed from the current node coordinates on every call.
Methods:¤
add_edge
¤
Add an edge to the diagram, from an edge element or from two node keys.
Parameters:
-
edge–An edge element, or the first node of the edge given positionally.
-
v–The second node of the edge, when the first was given as a key.
-
attr_dict–The attributes to store on the edge.
-
**kwattr–Extra attributes to store on the edge.
Returns:
-
key–The two node keys of the added edge.
Notes
This accepts both vocabularies, as add_node does. An edge element
carries its own attributes and may name its end nodes by coordinates,
creating them if no node sits there yet.
Source code in src/compas_cem/diagrams/diagram.py
add_node
¤
Add a node to the diagram, from a node element or from a key.
Parameters:
-
node–A node element, or a node key given positionally.
-
key–A node key. If
None, the next available key is assigned. -
attr_dict–The attributes to store on the node.
-
**kwattr–Extra attributes to store on the node.
Returns:
-
key–The key of the added node.
Notes
This accepts both vocabularies. A node element carries its own coordinates and is indexed by its geometric key, which is how a diagram is authored. A bare key with attributes is how the base graph adds a node, and how deserialization replays one.
Source code in src/compas_cem/diagrams/diagram.py
edge_force
¤
Get the force value at an edge.
Parameters:
-
edge–An edge key.
Returns:
-
force–The force value in the edge. Negative in compression, positive in tension.
Source code in src/compas_cem/diagrams/diagram.py
edge_length_2
¤
Get the stored length attribute of an edge.
Parameters:
-
edge–An edge key.
Returns:
-
length–The signed length of the edge.
Notes
This is the length carried as an edge attribute, which is signed and set by the user, not the distance between the two end nodes.
Source code in src/compas_cem/diagrams/diagram.py
edge_plane
¤
Get the projection plane at an edge.
Parameters:
-
edge–An edge key.
Returns:
-
plane–The projection plane of the edge, or
Noneif it has none.
Source code in src/compas_cem/diagrams/diagram.py
gkey
¤
Compute the geometric key of a point at the tolerance of the diagram.
Parameters:
-
xyz–The xyz coordinates of a point.
Returns:
-
gkey–The geometric key of the point.
Source code in src/compas_cem/diagrams/diagram.py
is_edge_supported
¤
Check if any of the nodes of an edge is a support.
Parameters:
-
edge–An edge key.
Returns:
-
flag–Trueif any of the edge nodes is a support.Falseotherwise.
Source code in src/compas_cem/diagrams/diagram.py
is_node_loaded
¤
Check if there is a large-enough load applied to a node.
Parameters:
-
node–A node key.
-
min_force–The minimum force magnitude to consider a node loaded.
Returns:
-
flag–Trueif the node is loaded.Falseotherwise.
Source code in src/compas_cem/diagrams/diagram.py
is_node_support
¤
Check if a node is a support.
Parameters:
-
node–A node key.
Returns:
-
flag–Trueif the node is a support.Falseotherwise.
Source code in src/compas_cem/diagrams/diagram.py
loaded_nodes
¤
Iterate over all the nodes with a large-enough load applied.
Parameters:
-
min_force–The minimum force magnitude to consider a node loaded.
Yields:
-
loaded_node–The key of the next loaded node.
Source code in src/compas_cem/diagrams/diagram.py
node_connected_edges
¤
The edges incident to a node.
Parameters:
-
node–A node key.
Returns:
-
edges–The keys of the edges connected to the node.
Notes
Each edge is reported in the direction it is stored in, so that the key returned here can be used to look edge attributes up directly.
Source code in src/compas_cem/diagrams/diagram.py
node_exists
¤
Check whether a node key or a point resolves to a node in the diagram.
Parameters:
-
value–A node key, or the xyz coordinates of a point.
Returns:
-
flag–Trueif the value resolves to a node.Falseotherwise.
Source code in src/compas_cem/diagrams/diagram.py
node_key
¤
Resolve a node key or a point to a node key.
Parameters:
-
value–A node key, or the xyz coordinates of a point.
Returns:
-
key–The node key, or
Noneif no node sits at the given point.
Notes
An integer is taken to be a node key and is returned unchanged, whether or not a node with that key exists.
Source code in src/compas_cem/diagrams/diagram.py
node_load
¤
Get the load applied at a node.
Parameters:
-
node–A node key.
Returns:
-
load_vector–A vector with the xyz components of the load.
Source code in src/compas_cem/diagrams/diagram.py
node_xyz
¤
Get or set the coordinates of a node.
Parameters:
-
key–A node key.
-
xyz–The new xyz coordinates of the node. If
None, the current coordinates are returned instead.
Returns:
-
xyz–The coordinates of the node, or
Nonewhen setting them.
Source code in src/compas_cem/diagrams/diagram.py
number_of_loaded_nodes
¤
Number of nodes in the diagram where a load is applied.
Returns:
-
number–The number of nodes with an applied load.
number_of_support_nodes
¤
Number of nodes in the diagram with an assigned support.
Returns:
-
number–The number of nodes with a support.
reaction_force
¤
Get the reaction force vector at a node.
Parameters:
-
node–A node key.
Returns:
-
reaction_vector–A vector with the xyz components of the reaction force.
Source code in src/compas_cem/diagrams/diagram.py
support_nodes
¤
Nodes where a support has been assigned.
Yields:
-
support_node–The key of the next node with a support.
update_node_xyz
¤
Move a node to new coordinates and reindex its geometric key.
Parameters:
-
key–A node key.
-
xyz–The new xyz coordinates of the node.
Source code in src/compas_cem/diagrams/diagram.py
FormDiagram
¤
The output of the form-finding algorithm.
A form diagram carries the same nodes and edges as the topology diagram it came from, positioned in static equilibrium, with the resulting edge forces and support reactions stored on it.
Parameters:
-
*args–Arguments forwarded to the base diagram.
-
**kwargs–Keyword arguments forwarded to the base diagram.
Source code in src/compas_cem/diagrams/form.py
Methods:¤
from_equilibrium_state
classmethod
¤
Build a form diagram from an equilibrium state.
Parameters:
-
eq_state–An equilibrium state computed by the numerical kernel.
-
structure–The structure the equilibrium state was computed on.
Returns:
-
form–A form diagram carrying the equilibrium state.
Source code in src/compas_cem/diagrams/form.py
from_topology_diagram
classmethod
¤
Construct a form diagram from a topology diagram.
Parameters:
-
topology–The topology diagram to copy.
Returns:
-
form–A form diagram with the same nodes and edges as the topology.
Notes
The trail bookkeeping is dropped, because a form diagram is the result of walking the trails rather than a description of them.