Skip to content

Commit 706420a

Browse files
CHANGE self.box to self._box for beams and columns.
1 parent 4c5b50f commit 706420a

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
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": "7a03f5c2-e91a-473f-82a9-29d21b4e408d"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 0.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "2186f9e0-57c4-488a-b86b-2f121e20b589"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 0.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "dde39a51-10d7-4bc0-ad6d-88c284edfb84"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 0.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "6cdb29e3-ad7d-489c-8d20-8a9c9ce83f5b"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, -3000.0, 3800.0], "end": [-3000.0, 3000.0, 3800.0]}, "guid": "3a50b196-97b8-4ffb-8fa8-3a7fada2f3bd"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, 3000.0, 3800.0], "end": [3000.0, -3000.0, 3800.0]}, "guid": "196c15f3-abbd-499b-b4ad-e6763894265d"}, {"dtype": "compas.geometry/Line", "data": {"start": [-3000.0, 3000.0, 3800.0], "end": [3000.0, 3000.0, 3800.0]}, "guid": "8bfef15a-084f-4dcf-960f-26fbfc660482"}, {"dtype": "compas.geometry/Line", "data": {"start": [3000.0, -3000.0, 3800.0], "end": [-3000.0, -3000.0, 3800.0]}, "guid": "038076d1-98ae-49eb-bb7c-3cc3e9a0d47d"}], "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": "fafe1995-bb99-4299-a672-945d4fbb28c8"}]}
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"}]}

src/compas_model/elements/beam.py

Lines changed: 18 additions & 18 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,
@@ -76,37 +76,37 @@ def __init__(
7676
name: Optional[str] = None,
7777
) -> "BeamElement":
7878
super().__init__(transformation=transformation, features=features, name=name)
79-
self.box = Box.from_width_height_depth(width, length, depth)
80-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
79+
self._box = Box.from_width_height_depth(width, length, depth)
80+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
8181

8282
@property
8383
def width(self) -> float:
84-
return self.box.xsize
84+
return self._box.xsize
8585

8686
@width.setter
8787
def width(self, width: float):
88-
self.box.xsize = width
88+
self._box.xsize = width
8989

9090
@property
9191
def depth(self) -> float:
92-
return self.box.ysize
92+
return self._box.ysize
9393

9494
@depth.setter
9595
def depth(self, depth: float):
96-
self.box.ysize = depth
96+
self._box.ysize = depth
9797

9898
@property
9999
def length(self) -> float:
100-
return self.box.zsize
100+
return self._box.zsize
101101

102102
@length.setter
103103
def length(self, length: float):
104-
self.box.zsize = length
105-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
104+
self._box.zsize = length
105+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
106106

107107
@property
108108
def center_line(self) -> Line:
109-
return Line([0, 0, 0], [0, 0, self.box.height])
109+
return Line([0, 0, 0], [0, 0, self._box.height])
110110

111111
def compute_elementgeometry(self) -> Mesh:
112112
"""Compute the mesh shape from a box.
@@ -115,7 +115,7 @@ def compute_elementgeometry(self) -> Mesh:
115115
-------
116116
:class:`compas.datastructures.Mesh`
117117
"""
118-
return self.box.to_mesh()
118+
return self._box.to_mesh()
119119

120120
def extend(self, distance: float) -> None:
121121
"""Extend the beam.
@@ -126,8 +126,8 @@ def extend(self, distance: float) -> None:
126126
The distance to extend the beam.
127127
"""
128128

129-
self.box.zsize = self.length + distance * 2
130-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2 - distance], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
129+
self._box.zsize = self.length + distance * 2
130+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2 - distance], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
131131

132132
def compute_aabb(self, inflate: float = 0.0) -> Box:
133133
"""Compute the axis-aligned bounding box of the element.
@@ -143,7 +143,7 @@ def compute_aabb(self, inflate: float = 0.0) -> Box:
143143
The axis-aligned bounding box.
144144
"""
145145

