Skip to content

Commit 2950874

Browse files
CHANGE new_feature_elements_and_interactins
1 parent e4589ad commit 2950874

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

data/frame.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Model::Line::Segments": [{"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, -3000.0, 0.0], "end": [-3000.0, -3000.0, 3800.0]}, "guid": "f13ced9d-f394-46c8-a06f-03bc0f748a8e"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 0.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "cc7cd058-20e9-4b24-ab21-0aaf8c73699b"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 0.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "60e0fb35-669d-4906-bfc7-ba0bb8ddc7ef"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 0.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "54f0c925-a213-42bc-bc68-26e42f91c8e6"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, -3000.0, 3800.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "87597704-1e60-4fbf-a712-ff153c4be7d6"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 3800.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "4b3818f5-04b7-4062-b7a7-b147a30d3415"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 3800.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "0659621b-48b3-47f3-90b5-6401ba3b2355"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 3800.0], "end": [-3000.0, -3000.0, 3800.0]}, "guid": "34a00189-56fd-4ea3-bee7-7b30646241df"}], "Model::Mesh::Floor": [{"dtype": "compas.datastructures/Mesh", "data": {"attributes": {}, "default_vertex_attributes": {"x": 0.0, "y": 0.0, "z": 0.0}, "default_edge_attributes": {}, "default_face_attributes": {}, "vertex": {"0": {"x": -3000.0, "y": -3000.0, "z": 3800.0}, "1": {"x": -3000.0, "y": 3000.0, "z": 3800.0}, "2": {"x": 3000.0, "y": 3000.0, "z": 3800.0}, "3": {"x": 3000.0, "y": -3000.0, "z": 3800.0}}, "face": {"0": [0, 1, 2, 3]}, "facedata": {"0": {}}, "edgedata": {}, "max_vertex": 3, "max_face": 0}, "guid": "e571d237-e2a2-400b-be33-288706160fde"}]}
1+
{"Model::Line::Segments": [{"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, -3000.0, 0.0], "end": [-3000.0, -3000.0, 3800.0]}, "guid": "fb541808-f597-4887-ad14-dfc9f6986049"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 0.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "af2c15a8-358e-4a76-9929-09220abb5a37"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 0.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "ad7b8d31-4b4c-460f-ba88-015cdbece5ef"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 0.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "7984e9ad-322e-43de-a3bf-0b85e71520c3"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, -3000.0, 3800.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "54127e6c-3e59-486f-bdb1-104e3d640608"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 3800.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "1c9712d8-c7eb-4b8d-8536-9f6150a8ee61"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 3800.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "ec1ef974-8366-4350-a998-87a0f6f1cd7a"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 3800.0], "end": [-3000.0, -3000.0, 3800.0]}, "guid": "b59e5ff5-fe5b-42e8-945c-8c6b768617db"}], "Model::Mesh::Floor": [{"dtype": "compas.datastructures/Mesh", "data": {"attributes": {}, "default_vertex_attributes": {"x": 0.0, "y": 0.0, "z": 0.0}, "default_edge_attributes": {}, "default_face_attributes": {}, "vertex": {"0": {"x": -3000.0, "y": -3000.0, "z": 3800.0}, "1": {"x": -3000.0, "y": 3000.0, "z": 3800.0}, "2": {"x": 3000.0, "y": 3000.0, "z": 3800.0}, "3": {"x": 3000.0, "y": -3000.0, "z": 3800.0}}, "face": {"0": [0, 1, 2, 3]}, "facedata": {"0": {}}, "edgedata": {}, "max_vertex": 3, "max_face": 0}, "guid": "0334f95a-f3fa-4e72-9d43-07d5da2b19ee"}]}

src/compas_model/elements/beam.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class BeamElement(Element):
5858
@property
5959
def __data__(self) -> dict:
6060
return {
61-
"width": self._box.xsize,
62-
"depth": self._box.ysize,
63-
"length": self._box.zsize,
61+
"width": self.box.xsize,
62+
"depth": self.box.ysize,
63+
"length": self.box.zsize,
6464
"transformation": self.transformation,
6565
"features": self._features,
6666
"name": self.name,
@@ -79,37 +79,38 @@ def __init__(
7979
self._box = Box.from_width_height_depth(width, length, depth)
8080
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
8181

82+
@property
8283
def box(self) -> Box:
8384
return self._box
8485

8586
@property
8687
def width(self) -> float:
87-
return self._box.xsize
88+
return self.box.xsize
8889

8990
@width.setter
9091
def width(self, width: float):
91-
self._box.xsize = width
92+
self.box.xsize = width
9293

9394
@property
9495
def depth(self) -> float:
95-
return self._box.ysize
96+
return self.box.ysize
9697

9798
@depth.setter
9899
def depth(self, depth: float):
99-
self._box.ysize = depth
100+
self.box.ysize = depth
100101

101102
@property
102103
def length(self) -> float:
103-
return self._box.zsize
104+
return self.box.zsize
104105

105106
@length.setter
106107
def length(self, length: float):
107-
self._box.zsize = length
108-
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
108+
self.box.zsize = length
109+
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
109110

110111
@property
111112
def center_line(self) -> Line:
112-
return Line([0, 0, 0], [0, 0, self._box.height])
113+
return Line([0, 0, 0], [0, 0, self.box.height])
113114

114115
def compute_elementgeometry(self) -> Mesh:
115116
"""Compute the mesh shape from a box.
@@ -118,7 +119,7 @@ def compute_elementgeometry(self) -> Mesh:
118119
-------
119120
:class:`compas.datastructures.Mesh`
120121
"""
121-
return self._box.to_mesh()
122+
return self.box.to_mesh()
122123

123124
def extend(self, distance: float) -> None:
124125
"""Extend the beam.
@@ -130,7 +131,7 @@ def extend(self, distance: float) -> None:
130131
"""
131132

132133
self._box.zsize = self.length + distance * 2
133-
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2 - distance], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
134+
self._box.frame = Frame(point=[0, 0, self.box.zsize / 2 - distance], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
134135

135136
def compute_aabb(self, inflate: float = 0.0) -> Box:
136137
"""Compute the axis-aligned bounding box of the element.
@@ -146,7 +147,7 @@ def compute_aabb(self, inflate: float = 0.0) -> Box:
146147
The axis-aligned bounding box.
147148
"""
148149

149-
box = self._box.transformed(self.modeltransformation)
150+
box = self.box.transformed(self.modeltransformation)
150151
box = Box.from_bounding_box(box.points)
151152
if self.inflate_aabb and self.inflate_aabb != 1.0:
152153
box.xsize += self.inflate_aabb
@@ -168,7 +169,7 @@ def compute_obb(self, inflate: float = 0.0) -> Box:
168169
:class:`compas.geometry.Box`
169170
The oriented bounding box.
170171
"""
171-
box = self._box.transformed(self.modeltransformation)
172+
box = self.box.transformed(self.modeltransformation)
172173
if self.inflate_aabb and self.inflate_aabb != 1.0:
173174
box.xsize += self.inflate_obb
174175
box.ysize += self.inflate_obb

src/compas_model/elements/column.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class ColumnElement(Element):
5353
@property
5454
def __data__(self) -> dict:
5555
return {
56-
"width": self.width,
57-
"depth": self.depth,
58-
"height": self.height,
56+
"width": self.box.xsize,
57+
"depth": self.box.ysize,
58+
"height": self.box.zsize,
5959
"transformation": self.transformation,
6060
"features": self._features,
6161
"name": self.name,
@@ -74,37 +74,38 @@ def __init__(
7474
self._box = Box.from_width_height_depth(width, height, depth)
7575
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
7676

77+
@property
7778
def box(self) -> Box:
7879
return self._box
7980

8081
@property
8182
def width(self) -> float:
82-
return self._box.xsize
83+
return self.box.xsize
8384

8485
@width.setter
8586
def width(self, width: float):
86-
self._box.xsize = width
87+
self.box.xsize = width
8788

8889
@property
8990
def depth(self) -> float:
90-
return self._box.ysize
91+
return self.box.ysize
9192

9293
@depth.setter
9394
def depth(self, depth: float):
94-
self._box.ysize = depth
95+
self.box.ysize = depth
9596

9697
@property
9798
def height(self) -> float:
98-
return self._box.zsize
99+
return self.box.zsize
99100

100101
@height.setter
101102
def height(self, height: float):
102-
self._box.zsize = height
103-
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
103+
self.box.zsize = height
104+
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
104105

105106
@property
106107
def center_line(self) -> Line:
107-
return Line([0, 0, 0], [0, 0, self._box.height])
108+
return Line([0, 0, 0], [0, 0, self.box.height])
108109

109110
# =============================================================================
110111
# Implementations of abstract methods
@@ -128,7 +129,7 @@ def extend(self, distance: float) -> None:
128129
"""
129130

130131
self._box.zsize = self.length + distance * 2
131-
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
132+
self._box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
132133

133134
def compute_aabb(self, inflate: float = 0.0) -> Box:
134135
"""Compute the axis-aligned bounding box of the element.
@@ -144,7 +145,7 @@ def compute_aabb(self, inflate: float = 0.0) -> Box:
144145
The axis-aligned bounding box.
145146
"""
146147

147-
box = self._box.transformed(self.modeltransformation)
148+
box = self.box.transformed(self.modeltransformation)
148149
box = Box.from_bounding_box(box.points)
149150
if self.inflate_aabb and self.inflate_aabb != 1.0:
150151
box.xsize += self.inflate_aabb

0 commit comments

Comments
 (0)