|
我看了help可以直接用。
Sub CSX()
Const rhObjectCurve = 4
Const rhObjectSurface = 8
Dim strCurve, strSurface, arrCSX
strCurve = Rhino.GetObject("Select curve", rhObjectCurve)
If IsNull(strCurve) Or Rhino.IsCurve(strCurve) = False Then Exit Sub
strSurface = Rhino.GetObject("Select surface", rhObjectSurface)
If IsNull(strSurface) Or Rhino.IsSurface(strSurface) = False Then Exit Sub
arrCSX = Rhino.CurveSurfaceIntersection(strCurve, strSurface)
If Not IsArray(arrCSX) Then
Rhino.Print "Curve and surface do not intersect."
Exit Sub
End If
For i = 0 To UBound(arrCSX)
If arrCSX(i,0) = 1 Then
Rhino.Print "Point"
Rhino.Print "Intersection point on curve: " & Rhino.Pt2Str(arrCSX(i,1))
Rhino.Print "Intersection point on surface: " & Rhino.Pt2Str(arrCSX(i,3))
Rhino.Print "Curve parameter: " & CStr(arrCSX(i,5))
Rhino.Print "Surface parameter: " & CStr(arrCSX(i,7)) & "," & CStr(arrCSX(i,8))
Else
Rhino.Print "Overlap"
Rhino.Print "Intersection start point on curve: " & Rhino.Pt2Str(arrCSX(i,1))
Rhino.Print "Intersection end point on curve: " & Rhino.Pt2Str(arrCSX(i,2))
Rhino.Print "Intersection start point on surface: " & Rhino.Pt2Str(arrCSX(i,3))
Rhino.Print "Intersection end point on surface: " & Rhino.Pt2Str(arrCSX(i,4))
Rhino.Print "Curve parameter range: " & CStr(arrCSX(i,5)) & " to " & CStr(arrCSX(i,6))
Rhino.Print "Surface parameter range: " & CStr(arrCSX(i,7)) & "," & CStr(arrCSX(i,8)) & " to " & CStr(arrCSX(i,9)) & "," & CStr(arrCSX(i,10))
End If
Next
End Sub |
|