Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big clean up (through a PR, as requested) #29

Merged
merged 38 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
887c747
move base interaction
tomvanmele Feb 18, 2024
e4b08f7
rhino compat type hints and cleanup
tomvanmele Feb 18, 2024
697033a
fixes, rhino compat, group node
tomvanmele Feb 18, 2024
defcd7d
test script
tomvanmele Feb 18, 2024
8c87f0a
api docs
tomvanmele Feb 18, 2024
85a4bc5
clean up log
tomvanmele Feb 19, 2024
0bb33c5
remove shapely from dev reqs
tomvanmele Feb 19, 2024
07d62de
more cleanup
tomvanmele Feb 19, 2024
1f4267d
use exception instead of valueerror
tomvanmele Feb 19, 2024
c746b6e
add base element feature and base block
tomvanmele Feb 20, 2024
90e2ee5
elementdict and elementlist
tomvanmele Feb 20, 2024
f04d4ba
remove blender
tomvanmele Feb 20, 2024
c5dc42a
add notebook support (very basic)
tomvanmele Feb 20, 2024
9b43be4
block model
tomvanmele Feb 20, 2024
d0c5f5f
block model with viz
tomvanmele Feb 20, 2024
4d10ca0
updated collider
tomvanmele Feb 20, 2024
c7987bc
log
tomvanmele Feb 20, 2024
96fa220
update docs
tomvanmele Feb 20, 2024
65fc2e9
black
tomvanmele Feb 20, 2024
ef853b8
remove element transformation
tomvanmele Feb 22, 2024
69d5bb5
cleanup
tomvanmele Feb 22, 2024
2aebe4a
remove value from interaction
tomvanmele Feb 22, 2024
0f6d5cc
add interface
tomvanmele Feb 22, 2024
ce6a94e
stub for materials module
tomvanmele Feb 22, 2024
e545e38
remove from temp
tomvanmele Feb 22, 2024
eae9d97
update notebook
tomvanmele Feb 22, 2024
00ae785
cleanup
tomvanmele Feb 22, 2024
2eb1a93
remove typing, add membership functions, add transformation calculator
tomvanmele Feb 22, 2024
6c405be
infrastructure for spatial hierarchy
tomvanmele Feb 23, 2024
260fed8
further restrictions on nodes and addition of global transformationgl…
tomvanmele Feb 23, 2024
2c5107d
rebase block object on specialised element object
tomvanmele Feb 23, 2024
62d677e
updated example (with incorrect interfaces)
tomvanmele Feb 23, 2024
8f1f472
auto transform geometry to world
tomvanmele Feb 23, 2024
ddf098c
reset the transformation and frame attributes when a transformation i…
tomvanmele Feb 24, 2024
27d854d
remove frame transformation of model
tomvanmele Feb 24, 2024
e73a4ea
description of the meaning of "interaction"
tomvanmele Feb 24, 2024
5457dd3
elaboration
tomvanmele Feb 24, 2024
e53c951
small updates here and there
tomvanmele Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 18 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added `requirements-dev` added shapely library
* Added `compas_model.model.group_node.GroupNode` create a group node that has an attribute of _my_object that is stored in the node Attributes, check the serialization, there must be a property _my_object that refers to the attribute. Try this class from the compas2 Tree implementation.
* Added `compas_model.model.group_node.ElementNode` same description as for the group_node, but this type the class works with elements only
* Added `compas_model.model.model.Model` bring the code from the assembly
* Added `compas_model.model.element_tree.ElementTree` bring the code from the assembly
* Added tutorials and descriptions in the documentations.
* Added `compas_model.model.algorithms.collider` class for closest object queries.
* Added data-sets of robots and timber beams.
* Added `compas_model.model.Model`.
* Added `compas_model.model.ElementNode`.
* Added `compas_model.model.GroupNode`.
* Added `compas_model.model.ElementTree`.
* Added `compas_model.model.InteractionGraph`.
* Added `compas_model.elements.Element`.
* Added `compas_model.elements.Feature`.
* Added `compas_model.elements.BlockElement`.
* Added `compas_model.elements.BlockFeature`.
* Added `compas_model.elements.InterfaceElement`.
* Added `compas_model.elements.InterfaceFeature`.
* Added `compas_model.elements.PlateElement`.
* Added `compas_model.elements.PlateFeature`.
* Added `compas_model.interactions.Interaction`.
* Added `compas_model.algorithms.collider`.
* Added `compas_model.scene.ElementObject`.
* Added `compas_model.rhino.scene.RhinoBlockObject`.
* Added `compas_model.notebook.scene.ThreeBlockObject`.

