def rhSingleSpanNurbsCurveToCurve(rhCurve): #get control points ptArray, weights, knots = [], [], [] rhControlPoints = rhCurve.Points for rhPoint in rhControlPoints: dsPoint = rhPointToPoint(rhPoint) ptArray.append(dsPoint) #get weights for each point weights.append(rhPoint.Weight) #convert Python list to IEnumerable[] ptArray = List[Point](ptArray) weights = Array[float](weights) #get degree of the curve degree = rhCurve.Degree #get knots of the curve rhKnots = rhCurve.Knots for i in rhKnots: knots.append(i) knots.insert(0, knots[0]) knots.insert(len(knots), knots[(len(knots) - 1)]) knots = Array[float](knots) #create ds curve from points, weights and knots dsNurbsCurve = NurbsCurve.ByControlPointsWeightsKnots( ptArray, weights, knots, degree) ptArray.Clear() Array.Clear(weights, 0, len(weights)) Array.Clear(knots, 0, len(knots)) return dsNurbsCurve
def rhMultiSpanNurbsCurveToCurve(rhCurve): dsNurbsCurve, rhSubCurve = [], [] spanCount = rhCurve.SpanCount for i in range(0, spanCount, 1): rhCurveSubdomain = rhCurve.SpanDomain(i) rhSubCurve.append(rhCurve.ToNurbsCurve(rhCurveSubdomain)) for curve in rhSubCurve: #get control points ptArray, weights, knots = [], [], [] rhControlPoints = curve.Points for rhPoint in rhControlPoints: dsPoint = rhPointToPoint(rhPoint) ptArray.append(dsPoint) #get weights for each point weights.append(rhPoint.Weight) #convert Python list to IEnumerable[] ptArray = List[Point](ptArray) weights = Array[float](weights) #get degree of the curve degree = curve.Degree #get knots of the curve rhKnots = curve.Knots for i in rhKnots: knots.append(i) knots.insert(0, knots[0]) knots.insert(len(knots), knots[(len(knots)-1)]) knots = Array[float](knots) #create ds curve from points, weights and knots dsNurbsCurve.append(NurbsCurve.ByControlPointsWeightsKnots(ptArray, weights, knots, degree)) ptArray.Clear() Array.Clear(weights, 0, len(weights)) Array.Clear(knots, 0, len(knots)) return dsNurbsCurve del dsNurbsCurve[:]