Metadata-Version: 2.4
Name: compas_sandbox
Version: 0.7.1
Author-email: Gene Ting-Chun Kao <kao@arch.ethz.ch>
License: MIT License
        
        Copyright (c) 2020 - 2022 ETH Zurich, Block Research Group, Gene Ting-Chun Kao
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/petrasvestartas/compas_sandbox
Project-URL: Documentation, https://github.com/petrasvestartas/compas_sandbox
Project-URL: Repository, https://github.com/petrasvestartas/compas_sandbox.git
Project-URL: Changelog, https://github.com/petrasvestartas/compas_sandbox/blob/main/CHANGELOG.md
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: compas>=2.4
Requires-Dist: compas_assembly>=0.7.0
Requires-Dist: compas_sandbox_native>=0.1.1; python_version < "3.14"
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: shapely>=2.0
Provides-Extra: dev
Requires-Dist: attrs>=17.4; extra == "dev"
Requires-Dist: black>=22.12.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: bump-my-version; extra == "dev"
Requires-Dist: compas_invocations2; extra == "dev"
Requires-Dist: compas_viewer; extra == "dev"
Requires-Dist: invoke>=0.14; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: sphinx_compas2_theme; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Provides-Extra: viz
Requires-Dist: compas_viewer; extra == "viz"
Requires-Dist: matplotlib; extra == "viz"
Dynamic: license-file

# COMPAS CRA

![build](https://github.com/petrasvestartas/compas_sandbox/workflows/build/badge.svg)
[![GitHub - License](https://img.shields.io/github/license/petrasvestartas/compas_sandbox.svg)](./LICENSE)
[![pip downloads](https://img.shields.io/pypi/dm/compas_sandbox)](https://pypi.python.org/project/compas_sandbox)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/compas_sandbox.svg)](https://pypi.python.org/project/compas_sandbox)
[![PyPI - Latest Release](https://img.shields.io/pypi/v/compas_sandbox.svg)](https://pypi.python.org/project/compas_sandbox)
[![DOI](https://zenodo.org/badge/374677757.svg)](https://zenodo.org/badge/latestdoi/374677757)

[Coupled Rigid-Block Analysis (CRA)](https://doi.org/10.1016/j.cad.2022.103216) implementation using [COMPAS](https://compas.dev/) framework.

> developed with <span style="color: #e25555;">&#9829;</span> by [Gene Ting-Chun Kao](https://geneatcg.com)

## Installation

```bash
pip install compas_sandbox
```

Nothing else is needed on Windows, macOS (Apple Silicon and Intel) or Linux. The
[IPOPT](https://coin-or.github.io/Ipopt/) 3.14.19 solver (Eclipse Public License 2.0,
MUMPS linear solver, no HSL) is compiled into the `compas_sandbox_native` dependency as
a Python extension module with [nanobind](https://github.com/wjakob/nanobind), so
solving happens in-process — no solver executables, no subprocess, no conda. See
[`native/README.md`](./native/README.md) for how the extension is built and
[`packaging/README.md`](./packaging/README.md) for the IPOPT build itself.

### Rhino 8

The easiest way is to let the ScriptEditor install everything for you. Start a new
Python 3 script with this header and run it — on the first run Rhino installs
`compas_sandbox` and all of its dependencies into its own environment (this takes a
couple of minutes, watch the progress in the ScriptEditor console):

```python
#! python3
# venv: compas-sandbox
# r: compas_sandbox
```

No extra `# r:` lines are needed for `compas`, `numpy`, `shapely` or the solver — they
are dependencies of `compas_sandbox` and pip installs them automatically.

Ready-to-run examples for the ScriptEditor are in [`scripts/`](./scripts):

- [`scripts/rhino_cra_cubes.py`](./scripts/rhino_cra_cubes.py) — three stacked cubes,
  baked as wireframe blocks with interface outlines and resultant contact forces.
- [`scripts/rhino_cra_arch.py`](./scripts/rhino_cra_arch.py) — a parametric masonry
  arch (span, rise, thickness, number of voussoirs, friction) solved and baked the
  same way.

Alternatively, install manually into Rhino's Python with the shell that ships with
Rhino (`Tools > Options > Plugins > Rhino Code > Open Shell`, or
`~/.rhinocode/py39-rh8/shell/open-shell` on macOS):

```bash
pip install compas_sandbox
```

Note that Rhino 8 ships CPython 3.9, which is fully supported: solver wheels exist for
CPython 3.9–3.13 on all platforms. Since the solver is a regular Python extension
module rather than an executable, it is also not affected by the antivirus policies
that quarantine unknown `.exe` files on managed Windows machines. To verify the solver
in any environment, run [`scripts/rhino_ipopt_check.py`](./scripts/rhino_ipopt_check.py).

To find out more about CRA, please refer to our paper in the CAD Computer-Aided Design journal:
[https://doi.org/10.1016/j.cad.2022.103216](https://doi.org/10.1016/j.cad.2022.103216 )

## Coupled Rigid-Block Analysis: Stability-Aware Design of Complex Discrete-Element Assemblies

![image](https://github.com/petrasvestartas/compas_sandbox/blob/main/docs/_images/cra_bridge.png?raw=true)

### Abstract

The rigid-block equilibrium (RBE) method uses a penalty formulation to
measure structural infeasibility or to guide the design of stable
discrete-element assemblies from unstable geometry.
However, RBE is a purely force-based formulation,
and it incorrectly describes stability when
complex interface geometries are involved.
To overcome this issue, this paper introduces
the coupled rigid-block analysis (CRA) method,
a more robust approach building upon RBE’s strengths.
The CRA method combines equilibrium and kinematics in a penalty formulation
in a nonlinear programming problem.
An extensive benchmark campaign is used to show how CRA enables
accurate modelling of complex three-dimensional discrete-element assemblies
formed by rigid blocks.
In addition, an interactive stability-aware design process to
guide user design towards structurally-sound assemblies is proposed.
Finally, the potential of our method for real-world problems are demonstrated
by designing complex and scaffolding-free physical models.

### Please cite our work if you use CRA in your research

#### Paper

```latex
@article{kao2022coupled,
    title     = {Coupled Rigid-Block Analysis: Stability-Aware Design of Complex Discrete-Element Assemblies},
    author    = {Kao, Gene Ting-Chun and Iannuzzo, Antonino and Thomaszewski, Bernhard and Coros, Stelian and Van Mele, Tom and Block, Philippe},
    journal   = {Computer-Aided Design},
    volume    = {146},
    pages     = {103216},
    year      = {2022},
    publisher = {Elsevier},
    doi       = {10.1016/j.cad.2022.103216},
    url       = {https://doi.org/10.1016/j.cad.2022.103216}
}
```

#### Software implementation

```latex
@misc{compas-sandbox,
    title  = {{COMPAS CRA}: Coupled Rigid-Block Analysis ({CRA}) for the {COMPAS} framework},
    author = {Kao, Gene Ting-Chun},
    note   = {https://github.com/BlockResearchGroup/compas\_cra},
    year   = {2020-2022},
    doi    = {10.5281/zenodo.7043135},
    url    = {https://doi.org/10.5281/zenodo.7043135},
}
```

### Read the docs

[https://github.com/petrasvestartas/compas_sandbox](https://github.com/petrasvestartas/compas_sandbox)

### Examples to reproduce our paper results

See examples in [docs](https://github.com/petrasvestartas/compas_sandbox/latest/examples.html) or try them in [docs/examples](https://github.com/petrasvestartas/compas_sandbox/blob/main/docs/examples).