### Changed

* Elements classes are refactored to have as minimal representation as possible.
* Preparation of the repository for pull requests by removing all element classes.
* Contents of `compas_model.elements.Element` is removed.
* Changed all properties are documented following compas format.
* Changed `compas_model.model.element_node.ElementNode` serialization simplified, without using children property
* Changed `compas_model.model.group_node.GroupNode` added `name` public and private properties and removed private properties as much as possible for internal methods
* Changed `compas_model.model.element_tree.ElementTree.` serialization is divided into two parts: a) branch `GroupNode` and b) leaf `ElementNode`, this is information is given `children` property.
* Changed `__eq__` to `GroupNode` by `name` instead of by `guid` for the future `Merge` method, when names of the branches are matched.
* Changed `parent` property from `None` to parent object in the `compas_mode.model.ElemenTree`
* Changed `all` general docstring formatting issues
* Changed `compas_model.model.element_node.ElementNode` property `my_object` is changed to `Element`
* Changed `compas_model.model.group_node.GroupNode` property `my_object` is changed to `geometry`
* Changed `compas_model.model.element_tree.ElementTree.` serialization method `from_data` check if node has not children and creates as a result different node type, instead of `my_object`
* Changed `test_model` function `create_model` by adding more nodes at leaves to really check if the serialization works.
* Changed `test_model` face_polygons are computed from box corners.
* Changed `compas_model.model.algorithms.collider` is defined as methods instead of a static class.
* Changed the folder structure of elements is flatenned.
* Contents of `compas_model.elements.Element` child classes transformation methods changed to handle the scaling of oriented bounding box.
* Changed clean up of the documentation.
* Changed complete refactoring of the model data-structure by introducing the InteractionGraph and Interaction classes.

### Removed

* Removed `__eq__` operator in the `ElementNode`, equality must be checked only for `GroupNode`
* Removed `fabrication` and `structure` properties from the `compas_model.elements.Element`
19 changes: 10 additions & 9 deletions src/compas_model/elements/beam_element.py → __temp/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
from __future__ import absolute_import
from __future__ import division

from compas.tolerance import TOL

from compas.geometry import Point
from compas.geometry import add_vectors
from compas.geometry import Box
from compas.geometry import Polygon
from compas.geometry import Vector
from compas.geometry import Frame
from compas.geometry import Line
from compas.geometry import add_vectors
from compas.geometry import cross_vectors
from compas.datastructures import Mesh
from compas.geometry import angle_vectors
from compas.tolerance import Tolerance
from compas.datastructures import Mesh
from compas_model.elements.element import Element


class BeamElement(Element):
"""A beam representation of a Line and a Box.
"""Class representing a beam element.

Parameters
----------
Expand Down Expand Up @@ -67,11 +68,11 @@ class BeamElement(Element):

@property
def __data__(self) -> dict:
base_data = super().__data__ # not to repeat the same code for base properties
base_data["length"] = self.geometry.depth
base_data["width"] = self.geometry.width
base_data["height"] = self.geometry.height
return base_data
data = super(BeamElement, self).__data__
data["length"] = self.geometry.depth
data["width"] = self.geometry.width
data["height"] = self.geometry.height
return data

@classmethod
def __from_data__(cls, data):
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ API Reference
:maxdepth: 1
:titlesonly:

