Skip to content

Commit 1cb4f41

Browse files
author
Robin Oval
committed
rhino curve length and is_closed
1 parent 962842b commit 1cb4f41

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/compas_rhino/geometry/curve.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ def from_selection(cls):
6565
guid = compas_rhino.select_curve()
6666
return cls(guid)
6767

68+
def length(self):
69+
"""Return the length of the curve.
70+
71+
Returns
72+
-------
73+
float
74+
The curve's length.
75+
76+
"""
77+
return rs.CurveLength(self.guid)
78+
6879
def is_line(self):
6980
"""Determine if the curve is a line.
7081
@@ -101,6 +112,18 @@ def is_polyline(self):
101112
rs.CurveDegree(self.guid) == 1 and
102113
len(rs.CurvePoints(self.guid)) > 2)
103114

115+
def is_closed(self):
116+
"""Assess if the curve is closed.
117+
118+
Returns
119+
-------
120+
bool
121+
True if the curve is closed. False otherwise.
122+
123+
"""
124+
125+
return rs.IsCurveClosed(self.guid)
126+
104127
def control_points(self):
105128
"""Get the control points of a curve.
106129

0 commit comments

Comments
 (0)