Compare commits

..

3 Commits

Author SHA1 Message Date
Jedd Morgan c169c4eeda Merge pull request #299 from specklesystems/jrm/units/units-brep-fix
fix(objects)): Fixed issue where breps were incorrectly setting their…
2023-09-08 13:45:46 +01:00
Jedd Morgan 32b5ef88a1 fix(tests): fixed unit test for brep serialization 2023-09-08 13:43:50 +01:00
Jedd Morgan 3a979318ad fix(objects)): Fixed issue where breps were incorrectly setting their units 2023-09-07 17:33:01 +01:00
3 changed files with 6 additions and 9 deletions
+2 -2
View File
@@ -898,7 +898,7 @@ class Brep(
def VerticesValue(self) -> List[Point]:
if self.Vertices is None:
return None
encoded_unit = get_encoding_from_units(self.Vertices[0]._units)
encoded_unit = get_encoding_from_units(self.Vertices[0].units)
values = [encoded_unit]
for vertex in self.Vertices:
values.extend(vertex.to_list())
@@ -913,7 +913,7 @@ class Brep(
for i in range(0, len(value), 3):
vertex = Point.from_list(value[i : i + 3])
vertex._units = units
vertex.units = units
vertices.append(vertex)
self.Vertices = vertices
+1 -4
View File
@@ -11,8 +11,8 @@ from specklepy.api.models import (
from specklepy.logging.exceptions import (
GraphQLException,
SpeckleException,
UnsupportedException,
)
from devtools import debug
@pytest.mark.run(order=3)
@@ -201,9 +201,6 @@ class TestStream:
def test_stream_activity(self, client: SpeckleClient, stream: Stream):
activity = client.stream.activity(stream.id)
if isinstance(activity, SpeckleException):
debug(activity.with_traceback())
older_activity = client.stream.activity(
stream.id, before=activity.items[0].time
)
+3 -3
View File
@@ -388,9 +388,9 @@ def test_brep_curve3d_values_serialization(curve, polyline, circle):
def test_brep_vertices_values_serialization():
brep = Brep()
brep.VerticesValue = [1, 1, 1, 1, 2, 2, 2, 3, 3, 3]
assert brep.Vertices[0].get_id() == Point(x=1, y=1, z=1, _units=Units.mm).get_id()
assert brep.Vertices[1].get_id() == Point(x=2, y=2, z=2, _units=Units.mm).get_id()
assert brep.Vertices[2].get_id() == Point(x=3, y=3, z=3, _units=Units.mm).get_id()
assert brep.Vertices[0].get_id() == Point(x=1, y=1, z=1, units=Units.mm).get_id()
assert brep.Vertices[1].get_id() == Point(x=2, y=2, z=2, units=Units.mm).get_id()
assert brep.Vertices[2].get_id() == Point(x=3, y=3, z=3, units=Units.mm).get_id()
def test_trims_value_serialization():