Skip to content

Commit 94455d9

Browse files
committed
typing error material assignment and opposite vectors bug
1 parent 48ab35a commit 94455d9

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Changed
1313

14+
* Fixed typing error in `Element.material` assignment.
15+
* Changed (temporarily) `polygon_polygon_overlap` to not check for exactly opposite vectors.
16+
1417
### Removed
1518

1619

src/compas_model/algorithms/contacts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ def polygon_polygon_overlap(a_points, a_normal, b_points, b_normal, tolerance, m
166166
""""""
167167
# normals should actually be exactly opposite
168168
# parallelity is not enough
169-
if not is_opposite_vector_vector(a_normal, b_normal, tol=tolerance):
170-
return
169+
170+
# if not is_opposite_vector_vector(a_normal, b_normal, tol=tolerance):
171+
# return
171172

172173
# this ensures that a shared frame is used to do the interface calculations
173174
frame = Frame(*bestfit_frame_numpy(a_points + b_points))

src/compas_model/elements/element.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ def __init__(
160160
self._transformation = transformation
161161
self._geometry = geometry
162162
self._features = list(features or [])
163-
self._material = material
163+
self._material = None
164+
if material:
165+
self.material = material
164166

165167
self._elementgeometry = None
166168
self._modelgeometry = None
@@ -213,8 +215,10 @@ def material(self) -> Union[Material, None]:
213215
def material(self, material: Union[Material, str]) -> None:
214216
if isinstance(material, Material):
215217
self._material = str(material.guid)
216-
else:
218+
elif isinstance(material, str):
217219
self._material = material
220+
else:
221+
raise TypeError("material must be a Material or a str")
218222

219223
@property
220224
def parentnode(self) -> "ElementNode":
@@ -521,6 +525,7 @@ def apply_features(self) -> Union[Mesh, Brep]:
521525
# Transformations
522526
# ==========================================================================
523527

528+
@reset_computed
524529
def transform(self, transformation: Transformation) -> None:
525530
"""Transforms the element.
526531

0 commit comments

Comments
 (0)