@@ -95,9 +95,6 @@ def AddBlendCurve(curves, parameters, reverses, continuities):
95
95
rc = gh .Curve ('<Curve>' ,'AddBlendCurve' , curves , parameters , reverses , continuities , '</Curve>' )
96
96
return rc
97
97
98
- cc = AddBlendCurve ([gh .Curve (), gh .Curve ()],[1.3 , 4.5 ], [True , False ], [1 , 0 ])
99
- print cc
100
-
101
98
102
99
def AddCircle (plane_or_center , radius ):
103
100
"""Adds a circle curve to the document
@@ -109,8 +106,13 @@ def AddCircle(plane_or_center, radius):
109
106
Returns:
110
107
id of the new curve object
111
108
"""
112
-
113
- return rc
109
+ if not isinstance (plane_or_center , gh .Plane ) or not isinstance (plane_or_center , gh .Point ):
110
+ raise Exception ("plane_or_center should be an instance of Plane" )
111
+ elif not isinstance (radius , float ):
112
+ raise Exception ("radius should be an instance of float" )
113
+ else :
114
+ rc = gh .Curve ('<Curve>' ,'AddCircle' , plane_or_center , radius ,'</Curve>' )
115
+ return rc
114
116
115
117
116
118
def AddCircle3Pt (first , second , third ):
@@ -120,8 +122,15 @@ def AddCircle3Pt(first, second, third):
120
122
Returns:
121
123
id of the new curve object
122
124
"""
123
-
124
- return rc
125
+ if not (isinstance (first , gh .Point )):
126
+ raise Exception ("first should be an instance of a Point" )
127
+ elif not isinstance (second , gh .Point ):
128
+ raise Exception ("second should be an instance of a Point" )
129
+ elif not isinstance (third , gh .Point ):
130
+ raise Exception ("third should be an instance of a Point" )
131
+ else :
132
+ rc = gh .Curve ('<Curve>' ,'AddCircle3Pt' , first , second , third , '</Curve>' )
133
+ return rc
125
134
126
135
127
136
def AddCurve (points , degree = 3 ):
@@ -132,8 +141,16 @@ def AddCurve(points, degree=3):
132
141
Returns:
133
142
id of the new curve object
134
143
"""
135
-
136
- return rc
144
+ if not isinstance (points , list ) or not len (points )> 1 :
145
+ raise Exception ("points should be a list of more than one point" )
146
+ elif not isinstance (degree , int ):
147
+ raise Exception ("degree should be an int representing the degree of the curve" )
148
+ else :
149
+ for i in points :
150
+ if not isinstance (i , gh .Point ):
151
+ raise Exception ("points should be list of points" )
152
+ rc = gh .Curve ('<Curve>' ,'AddCurve' , points , degree , '</Curve>' )
153
+ return rc
137
154
138
155
139
156
def AddEllipse (plane , radiusX , radiusY ):
@@ -145,8 +162,14 @@ def AddEllipse(plane, radiusX, radiusY):
145
162
Returns:
146
163
id of the new curve object if successful
147
164
"""
165
+ if not isinstance (plane , gh .Plane ):
166
+ raise Exception ("plane should be an instance of Plane" )
167
+ elif not isinstance (radiusX , float ) or not isinstance (radiusY , float ):
168
+ raise Exception ("radiusX, radiusY should be floats representing radius in the X and Y axis directions" )
169
+ else :
170
+ rc = gh .Curve ('<Curve>' ,'AddEllipse' , plane , radiusX , radiusY , '</Curve>' )
171
+ return rc
148
172
149
- return rc
150
173
151
174
152
175
def AddEllipse3Pt (center , second , third ):
@@ -158,8 +181,11 @@ def AddEllipse3Pt(center, second, third):
158
181
Returns:
159
182
id of the new curve object if successful
160
183
"""
161
-
162
- return rc
184
+ if not isinstance (center , gh .Point )or not isinstance (second , gh .Point ) or not isinstance (third , gh .Point ):
185
+ raise Exception ("center, second and third should be instances of gh.Point" )
186
+ else :
187
+ rc = gh .Curve ('<Curve>' ,'AddEllipse3Pt' , center , second , third , '</Curve>' )
188
+ return rc
163
189
164
190
165
191
def AddFilletCurve (curve0id , curve1id , radius = 1.0 , base_point0 = None , base_point1 = None ):
0 commit comments