Skip to content

Commit

Permalink
Merge pull request #121 from gramaziokohler/compas_main
Browse files Browse the repository at this point in the history
Compas main
  • Loading branch information
chenkasirer committed Sep 1, 2023
2 parents f95d944 + 4be9f25 commit e88a035
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.7', '3.8', '3.9', '3.10']
python: ['3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Adapted the `Data` interface of `Beam` and `Assembly` according to the changes in COMPAS core.

### Removed


Expand Down
115 changes: 1 addition & 114 deletions data/lines.json
Original file line number Diff line number Diff line change
@@ -1,114 +1 @@
[
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
3.0,
0.0,
0.0
],
"end": [
0.0,
0.0,
0.0
]
},
"guid": "8ff21348-f55c-46e6-82d5-a9542830f4be"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
3.0,
2.0,
0.0
],
"end": [
3.0,
0.0,
0.0
]
},
"guid": "7b3f783e-6a2f-46fa-86b4-2d1cbb15b754"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
0.0,
2.0,
0.0
],
"end": [
3.0,
2.0,
0.0
]
},
"guid": "e1d4c133-6670-4a98-a7da-30472903ffc6"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
0.0,
0.0,
0.0
],
"end": [
0.0,
2.0,
0.0
]
},
"guid": "31745ab4-9181-424a-9a44-1ab30fe1f1d6"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
1.3073011262590537,
1.0,
0.0
],
"end": [
3.0,
1.0,
0.0
]
},
"guid": "9c9876bd-183f-4333-9053-cb582092f3ab"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
1.1146022525181074,
2.0,
0.0
],
"end": [
1.5,
0.0,
0.0
]
},
"guid": "6c2576ec-c87b-4084-98a9-14beac674402"
},
{
"dtype": "compas.geometry/Line",
"value": {
"start": [
0.77180331565990912,
2.0,
0.0
],
"end": [
0.27664929575362163,
0.0,
0.0
]
},
"guid": "bfdd9ed2-1f50-46a8-91dc-e3dd5908e54e"
}
]
[{"dtype": "compas.geometry/Line", "guid": "ed0d2832-440a-4c95-aa4d-d14f4bcd3adf", "data": {"start": [0.0, -0.029999999999999999, 0.0], "end": [0.0, 2.0300000000000002, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "f286692e-e844-40fd-b61a-777394791829", "data": {"start": [-0.029999999999999805, 2.0, 0.0], "end": [3.0299999999999998, 2.0, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "4b3f61f6-854c-416f-8aaf-0cf3eb642057", "data": {"start": [3.0, 2.0299999999999998, 0.0], "end": [3.0, -0.029999999999999805, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "3fd24451-c642-43e2-a5fc-909b44d12973", "data": {"start": [3.0299999999999998, 0.0, 0.0], "end": [-0.030000000000000249, 0.0, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "0e8a3ffb-eeb4-4d08-8ce5-bd8b1fb18be7", "data": {"start": [0.57191292303231478, 2.0, 0.0], "end": [0.26499265851842146, 0.0, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "3ff5ce61-e88c-4a4e-9ac3-ffb50fc0b7b0", "data": {"start": [1.2278797628757312, 2.0, 0.0], "end": [1.5, 0.0, 0.0]}}, {"dtype": "compas.geometry/Line", "guid": "cea4d142-f2de-4bbd-b6a7-c78683bcf5ff", "data": {"start": [1.3639398814378656, 1.0, 0.0], "end": [3.0, 1.0, 0.0]}}]
7 changes: 2 additions & 5 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ Installation

.. rst-class:: lead

Your options are:

Contents
========
The following installation possibilties are available:

.. toctree::
:maxdepth: 1
:titlesonly:

installation/installation_quick
installation/installation_manual
installation/installation_dev
installation/installation_dev
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pydocstyle
pytest >=3.2
pytest-mock
sphinx_compas_theme >=0.13
sphinx >=3.4
sphinx ==7.1.2
twine
matplotlib
Rtree
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def read(*names, **kwargs):
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -58,7 +57,7 @@ def read(*names, **kwargs):
include_package_data=True,
zip_safe=False,
install_requires=requirements,
python_requires=">=3.7",
python_requires=">=3.8",
extras_require=optional_requirements,
entry_points={
"console_scripts": [],
Expand Down
16 changes: 8 additions & 8 deletions src/compas_timber/assembly/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ def __str__(self):
self.guid, len(self.beams), len(self.joints)
)

@Assembly.data.setter
def data(self, value):
Assembly.data.fset(self, value)
# restore what got removed to avoid circular reference
for part in self.parts():
@classmethod
def from_data(cls, data):
assembly = super(TimberAssembly, cls).from_data(data)
for part in assembly.parts():
if isinstance(part, Beam):
self._beams.append(part)
assembly._beams.append(part)
if isinstance(part, Joint):
self._joints.append(part)
part.restore_beams_from_keys(self)
assembly._joints.append(part)
part.restore_beams_from_keys(assembly)
return assembly

@property
def beams(self):
Expand Down
30 changes: 12 additions & 18 deletions src/compas_timber/parts/beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def _create_box(frame, xsize, ysize, zsize):
boxframe = frame.copy()
depth_offset = boxframe.xaxis * xsize * 0.5
boxframe.point += depth_offset
return Box(boxframe, xsize, ysize, zsize)
return Box(xsize, ysize, zsize, frame=boxframe)


def _create_mesh_shape(xsize, ysize, zsize):
Expand Down Expand Up @@ -112,7 +112,6 @@ class Beam(Part):
def __init__(self, frame, length, width, height, geometry_type, **kwargs):
super(Beam, self).__init__(frame=frame)
# TODO: add setter so that only that makes sure the frame is orthonormal --> needed for comparisons
self.frame = frame
self.width = width
self.height = height
self.length = length
Expand All @@ -122,17 +121,19 @@ def __init__(self, frame, length, width, height, geometry_type, **kwargs):

@property
def data(self):
data = {"width": self.width, "height": self.height, "length": self.length, "geometry_type": self.geometry_type}
data.update(super(Beam, self).data)
data = {
"frame": self.frame,
"width": self.width,
"height": self.height,
"length": self.length,
"geometry_type": self.geometry_type,
}
data.update(self.attributes)
return data

@data.setter
def data(self, data):
Part.data.fset(self, data)
self.width = data["width"]
self.height = data["height"]
self.length = data["length"]
self.geometry_type = data["geometry_type"]
@classmethod
def from_data(cls, data):
return cls(**data)

@property
def tolerance(self):
Expand Down Expand Up @@ -256,13 +257,6 @@ def is_identical(self, other):
# TODO: skip joints and features ?
)

@classmethod
def from_data(cls, data):
"""Alternative to None default __init__ parameters."""
obj = cls(**data)
obj.data = data
return obj

def get_geometry(self, with_features=False):
"""Returns the geometry representation of this beam.
Expand Down
10 changes: 5 additions & 5 deletions tests/compas_timber/test_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ def test_deepcopy(mocker):

def test_find_neighbors(example_beams):
expected_result = [
set([0, 3]),
set([0, 6]),
set([0, 1]),
set([0, 5]),
set([0, 3]),
set([1, 2]),
set([1, 4]),
set([1, 5]),
set([2, 3]),
set([2, 6]),
set([2, 5]),
set([4, 5]),
set([3, 4]),
set([3, 5]),
set([5, 6]),
]
result = find_neighboring_beams(example_beams)
# beam objects => sets of keys for easy comparison
Expand Down

0 comments on commit e88a035

Please sign in to comment.