from compas.geometry import Point
from compas_assembly2 import Element
from compas_assembly2 import Model
if __name__ == "__main__":
# create model
model = Model()
# add group nodes - a typical tree node with a name and geometry
car = model.add_group(name="car", geometry=None) # type: ignore
wheel = car.add_group(name="wheel", geometry=Point(0, 0, 0)) # type: ignore
# add element nodes - a "special" tree node with a name and element
spoke1 = wheel.add_element(name="spoke1", element=Element.from_frame(1, 10, 1)) # type: ignore
spoke2 = wheel.add_element(name="spoke2", element=Element.from_frame(5, 10, 1)) # type: ignore
spoke3 = wheel.add_element(name="spoke3", element=Element.from_frame(10, 10, 1)) # type: ignore
# add interactions
model.add_interaction(spoke1, spoke2)
model.add_interaction(spoke1, spoke3)
model.add_interaction(spoke2, spoke3)
# print the model to preview the tree structure
model.print()
- Create different Element classes e.g. Beam, Plate, Block, Glulam, etc. Use OCC for curved geometries
- Fast Tree search that is native to Python
- Go over the other assembly data-structure.
A data structure is needed to represent a model consisting of structural elements like blocks, beams, nodes, and plates, as well as fabrication elements for subtractive and additive processes. This data structure should also facilitate the computation and storage of adjacency and joinery information, as well as interfaces between these elements. Additionally, it should allow for the transfer of data between the model, structural simulation, and fabrication processes.
- BOOK-KEEPING OBJECTS IN AN ORDERED COLLECTION WITH SELECTION LOGIC In many packages elements, joints are stored in a simple list without any functionality that could help assembly data-structure. The list itself can be changed to something else, e.g. an OrderedList since for example we never randomly fabricate elements, but start from the first item and gradually iterate, these indices can serve as element tags too. A collection can have grouping functionality and selection methods for retrieving objects based on element or joint attributes. For example, we want to output an element fabrication toolpath, structural data or highlight objects by type such as Blocks or Beams.
- Open project folder in VS Code
- Select python environment for the project
- First time using VS Code and on Windows? Make sure select the correct terminal profile:
Ctrl+Shift+P
,Terminal: Select Default Profile
and selectCommand Prompt
.
All terminal commands in the following sections can be run from the VS Code integrated terminal.
- Go to the
Source control
tab - Make an initial commit with all newly created files
-
Install the newly created project
pip install -e .
-
Install it on Rhino
python -m compas_rhino.install
Code convention follows PEP8 style guidelines and line length of 120 characters.
-
Check adherence to style guidelines
invoke lint
-
Format code automatically
invoke format
Documentation is generated automatically out of docstrings and RST files in this repository
-
Generate the docs
invoke docs
-
Check links in docs are valid
invoke linkcheck
-
Open docs in your browser (file explorer ->
dist/docs/index.html
)
Tests are written using the pytest framework
-
Run all tests from terminal
invoke test
-
Or run them from VS Code from the
Testing
tab
We use Grasshopper Componentizer to develop Python components that can be stored and edited on git.
-
Build components
invoke build-ghuser-components
-
Install components on Rhino
python -m compas_rhino.install
Releases follow the semver versioning convention.
-
Create a new release
invoke release major