@@ -47,8 +47,15 @@ def AddArcPtTanPt(start, direction, end):
47
47
Returns:
48
48
id of the new curve object
49
49
"""
50
-
51
- return rc
50
+ if not (isinstance (start , gh .Point )):
51
+ raise Exception ("start should be an instance of a gh.Point" )
52
+ elif not isinstance (end , gh .Point ):
53
+ raise Exception ("end should be an instance of a gh.Point" )
54
+ elif not isinstance (direction , gh .Vector ):
55
+ raise Exception ("direction should be an instance of a gh.Vector" )
56
+ else :
57
+ rc = gh .Curve ('<Curve>' ,'AddArcPtTanPt' , start , direction , end , '</Curve>' )
58
+ return rc
52
59
53
60
54
61
def AddBlendCurve (curves , parameters , reverses , continuities ):
@@ -62,8 +69,34 @@ def AddBlendCurve(curves, parameters, reverses, continuities):
62
69
Returns:
63
70
identifier of new curve on success
64
71
"""
72
+ if not isinstance (curves , list ) \
73
+ or len (curves ) != 2 \
74
+ or not isinstance (curves [0 ], gh .Curve ) \
75
+ or not isinstance (curves [1 ], gh .Curve ):
76
+ raise Exception ("curves should be a list of two curves" )
77
+ elif not isinstance (parameters , list ) \
78
+ or len (parameters )!= 2 \
79
+ or not isinstance (parameters [0 ], float ) \
80
+ or not isinstance (parameters [1 ], float ):
81
+ raise Exception ("parameters should be a list of two floats defining the blend end points " )
82
+ elif not isinstance (reverses , list ) \
83
+ or len (reverses )!= 2 \
84
+ or not isinstance (reverses [0 ], bool ) \
85
+ or not isinstance (reverses [1 ], bool ):
86
+ raise Exception ("reverses should be a list of two boolean values specifying to use the natural or opposite direction of the curve" )
87
+ elif not isinstance (continuities , list ) \
88
+ or len (continuities )!= 2 \
89
+ or not isinstance (continuities [0 ],int ) \
90
+ or not isinstance (continuities [1 ], int )\
91
+ or continuities [0 ]> 2 or continuities [1 ]> 2 \
92
+ or continuities [0 ]< 0 or continuities [1 ]< 0 :
93
+ raise Exception ("continuities should be a list of two numbers specifying continuity at end points 0 = position, 1 = tangency, 2 = curvature" )
94
+ else :
95
+ rc = gh .Curve ('<Curve>' ,'AddBlendCurve' , curves , parameters , reverses , continuities , '</Curve>' )
96
+ return rc
65
97
66
- return rc
98
+ cc = AddBlendCurve ([gh .Curve (), gh .Curve ()],[1.3 , 4.5 ], [True , False ], [1 , 0 ])
99
+ print cc
67
100
68
101
69
102
def AddCircle (plane_or_center , radius ):
0 commit comments