A COMPAS-flavored combinatorial equilibrium modeling.



CEM is a form-finding method to create mixed tension-compression structures in equilibrium. This COMPAS package is developed by Rafael Pastrana at the CREATE Laboratory at Princeton University in collaboration with Patrick Ole Ohlbrock and Pierluigi D’Acunto from the Chair of Structural Design at ETH Zürich.

To better picture CEM’s underpinnings, please refer to these two excellent resources:

Additionally, feel free to check the Examples section to get a first impression of what compas_cem can do for you.

First Example

With compas_cem, you can create a tension-compression structure in equilibrium with Python using an object-oriented interface.

from compas_cem.diagrams import FormDiagram
from compas_cem.elements import Node
from compas_cem.elements import TrailEdge
from compas_cem.elements import DeviationEdge
from compas_cem.loads import NodeLoad
from compas_cem.supports import NodeSupport
from compas_cem.equilibrium import force_equilibrium
from compas_cem.plotters import FormPlotter

# create a form diagram
form = FormDiagram()

# add nodes
form.add_node(Node(0, [0.0, 0.0, 0.0]))
form.add_node(Node(1, [1.0, 0.0, 0.0]))
form.add_node(Node(2, [2.0, 0.0, 0.0]))
form.add_node(Node(3, [3.0, 0.0, 0.0]))

# add edges with negative values for a compression-only structure
form.add_edge(TrailEdge(0, 1, length=-1.0))
form.add_edge(DeviationEdge(1, 2, force=-1.0))
form.add_edge(TrailEdge(2, 3, length=-1.0))

# add supports

# add loads
form.add_load(NodeLoad(1, [0.0, -1.0, 0.0]))
form.add_load(NodeLoad(2, [0.0, -1.0, 0.0]))

# calculate equilibrium
force_equilibrium(form, eps=1e-5, kmax=100, verbose=True)

# plot
plotter = FormPlotter(form, figsize=(16, 9))

plotter.draw_nodes(radius=0.03, text="key")