-
0
1
1
- 634222351391468195
-
0
7
30
- true
- true
- 1a44ba0a-f1a9-41e8-bf69-2098fb3831b6
-
100;150;0;0
-
100;0;120;0
- Shaded
- unroll test_rhinocommon convert_b.ghx
- 634220460255166766
- 0
-
-2214
-1379
- 1.953125
- 0
- 4
- 57da07bd-ecab-415d-9d86-af36d7073abc
- Number Slider
- div_num
- d4fbe891-a247-4227-a795-f509e20c79c0
- false
- true
- true
- 0
-
1198
779
156
20
-
1198
779
55
20
-
1198.04
779.0681
- false
- 4
- 4
- 100
- 4
- 1
- 1e9e08fc-c31e-49eb-a36c-90de5e62e5f5
- VB Script
- Dim arrPts(inBrep.Count()-1,numParts*2 + 2) As Rhino.Geometry.Point3d
Dim polyCrvList As New List (Of rhino.geometry.curve)
Dim tol As Double = rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance
Dim xDist As Double = 0
Dim yDist As Double = 0
Dim rotParam As Double = 1 'from the old script
'Extract brep face and re-parameterize
For i As Integer = 0 To inBrep.Count() - 1
Dim nSrf As rhino.Geometry.brepface
nSrf = inBrep(i).faces(0)
Dim srfPts As New List (Of rhino.geometry.point3d)
Dim int_u As New rhino.geometry.Interval(0, 1)
Dim int_v As New rhino.geometry.Interval(0, numParts)
nSrf.SetDomain(0, int_u)
nSrf.SetDomain(1, int_v)
'Create edge division points
For j As Integer = 0 To numParts
srfPts.Add(nSrf.PointAt(0, j))
srfPts.Add(nSrf.PointAt(1, j))
Next
Dim vList As New List(Of rhino.geometry.vector3d)
Dim a1List As New List(Of rhino.geometry.vector3d)
Dim a2List As New List(Of rhino.geometry.vector3d)
Dim xList As New List(Of rhino.geometry.vector3d)
'Create vectors
Call vecFN(srfPts, vList, a1List, a2List, xList)
'Get angles difference between neighboring vectors (describes surface curvature)
Dim rotList As New List(Of Double)
rotFN(xList, a1List, rotList)
'Rotate the vectors so that they're all parallel to each other (?)
Dim ptList As New list(Of rhino.geometry.Point3d)
rotVecFN(vList, a1List, rotList, srfPts, ptList, rotParam)
'Move to ground and rotate
moveFN(srfPts, a2List(0), vList(0), i, v_div, spacing, xDist, yDist, rotParam)
copyPoints(srfPts, arrPts, i)
createOutlineFN(srfPts, polyCrvList, tol)
Next
A = arrPts
B = polyCrvList
-
'<Custom additional code>
Sub vecFN(ByRef srfPts As List (Of rhino.geometry.point3d), ByRef vList As List(Of rhino.geometry.vector3d), ByRef a1List As List(Of rhino.geometry.vector3d), ByRef a2List As List(Of rhino.geometry.vector3d), ByRef xList As List(Of rhino.geometry.vector3d))
For i As Integer = 0 To srfPts.Count() - 3
'Create structural vectors
Dim vec As New rhino.geometry.vector3d()
vec = srfPts(i + 2) - srfPts(i)
vList.Add(vec)
Dim a1 As New rhino.geometry.vector3d()
a1 = srfPts(i + 1) - srfPts(i + 2)
a1List.Add(a1)
Dim a2 As New rhino.geometry.vector3d()
a2 = srfPts(i + 1) - srfPts(i)
a2List.Add(a2)
'Create normal vector at each edge division point
Dim x As New rhino.geometry.vector3d()
x = rhino.Geometry.Vector3d.CrossProduct(a1, a2)
x.Unitize()
xList.Add(x)
If (i Mod 2 = 0) Then
a1.Reverse()
x.Reverse()
End If
Next
End Sub
Sub rotFN(ByRef xList As List(Of rhino.geometry.vector3d), ByRef a1List As List(Of rhino.geometry.vector3d), ByRef rotList As List(Of Double))
For i As Integer = 0 To xList.Count() - 2
'Get angle between two normal vectors
Dim dot As Double = vectordotproduct(xList(i), xList(i + 1))
If (dot < -1.0) Then dot = -1.0
If (dot > 1.0) Then dot = 1.0
Dim angle As Double = Math.Acos(dot)
'Test angle to determine ..... what?
Dim testVec As New rhino.geometry.vector3d(xList(i).x, xList(i).y, xList(i).z)
' testVec.x = xList(i).x ' why not say: testVec = xList(i)?... oh, they need to be duplicates... so use the vec constructor
'testVec.y = xList(i).y
'testVec.z = xList(i).z
testVec.Rotate(angle, a1List(i))
If (testVec.IsPArallelTo(xList(i + 1))) Then
angle = -angle
End If
rotList.Add(angle)
Next
End Sub
Sub rotVecFN(ByRef vList As List(Of rhino.geometry.vector3d), ByRef a1List As List(Of rhino.geometry.vector3d), ByRef rotList As List(Of Double), ByRef srfPts As List(Of rhino.geometry.point3d), ByRef ptList As list (Of rhino.geometry.point3d), ByRef rotParam As Double)
Dim nP As Integer = vList.Count() - 1
For i As Integer = nP To 1 Step -1
For j As Integer = i To 1 Step -1
srfPts(i + 2).transform(rhino.Geometry.Transform.Rotation(rotList(j - 1) * rotParam, a1List(j - 1), srfPts(j + 1)))
Next
Next
End Sub
Sub moveFN (ByRef srfPts As List (Of rhino.geometry.point3d), ByVal axisX As rhino.geometry.vector3d, ByVal axisY As rhino.geometry.vector3d, ByVal ii As Integer, ByVal v_div As Integer, ByVal spacing As list(Of Double), ByRef xDist As Double, ByRef yDist As Double, ByRef rotParam As Double)
Dim pt As New rhino.geometry.point3d(0, 0, 0)
'Move the surface to the origin
Dim moveVec As New rhino.geometry.vector3d()
moveVec = pt - srfPts(0)
moveVec = moveVec * rotParam
Dim zVec As rhino.Geometry.Vector2d
If(axisX.IsParallelTo(rhino.Geometry.Vector3d.ZAxis)) Then
zVec.x = axisY.x
zVec.y = axisY.y
Else
zVec.x = axisX.x
zVec.y = axisX.y
End If
Dim rotZ As Double = -Math.Atan(zVec.y / zVec.x)
If (zVec.x < 0) Then
Else
rotZ = rotZ + Math.PI
End If
axisX.Rotate(rotZ, rhino.Geometry.Vector3d.ZAxis)
Dim rotX As Double = Math.Atan(axisX.z / axisX.x)
If (axisX.z > 0) Then
rotX = rotX + Math.PI
End If
axisY.Rotate(rotZ, rhino.Geometry.Vector3d.ZAxis)
axisY.Rotate(rotX, rhino.Geometry.Vector3d.YAxis)
Dim rotY As Double = -Math.Atan(axisY.z / axisY.y)
If (axisY.y < 0) Then
rotY = rotY + Math.PI
End If
Dim minX As Double = Double.MaxValue
Dim maxX As Double = Double.MinValue
For i As Integer = 0 To srfPts.Count() - 1
srfPts(i) = srfPts(i) + moveVec
srfPts(i).transform(rhino.Geometry.Transform.Rotation(rotZ * rotParam, rhino.Geometry.Vector3d.ZAxis, pt))
srfPts(i).transform(rhino.Geometry.Transform.Rotation(rotX * rotParam, rhino.Geometry.Vector3d.YAxis, pt))
srfPts(i).transform(rhino.Geometry.Transform.Rotation(rotY * rotParam, rhino.Geometry.Vector3d.XAxis, pt))
If (rotParam = 1.0)
srfPts(i) = New rhino.geometry.Point3d(srfPts(i).x, srfPts(i).y, 0)
End If
If (srfPts(i).x < minX) Then
minX = srfPts(i).x
Else
If (srfPts(i).x > maxX) Then
maxX = srfPts(i).x
End If
End If
Next
xDist = (xDist + Math.Abs(minX)) * rotParam + spacing(0)
Dim moveNewVec As New rhino.geometry.vector3d(xDist, yDist, 0)
For i As Integer = 0 To srfPts.Count() - 1
srfPts(i) = srfPts(i) + moveNewVec
Next
xDist = xDist + maxX
If (ii + 1) Mod v_div = 0 And ii > 0 Then
xDist = 0
yDist += spacing(1)
End If
End Sub
Sub copyPoints(ByRef srfPts As List (Of rhino.geometry.point3d), ByRef arrPts(,) As rhino.geometry.point3d, ByRef i As Integer)
For j As Integer = 0 To srfPts.Count() - 1
arrPts(i, j) = srfPts(j)
Next
End Sub
Sub createOutlineFN(ByRef srfPts As List (Of rhino.geometry.point3d), ByRef polyCrvList As List (Of rhino.geometry.curve), ByRef tol As Double)
Dim count As Double = srfPts.Count() - 1
Dim crvList As New List (Of rhino.geometry.curve)
For i As Integer = 0 To 1
Dim nCrv As rhino.geometry.curve
Dim pList As New List (Of rhino.geometry.point3d)
For j As Integer = i To count Step 2
pList.Add(srfPts(j))
Next
nCrv = rhino.geometry.Curve.CreateControlPointCurve(pList, 2)
crvList.Add(nCrv)
polyCrvList.Add(nCrv)
Next
For i As Integer = 0 To count Step count - 1
Dim lCrv_ptlist As New list(Of Rhino.geometry.Point3d)
lCrv_ptlist.add(srfPts(i))
lCrv_ptlist.add(srfPts(i + 1))
Dim lCrv As rhino.geometry.curve = rhino.geometry.Curve.CreateControlPointCurve(lCrv_ptlist, 1)
crvList.Add(lCrv)
polyCrvList.Add(lCrv)
Next
'Dim outCrvs(0) As OnCurve
'OnUtil.ON_JoinCurves(crvList.ToArray(), outCrvs, tol)
'polyCrvList.Add(outCrvs(0))
End Sub
Function vectordotproduct(ByVal a As rhino.geometry.vector3d, ByVal b As rhino.geometry.vector3d) As Double
vectordotproduct = a.X * b.X + a.Y * b.Y + a.Z * b.Z
End Function
- 0
- VB
- 60561bea-8257-425e-995a-bc9b6fb30490
- true
- true
- true
- longest_list
-
1403
766
110
84
-
1462
768
24
80
-
1474
808
- false
- 4
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable inBrep
- Script Variable inBrep
- 1
- true
- true
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable numParts
- Script Variable numParts
- true
- true
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable v_div
- Script Variable v_div
- true
- true
- 84fa917c-1ed8-4db3-8be1-7bdc4a6495a2
- Variable spacing
- Script Variable spacing
- 1
- true
- true
- 3
- 3ede854e-c753-40eb-84cb-b48008f14fd4
- Output
- Print, Reflect and Error streams
- true
- false
- 8ec86459-bf01-4409-baee-174d0d2b13d0
- Result A
- Output parameter A
- true
- false
- 8ec86459-bf01-4409-baee-174d0d2b13d0
- Result B
- Output parameter B
- true
- false
- inBrep
- 6e6d9565-579b-4a5e-bb22-389a629ad10e
- false
- true
- true
- 1
- 0
- 2ceb0405-fdfe-403d-a4d6-8786da45fb9d
- true
- true
-
1405
768
57
20
-
1405
768
57
20
-
1433.5
778
- false
- numParts
- 677ddc87-67d4-4a57-92bd-1cf09e0d112b
- false
- true
- true
- 1
- d4fbe891-a247-4227-a795-f509e20c79c0
- efe48ae7-2987-421b-a33a-1f7be1c3f050
- true
- true
-
1405
788
57
20
-
1405
788
57
20
-
1433.5
798
- false
- v_div
- d2d341f9-06e2-4896-aad3-9603a8ea8092
- false
- true
- true
- 0
- efe48ae7-2987-421b-a33a-1f7be1c3f050
- true
- true
-
1405
808
57
20
-
1405
808
57
20
-
1433.5
818
- false
- spacing
- 42c61855-6739-43fb-9fb7-3e84536180c5
- false
- true
- true
- 1
- 2
- 9fe776ec-c68f-46ea-b4ac-624bc98c2266
- ef8f7b51-dcd4-4fa2-a6a4-3baf55cfc7f8
- 8e991e99-5fb8-41e1-928d-1bba8fb9f7d7
- true
- true
-
1405
828
57
20
-
1405
828
57
20
-
1433.5
838
- false
- out
- 84b75528-3996-4628-b1db-66c926d72c42
- false
- true
- true
- 0
- 0
-
1486
768
25
26
-
1486
768
25
26
-
1498.5
781.3333
- false
- A
- 9133676f-2f51-4a8b-985c-47a20d6d46d3
- true
- true
- true
- 0
- 0
-
1486
794
25
27
-
1486
794
25
27
-
1498.5
808
- false
- B
- 495a8a8c-2f5e-42ed-9393-7463380b93f7
- true
- true
- true
- 0
- 0
-
1486
821
25
26
-
1486
821
25
26
-
1498.5
834.6666
- false
- 57da07bd-ecab-415d-9d86-af36d7073abc
- Number Slider
- x_space
- 9fe776ec-c68f-46ea-b4ac-624bc98c2266
- false
- true
- true
- 0
-
1202
832
154
20
-
1202
832
54
20
-
1202.6
832.7519
- false
- 0.142999267578125
- 0
- 1
- 3
- 0
- 57da07bd-ecab-415d-9d86-af36d7073abc
- Number Slider
- y_space
- ef8f7b51-dcd4-4fa2-a6a4-3baf55cfc7f8
- false
- true
- true
- 0
-
1202
852
154
20
-
1202
852
54
20
-
1202.36
852.9919
- false
- 0.73499908447265627
- 0
- 1
- 3
- 0