api/compas_model.model
api/compas_model.algorithms
api/compas_model.elements
api/compas_model.interactions
api/compas_model.model
api/compas_model.notebook
api/compas_model.rhino
api/compas_model.scene
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
********************************************************************************
Acknowledgements
compas_model.algorithms
********************************************************************************

Authors of this package: Petras Vestartas, Tom van Mele.
Block research group, ETH Zurich, Switzerland.
.. currentmodule:: compas_model.algorithms

Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:
7 changes: 3 additions & 4 deletions docs/api/compas_model.elements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ Classes
:toctree: generated/
:nosignatures:

Element
BlockElement
BeamElement
InterfaceElement
PlateElement
BlockFeature
Element
Feature
15 changes: 15 additions & 0 deletions docs/api/compas_model.interactions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
********************************************************************************
compas_model.interactions
********************************************************************************

.. currentmodule:: compas_model.interactions


Classes
=======

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

Interaction
4 changes: 2 additions & 2 deletions docs/api/compas_model.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Classes
:toctree: generated/
:nosignatures:

Model
ElementNode
ElementTree
GroupNode
InteractionGraph
Interaction
Model
23 changes: 23 additions & 0 deletions docs/api/compas_model.notebook.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
********************************************************************************
compas_model.notebook
********************************************************************************

.. currentmodule:: compas_model.notebook


Classes
=======

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

ThreeBlockObject


Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:
23 changes: 23 additions & 0 deletions docs/api/compas_model.rhino.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
********************************************************************************
compas_model.rhino
********************************************************************************

.. currentmodule:: compas_model.rhino


Classes
=======

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

RhinoBlockObject


Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:
15 changes: 15 additions & 0 deletions docs/api/compas_model.scene.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
********************************************************************************
compas_model.scene
********************************************************************************

.. currentmodule:: compas_model.scene


Classes
=======

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

ElementObject
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ COMPAS Model

.. rst-class:: lead


The COMPAS model encompasses data structures and algorithms for: a) modeling individual elements of Discrete Element Assemblies, b) tracking interactions between them, commonly used for cases such as joinery or abstractly tracking adjacency in the form of a graph, and c) storing the elements in a hierarchical manner, namely a tree data structure. The package itself serves as a fundamental data structure for various modeling or structural applications and is primarily utilized as a container to store and visualize data. The data structure is compatible with COMPAS 2.0 and above.

COMPAS Model is a next generation of `compas_assembly <https://blockresearchgroup.github.io/compas_assembly/0.6.2/>`_ which is based on compas <= 1.17.9.

Table of Contents
=================
Expand All @@ -27,7 +25,6 @@ Table of Contents
examples
api
license
acknowledgements


Indices and tables
Expand Down
23 changes: 3 additions & 20 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Here, we create a simple element using the :class:`Element`. These represent str
element = BlockElement(Mesh.from_polyhedron(4))
print(element)


Other Types of Elements
=======================

Expand Down Expand Up @@ -49,26 +50,6 @@ Create Model
model.add_element(my_block)
model.print()

.. We can retrieve the nodes of elements, along with the elements themselves. For example, using the node name(s):

.. .. code-block:: python

.. node = model.get_by_name("my_block")
.. nodes = model.get_by_names("my_block")
.. node = model["my_block"]

.. The individual elements are stored in the element attribute:

.. .. code-block:: python

.. node_element = model["my_block"].element

.. Or by the element GUID:

.. .. code-block:: python

.. element = model.elements[my_block.guid]


Add Connectivity
================
Expand Down Expand Up @@ -108,6 +89,7 @@ Add interaction between elements (edge in a Graph).

Print to the data-structure in the console.


Add Hierarchy
=============

Expand Down Expand Up @@ -150,6 +132,7 @@ Add elements to groups.

Print to the data-structure in the console.


Traverse Hierarchy
==================

Expand Down
Loading
Loading