Skip to content

Commit

Permalink
more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Mar 3, 2024
1 parent e8fc698 commit bece7f9
Show file tree
Hide file tree
Showing 24 changed files with 116 additions and 41 deletions.
Binary file added docs/_images/400_crossvault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/500_dome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/600_wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions docs/api/compas_assembly.geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ compas_assembly.geometry
Generate assemblies from geometry for well-known typologies.


Base Classes
============
Classes
=======

.. autosummary::
:toctree: generated/
:nosignatures:

Geometry
Arch
Dome
Wall


Classes
=======
Base Classes
============

.. autosummary::
:toctree: generated/
:nosignatures:

Arch
Dome
Wall
Geometry
4 changes: 4 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ Examples
examples/000_two-blocks
examples/100_stack
examples/300_arch
examples/400_crossvault
examples/500_dome
examples/600_wall

2 changes: 1 addition & 1 deletion docs/examples/000_two-blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from compas_assembly.datastructures import Block
from compas_assembly.viewer import DEMViewer

ASSEMBLY = pathlib.Path(__file__).parent / "two-blocks-assembly.json"
ASSEMBLY = pathlib.Path(__file__).parent / "two-blocks_assembly.json"

# =============================================================================
# Geometry
Expand Down
12 changes: 10 additions & 2 deletions docs/examples/000_two-blocks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ and compute the contact forces between the blocks that result in static equilibr
Finally, we export the assembly to a JSON file and visualize the result with the DEM Viewer.


Code
====
Equilibrium
===========

The equilibrium is simple.
The forces are equally distributed over the four corners of the interface,
and the resultant is throught center.
There is no friction.

.. note::

Expand All @@ -24,5 +29,8 @@ Code
just comment out lines 3 and 48.


Code
====

.. literalinclude:: 000_two-blocks.py
:language: python
2 changes: 1 addition & 1 deletion docs/examples/100_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from compas_assembly.datastructures import Block
from compas_assembly.viewer import DEMViewer

ASSEMBLY = pathlib.Path(__file__).parent / "stack-assembly.json"
ASSEMBLY = pathlib.Path(__file__).parent / "stack_assembly.json"

# =============================================================================
# Geometry
Expand Down
11 changes: 5 additions & 6 deletions docs/examples/100_stack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@ Equilibrium
Note that the contact forces (in blue) increase towards the bottom of the stack,
due to the increasing weight.

The result forces (in green) between block 0 and 1, between 1 and 2, and between 2 and 3
The resultant forces (in green) between blocks 0 and 1, blocks 1 and 2, and blocks 2 and 3
are not contained in the interfaces between those blocks.
As a result, the stack can only be stable by introducing equilibriating "glue" forces (in red)
at those interfaces.
As a result, the stack requires equilibriating "glue" forces (in red) at those interfaces.


Code
====

.. note::

This example uses ``compas_cra`` for the equilibrium calculations.
Expand All @@ -37,5 +33,8 @@ Code
just comment out lines 3 and 50.


Code
====

.. literalinclude:: 100_stack.py
:language: python
2 changes: 1 addition & 1 deletion docs/examples/300_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from compas_assembly.geometry import Arch
from compas_assembly.viewer import DEMViewer

ASSEMBLY = pathlib.Path(__file__).parent / "arch-assembly.json"
ASSEMBLY = pathlib.Path(__file__).parent / "arch_assembly.json"

# =============================================================================
# Arch assembly
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/300_arch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ Equilibrium
Coming...


Code
====

.. note::

Note that this example uses ``compas_cra`` for the equilibrium calculations.
Expand All @@ -31,5 +28,8 @@ Code
just comment out lines 3 and 41.


Code
====

.. literalinclude:: 300_arch.py
:language: python
9 changes: 5 additions & 4 deletions docs/examples/400_crossvault.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import pathlib

# from compas_cra.equilibrium import cra_solve
# from compas_cra.equilibrium import rbe_solve
from compas_cra.equilibrium import rbe_solve

import compas
from compas.datastructures import Mesh
from compas.geometry import Scale
from compas_assembly.algorithms import assembly_interfaces
from compas_assembly.datastructures import Assembly
from compas_assembly.viewer import DEMViewer

MESHES = pathlib.Path(__file__).parent.parent / "crossvault_blocks.json"
ASSEMBLY = pathlib.Path(__file__).parent / "crossvault-assembly.json"
MESHES = pathlib.Path(__file__).parent / "crossvault_blocks.json"
ASSEMBLY = pathlib.Path(__file__).parent / "crossvault_assembly.json"

# =============================================================================
# Block meshes
Expand Down Expand Up @@ -54,7 +55,7 @@
# Ideally, the RBE result can be used to jumpstart the CRA solver
# But this is not available yet...

# rbe_solve(assembly)
rbe_solve(assembly)

# =============================================================================
# Export
Expand Down
34 changes: 27 additions & 7 deletions docs/examples/400_crossvault.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
**********
********************************************************************************
Crossvault
**********
********************************************************************************

.. figure:: /_images/crossvault.png
.. figure:: /_images/400_crossvault.png

.. rst-class:: lead
Summary
=======

Construct an assembly data structure of a cross-vault that can be used for equilibrium calculations, generation of fabrication data, or assembly simulationos.
We construct the assembly from a list oof meshes representing the blocks.
First, we construct the assembly from a list of meshes representing the blocks.
The JSON file containing the meshes is available here: :download:`crossvault.json <crossvault.json>`.
Then, we detect the interfaces between the blocks, and compute an approximate equilibrium solution.
Finally, we export the assembly and visualize the result.

.. literalinclude:: crossvault.py

Equilibrium
===========

Coming...


.. note::

Note that this example uses ``compas_cra`` for the equilibrium calculations.
If you don't have ``compas_cra`` installed,
or simply don't want to compute the contact forces,
just comment out lines 3, 4 and 58.


Code
====

.. literalinclude:: 400_crossvault.py
:language: python
2 changes: 1 addition & 1 deletion docs/examples/500_dome.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from compas_assembly.geometry import Dome
from compas_assembly.viewer import DEMViewer

ASSEMBLY = pathlib.Path(__file__).parent / "dome-assembly.json"
ASSEMBLY = pathlib.Path(__file__).parent / "dome_assembly.json"

# =============================================================================
# Template
Expand Down
23 changes: 23 additions & 0 deletions docs/examples/500_dome.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
********************************************************************************
A Hemispherical Dome
********************************************************************************

.. figure:: /_images/500_dome.png

Summary
=======

Coming...


Equilibrium
===========

Coming...


Code
====

.. literalinclude:: 500_dome.py
:language: python
2 changes: 1 addition & 1 deletion docs/examples/600_wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

HERE = pathlib.Path(__file__).parent
DATA = HERE / "wall.json"
ASSEMBLY = HERE / "wall-assembly.json"
ASSEMBLY = HERE / "wall_assembly.json"

# =============================================================================
# Import
Expand Down
23 changes: 23 additions & 0 deletions docs/examples/600_wall.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
********************************************************************************
A Curved Wall
********************************************************************************

.. figure:: /_images/600_wall.png

Summary
=======

Coming...


Equilibrium
===========

Coming...


Code
====

.. literalinclude:: 600_wall.py
:language: python
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/examples/crossvault_assembly.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples/dome_assembly.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/examples/stack-assembly.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/two-blocks-assembly.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/examples/wall-assembly.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/wall_assembly.json

Large diffs are not rendered by default.

0 comments on commit bece7f9

Please sign in to comment.