146-
box = self.box.transformed(self.modeltransformation)
146+
box = self._box.transformed(self.modeltransformation)
147147
box = Box.from_bounding_box(box.points)
148148
if self.inflate_aabb and self.inflate_aabb != 1.0:
149149
box.xsize += self.inflate_aabb
@@ -165,7 +165,7 @@ def compute_obb(self, inflate: float = 0.0) -> Box:
165165
:class:`compas.geometry.Box`
166166
The oriented bounding box.
167167
"""
168-
box = self.box.transformed(self.modeltransformation)
168+
box = self._box.transformed(self.modeltransformation)
169169
if self.inflate_aabb and self.inflate_aabb != 1.0:
170170
box.xsize += self.inflate_obb
171171
box.ysize += self.inflate_obb

src/compas_model/elements/column.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,37 +71,37 @@ def __init__(
7171
name: Optional[str] = None,
7272
) -> "ColumnElement":
7373
super().__init__(transformation=transformation, features=features, name=name)
74-
self.box = Box.from_width_height_depth(width, height, depth)
75-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
74+
self._box = Box.from_width_height_depth(width, height, depth)
75+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
7676

7777
@property
7878
def width(self) -> float:
79-
return self.box.xsize
79+
return self._box.xsize
8080

8181
@width.setter
8282
def width(self, width: float):
83-
self.box.xsize = width
83+
self._box.xsize = width
8484

8585
@property
8686
def depth(self) -> float:
87-
return self.box.ysize
87+
return self._box.ysize
8888

8989
@depth.setter
9090
def depth(self, depth: float):
91-
self.box.ysize = depth
91+
self._box.ysize = depth
9292

9393
@property
9494
def height(self) -> float:
95-
return self.box.zsize
95+
return self._box.zsize
9696

9797
@height.setter
9898
def height(self, height: float):
99-
self.box.zsize = height
100-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
99+
self._box.zsize = height
100+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
101101

102102
@property
103103
def center_line(self) -> Line:
104-
return Line([0, 0, 0], [0, 0, self.box.height])
104+
return Line([0, 0, 0], [0, 0, self._box.height])
105105

106106
# =============================================================================
107107
# Implementations of abstract methods
@@ -113,7 +113,7 @@ def compute_elementgeometry(self) -> Mesh:
113113
-------
114114
:class:`compas.datastructures.Mesh`
115115
"""
116-
return self.box.to_mesh()
116+
return self._box.to_mesh()
117117

118118
def extend(self, distance: float) -> None:
119119
"""Extend the beam.
@@ -124,8 +124,8 @@ def extend(self, distance: float) -> None:
124124
The distance to extend the beam.
125125
"""
126126

127-
self.box.zsize = self.length + distance * 2
128-
self.box.frame = Frame(point=[0, 0, self.box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
127+
self._box.zsize = self.length + distance * 2
128+
self._box.frame = Frame(point=[0, 0, self._box.zsize / 2], xaxis=[1, 0, 0], yaxis=[0, 1, 0])
129129

130130
def compute_aabb(self, inflate: float = 0.0) -> Box:
131131
"""Compute the axis-aligned bounding box of the element.
@@ -141,7 +141,7 @@ def compute_aabb(self, inflate: float = 0.0) -> Box:
141141
The axis-aligned bounding box.
142142
"""
143143

144-
box = self.box.transformed(self.modeltransformation)
144+
box = self._box.transformed(self.modeltransformation)
145145
box = Box.from_bounding_box(box.points)
146146
if self.inflate_aabb and self.inflate_aabb != 1.0:
147147
box.xsize += self.inflate_aabb
@@ -163,7 +163,7 @@ def compute_obb(self, inflate: float = 0.0) -> Box:
163163
:class:`compas.geometry.Box`
164164
The oriented bounding box.
165165
"""
166-
box = self.box.transformed(self.modeltransformation)
166+
box = self._box.transformed(self.modeltransformation)
167167
if self.inflate_aabb and self.inflate_aabb != 1.0:
168168
box.xsize += self.inflate_obb
169169
box.ysize += self.inflate_obb

0 commit comments

Comments
 (0)