55from compas_rhino .geometry import RhinoNurbsCurve
66from compas_rhino .conversions import curve_to_compas_line
77from compas_rhino .conversions import curve_to_compas_circle
8+ from compas_rhino .conversions import curve_to_compas_ellipse
89from compas_rhino .conversions import line_to_rhino_curve
910from compas_rhino .conversions import circle_to_rhino_curve
11+ from compas_rhino .conversions import ellipse_to_rhino_curve
12+
1013
1114from .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