本帖最后由 多吃水果蔬菜 于 2018-7-21 11:56 编辑
2# 1235813
如下是我的脚本及运算器!
(出错部位已用红色字体标记)
Private Sub RunScript(ByVal ptSetA As List(Of Point3d), ByVal ptSetB As List(Of Point3d), ByVal divU As Integer, ByVal divV As Integer, ByRef A As Object, ByRef B As Object)
'your code goes here…
Dim n As Integer = 0
Dim ptListA As New List(Of List(Of point3d))
Dim ptListB As New List(Of List(Of point3d))
For i As Integer=0 To divU
Dim ptrowA As New List(Of point3d)
Dim ptrowB As New List(Of point3d)
For j As Integer=0 To divV
Dim ptA As New point3d(ptrowA(n))
Dim ptB As New point3d(ptrowB(n))
ptRowA.Add(ptA)
ptRowB.Add(ptB)
n = n + 1
Next
ptListA.Add(ptRowA)
ptListB.Add(ptRowB)
Next
For i As Integer = 0 To divU - 1 Step 2
For j As Integer = 0 To divV - 1 Step 1
Dim pt01A As New point3d((ptListA(i)(j) + ptListA(i)(j + 1)) / 2)
Dim pt02A As New point3d((ptListA(i + 1)(j) + ptListB(i + 1)(j)) / 2)
Dim pt03A As New point3d((ptListA(i + 2)(j) + ptListA(i + 2)(j + 1)) / 2)
Dim pt04A As New point3d((ptListA(i + 1)(j) + ptListA(i + 1)(j + 1)) / 2)
Dim dis01A As Double = pt01A.DistanceTo(pt04A)
Dim dis02A As Double = pt03A.DistanceTo(pt04A)
Dim vt01A As New Vector3d((pt04A - pt01A) / dis01A)
Dim vt02A As New Vector3d((pt03A - pt04A) / dis02A)
Dim pt01B As New point3d((ptListB(i)(j) + ptListB(i)(j + 1)) / 2)
Dim pt02B As New point3d((ptListA(i + 1)(j + 1) + ptListB(i + 1)(j + 1)) / 2)
Dim pt03B As New point3d((ptListB(i + 2)(j) + ptListB(i + 2)(j + 1)) / 2)
Dim pt04B As New point3d((ptListB(i + 1)(j) + ptListB(i + 1)(j + 1)) / 2)
Dim dis01B As Double = pt01B.DistanceTo(pt04B)
Dim dis02B As Double = pt03B.DistanceTo(pt04B)
Dim vt01B As New Vector3d((pt04B - pt01B) / dis01B)
Dim vt02B As New Vector3d((pt03B - pt04B) / dis02B)
Dim ptArrA As New pointArray3d()
ptArrA.Append(pt01A)
ptArrA.Append(pt02A)
ptArrA.Append(pt03A)
Dim intcvA As New onNurbscurve()
intcvA = rhutil.RhinoInterpCurve(3, ptArrA, vt01A, vt02A, Nothing)
intcvListA.Add(intcvA)
Dim ptArrB As New on3dPointArray()
ptArrB.Append(pt01B)
ptArrB.Append(pt02B)
ptArrB.Append(pt03B)
Dim intcvB As New onNurbscurve()
intcvB = rhutil.RhinoInterpCurve(3, ptArrB, vt01B, vt02B, Nothing)
intcvListB.Add(intcvB)
Next
Next
A = intcvListA
B = intcvListB
End Sub
|