Skip to content

Commit e283f59

Browse files
committed
brep edge curve types
1 parent d5354c2 commit e283f59

File tree

1 file changed

+13
-1
lines changed
  • src/compas_rhino/geometry/brep

1 file changed

+13
-1
lines changed

src/compas_rhino/geometry/brep/edge.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
from compas_rhino.geometry import RhinoNurbsCurve
66
from compas_rhino.conversions import curve_to_compas_line
77
from compas_rhino.conversions import curve_to_compas_circle
8+
from compas_rhino.conversions import curve_to_compas_ellipse
89
from compas_rhino.conversions import line_to_rhino_curve
910
from compas_rhino.conversions import circle_to_rhino_curve
11+
from compas_rhino.conversions import ellipse_to_rhino_curve
12+
1013

1114
from .vertex import RhinoBrepVertex
1215

@@ -58,6 +61,9 @@ def data(self):
5861
elif self.is_circle:
5962
type_ = "circle"
6063
curve = curve_to_compas_circle(self._curve)
64+
elif self.is_ellipse:
65+
type_ = "ellipse"
66+
curve = curve_to_compas_ellipse(self._curve)
6167
else:
6268
type_ = "nurbs"
6369
curve = RhinoNurbsCurve.from_rhino(self._curve)
@@ -78,9 +84,11 @@ def data(self, value):
7884
self._curve = circle_to_rhino_curve(
7985
Circle.from_data(value["value"])
8086
) # this returns a Nurbs Curve, why?
87+
elif curve_type == "ellipse":
88+
self._curve = ellipse_to_rhino_curve(value["value"])
8189
else:
8290
self._curve = RhinoNurbsCurve.from_data(value["value"]).rhino_curve
83-
# TODO: can a single edge be defined with more than start and end vertices?
91+
8492
self._start_vertex, self._end_vertex = RhinoBrepVertex(), RhinoBrepVertex()
8593
self._start_vertex._point = Point.from_data(value["points"][0])
8694
self._end_vertex._point = Point.from_data(value["points"][1])
@@ -112,3 +120,7 @@ def is_circle(self):
112120
@property
113121
def is_line(self):
114122
return self._curve.IsLinear()
123+
124+
@property
125+
def is_ellipse(self):
126+
return self._curve.IsEllipse()

0 commit comments

Comments
 (0)