
More images can be found at:
computational explorations
A general post for people that do not know Grasshopper that well: this is a simple example of re-ordering lists by paths. By using a series of a series you can create an index list that steps by the number of paths that steps by the number of items in each path. Confusing in the description, but it is easier to understand in the image. This example, of course, works for only paths that have the same number of items!

Sorry for the delay and the lack of posts. A lot has been going on in my personal life (deaths, Getting Married!, Honey Moon!, work, etc). I have been doing some research at work so look for some posts/examples/tutorials coming soon on Grasshopper and more Paneling Tools!
————————————————————————————————
————————————————————————————————
————————————————————————————————
Panel 4 Custom 2D Patterns Script:
Option Explicit
‘Script written by Michael McCune
‘Script originated on http://mccunication.wordpress.com/
‘This script takes a grid of points generated from Paneling Tools and places 4 custom 2d Patterns on the grid of points.
‘The distance to the closest attractor point determines which pattern is appropriate. To add more patterns, simply
‘ copy a new arrPatternX and add an IF/Then statement.
Call paneltls_4customPats()
Sub paneltls_4customPats()
‘Select points
arrPoints = Rhino.GetObjects(“Select grid of paneling points”, 1)
‘Select pattern
arrPattern1 = Rhino.GetObjects(“Select 1st custom pattern curves and points”, 1+4)
arrPattern2 = Rhino.GetObjects(“Select 2nd custom pattern curves and points”, 1+4)
arrPattern3 = Rhino.GetObjects(“Select 3rd custom pattern curves and points”, 1+4)
arrPattern4 = Rhino.GetObjects(“Select 4th custom pattern curves and points”, 1+4)
dblMax = Rhino.GetReal(“What is the max distance to be affected”, 15)
dblMin = Rhino.GetReal(“What is the min distance to be affected”, 5)
‘Select Attractors
arrAttractors = Rhino.GetObjects(“Select attractor points”, 1)
Dim arrPoints, arrCrvs,arrAttractors,arrNewCrvs,arrPattern1,arrPattern2,arrPattern3,arrPattern4,dblMid,dblMax,dblMin,dblMid2
Dim arrAttractorxyz,dblDistance,dblShortestDistance,dblFactor,arrCustomPattern,arrINDPoint1xyz,arrINDPoint2xyz,arrINDPoint3xyz,arrINDPoint4xyz
Dim PTObj
Dim dblMidPt1x,dblMidPt1y, dblMidPt1z,dblMidPt2x,dblMidPt2y,dblMidPt2z,dblSrfCentroidx,dblSrfCentroidy,dblSrfCentroidz,arrSrfCentroid
Dim i,j,k
Const intUSpacing = 1
Const intVSpacing = 1
On Error Resume Next
‘Get PanelingTools Object
Set PTObj = Rhino.GetPluginObject(“PanelingTools”)
If Err Then
MsgBox Err.Description
Exit Sub
End If
dblMid = ((dblMax + dblMin)/2)
dblMid2 = ((dblMax + dblMid)/2)
If IsArray(arrPoints) Then
For i = 0 To 150
For j = 0 To 15
object_name0 = “S0(” & CStr(i) & “)(” & CStr(j) & “)”
object_name1 = “S0(” & CStr(i+1) & “)(” & CStr(j) & “)”
object_name2 = “S0(” & CStr(i+1) & “)(” & CStr(j+1) & “)”
object_name3 = “S0(” & CStr(i) & “)(” & CStr(j+1) & “)”
object_list0 = Rhino.ObjectsByName(object_name0)
object_list1 = Rhino.ObjectsByName(object_name1)
object_list2 = Rhino.ObjectsByName(object_name2)
object_list3 = Rhino.ObjectsByName(object_name3)
arrINDPoints = array(object_list0(0),object_list1(0),object_list2(0),object_list3(0))
arrINDPoint1xyz =Rhino.PointCoordinates(object_list0(0))
arrINDPoint2xyz =Rhino.PointCoordinates(object_list1(0))
arrINDPoint3xyz =Rhino.PointCoordinates(object_list2(0))
arrINDPoint4xyz =Rhino.PointCoordinates(object_list3(0))
‘Get centroid of the four surface pts
dblMidPt1x = ((arrINDPoint1xyz(0) + arrINDPoint3xyz(0))/2)
dblMidPt1y = ((arrINDPoint1xyz(1) + arrINDPoint3xyz(1))/2)
dblMidPt1z = ((arrINDPoint1xyz(2) + arrINDPoint3xyz(2))/2)
dblMidPt2x = ((arrINDPoint2xyz(0) + arrINDPoint4xyz(0))/2)
dblMidPt2y = ((arrINDPoint2xyz(1) + arrINDPoint4xyz(1))/2)
dblMidPt2z = ((arrINDPoint2xyz(2) + arrINDPoint4xyz(2))/2)
dblSrfCentroidx = ((dblMidPt1x + dblMidPt2x) /2)
dblSrfCentroidy = ((dblMidPt1y + dblMidPt2y) /2)
dblSrfCentroidz = ((dblMidPt1z + dblMidPt2z) /2)
arrSrfCentroid = array( dblSrfCentroidx,dblSrfCentroidy,dblSrfCentroidz)
dblShortestDistance = 9999900
‘loop through attractors
For k = 0 To Ubound(arrAttractors)
‘get xyz of attractor
arrAttractorxyz = Rhino.PointCoordinates(arrAttractors(k))
dblDistance = Rhino.Distance(arrAttractorxyz,arrSrfCentroid)
‘Call Rhino.Print(dblDistance)
If dblDistance < dblShortestDistance Then
dblShortestDistance = dblDistance
End If
Call Rhino.Print(dblShortestDistance)
Next
‘panel 1
If dblShortestDistance > dblMax Then
‘Call rhino.RotateObjects(arrPattern2,,dblangle)
arrCrvs(i)(j) = PTObj.PanelCustomWithOrderedPoints(arrINDPoints, arrPattern1, intUSpacing, intVSpacing)
End If
‘panel 2
If dblShortestDistance < dblMax Then
If dblShortestDistance > dblMid2 Then
arrCrvs(i)(j) = PTObj.PanelCustomWithOrderedPoints(arrINDPoints, arrPattern2, intUSpacing, intVSpacing)
End If
End If
‘panel 3
If dblShortestDistance > dblMin Then
If dblShortestDistance < dblMid2 Then
arrCrvs(i)(j) = PTObj.PanelCustomWithOrderedPoints(arrINDPoints, arrPattern3, intUSpacing, intVSpacing)
End If
End If
‘panel 4
If dblShortestDistance < dblMin Then
arrCrvs(i)(j) = PTObj.PanelCustomWithOrderedPoints(arrINDPoints, arrPattern4, intUSpacing, intVSpacing)
End If
Next
Next
End If
Set PTObj = Nothing
End Sub
)
————————————————————————————————
————————————————————————————————
————————————————————————————————
————————————————————————————————
Panel 4 Custom 3d Components Script:
Option Explicit
‘Script written by Michael McCune
‘Script originated on http://mccunication.wordpress.com/
‘This script needs three surfaces. A “top” surface as a finish face, a “bottom” surface as a back face, and a “driver” surface.
‘The top and bottom surfaces work better if they are similar. The “driver” surfaces works like a visual graph.
‘It is easier to interpret the driver surface if it is similar to the top and/or bottom surfaces. It simply uses the heights of the surface for each corresponding panel
‘ to determine which component to apply. The higher the surface is at that corresponding parameter the higher the number pattern.
‘This script should work on any component type.
Call paneltls_4custompanels3dSurfaceDriver()
Sub paneltls_4custompanels3dSurfaceDriver()
‘variables
Dim arrAttractorxyz,dblDistance,dblShortestDistance,dblFactor,arrCustomPattern,arrINDBottomPoint1xyz,arrINDBottomPoint2xyz,arrINDBottomPoint3xyz,arrINDBottomPoint4xyz,strBottomName0,strBottomName1,strBottomName2,strBottomName3,strBottomPt0,strBottomPt1,strBottomPt2,strBottomPt3
Dim arrINDTopPoint1xyz,arrINDTopPoint2xyz,arrINDTopPoint3xyz,arrINDTopPoint4xyz,strTopName0,strTopName1,strTopName2,strTopName3,strTopPt0,strTopPt1,strTopPt2,strTopPt3
Dim arrINDDriverPoint1xyz,arrINDDriverPoint2xyz,arrINDDriverPoint3xyz,arrINDDriverPoint4xyz,strDriverName0,strDriverName1,strDriverName2,strDriverName3,strDriverPt0,strDriverPt1,strDriverPt2,strDriverPt3
Dim arrPanels
Dim PTObj
Dim arrSrfCentroid, dblSrfCentroidx,dblSrfCentroidy,dblSrfCentroidz
Dim dblBottomMidPt1x,dblBottomMidPt1y, dblBottomMidPt1z,dblBottomMidPt2x,dblBottomMidPt2y,dblBottomMidPt2z,dblBottomSrfCentroidx,dblBottomSrfCentroidy,dblBottomSrfCentroidz,arrBottomSrfCentroid,strGroup
Dim dblTopMidPt1x,dblTopMidPt1y, dblTopMidPt1z,dblTopMidPt2x,dblTopMidPt2y,dblTopMidPt2z,dblTopSrfCentroidx,dblTopSrfCentroidy,dblTopSrfCentroidz,arrTopSrfCentroid
Dim dblDriverMidPt1x,dblDriverMidPt1y, dblDriverMidPt1z,dblDriverMidPt2x,dblDriverMidPt2y,dblDriverMidPt2z,dblDriverSrfCentroidx,dblDriverSrfCentroidy,dblDriverSrfCentroidz,arrDriverSrfCentroid
Dim i,j,k,l
Const intUSpacing = 1
Const intVSpacing = 1
”””””””””””””””””””””””””””””””””””””””””
‘Select pattern
Dim arrPattern1 : arrPattern1 = Rhino.GetObjects(“Select 1st custom 3d pattern/component”)
Dim arrPattern2 : arrPattern2 = Rhino.GetObjects(“Select 2nd custom 3d pattern/component”)
Dim arrPattern3 : arrPattern3 = Rhino.GetObjects(“Select 3rd custom 3d pattern/component”)
Dim arrPattern4 : arrPattern4 = Rhino.GetObjects(“Select 4th custom 3d pattern/component”)
Dim dblMax : dblMax = Rhino.GetReal(“What is the max distance of threshold?”, 5)
Dim dblNegativeMax : dblNegativeMax = dblMax – (2*dblMax)
‘Dim dblMin : dblMin = Rhino.GetReal(“What is the min distance”, 5)
”””””””””””””””””””””””””””””””””””””””””’
On Error Resume Next
‘Get PanelingTools Plugin!!
Set PTObj = Rhino.GetPluginObject(“PanelingTools”)
If Err Then
MsgBox Err.Description
Exit Sub
End If
”””””””””””””””””””””””””””””””””””””””””’
‘get surfaces and divisions
Dim strBottomSrfObject : strBottomSrfObject = Rhino.GetObject(“Select bottom surface to grid”,24)
Dim strTopSrfObject : strTopSrfObject = Rhino.GetObject(“Select top surface to grid”,24)
Dim strDriverSrfObject : strDriverSrfObject = Rhino.GetObject(“Select driver Surface”,24)
Dim intUNum : intUNum = Rhino.GetReal(“How many divisions in the U direction?”,15)
Dim intVNum : intVNum = Rhino.GetReal(“How many divisions in the V direction?”,150)
”””””””””””””””””””””””””””””””””””””””””’
‘generate points
Dim strcmd1 : strcmd1 = “ungroup”
Dim strGridName1 : strGridName1 = “Bottom”
Dim strGridName2 : strGridName2 = “Top”
Dim strGridName3 : strGridName3 = “Driver”
Dim arrBottomGrid : arrBottomGrid = GridByUV(strBottomSrfObject,strGridName1,intUNum,intVNum)
Call Rhino.Command(strcmd1)
Call Rhino.UnselectAllObjects
Dim arrTopGrid : arrTopGrid = GridByUV(strTopSrfObject,strGridName2,intUNum,intVNum)
Call Rhino.Command(strcmd1)
Call Rhino.UnselectAllObjects
Dim arrDriverGrid : arrDriverGrid = GridByUV(strDriverSrfObject,strGridName3,intUNum,intVNum)
Call Rhino.Command(strcmd1)
Call Rhino.UnselectAllObjects
Call rhino.EnableRedraw(False)
”””””””””””””””””””””””””””””””””””””””””’
Dim intCount : intCount = 0
Dim intLayerCount : intLayerCount = 0
k =0
‘create layer and make it current
Dim strLayer : strLayer = “Group ” & CStr(intLayerCount)
Dim strPrevLayer : strPrevLayer = “Group ” & CStr((intLayerCount)-1)
Call Rhino.DeleteLayer(strLayer)
Call Rhino.AddLayer (strLayer)
Call Rhino.CurrentLayer (strLayer)
‘loop through surfaces
‘loop through grid pts
If IsArray(arrBottomGrid) Then
For i = 0 To intVNum-1
For j = 0 To intUNum-1
‘store name in var
strBottomName0 = “Bottom(” & CStr(i) & “)(” & CStr(j) & “)”
strBottomName1 = “Bottom(” & CStr(i+1) & “)(” & CStr(j) & “)”
strBottomName2 = “Bottom(” & CStr(i+1) & “)(” & CStr(j+1) & “)”
strBottomName3 = “Bottom(” & CStr(i) & “)(” & CStr(j+1) & “)”
‘selcect 4 points by name
strBottomPt0 = Rhino.ObjectsByName(strBottomName0)
strBottomPt1 = Rhino.ObjectsByName(strBottomName1)
strBottomPt2 = Rhino.ObjectsByName(strBottomName2)
strBottomPt3 = Rhino.ObjectsByName(strBottomName3)
‘assemble 4 points in one array
arrINDBottomPoints = array(strBottomPt0(0),strBottomPt1(0),strBottomPt2(0),strBottomPt3(0))
‘create and store 4 points in one group
Dim strGroup1 : strGroup1 = “BottomGroup(” & CStr(i) & “)(” & CStr (j) & “)”
Call Rhino.DeleteGroup(strGroup1)
Call Rhino.AddGroup(strGroup1)
Call Rhino.AddObjectsToGroup (arrINDBottomPoints, strGroup1)
‘get coordinates of each point
arrINDBottomPoint1xyz =Rhino.PointCoordinates(strBottomPt0(0))
arrINDBottomPoint2xyz =Rhino.PointCoordinates(strBottomPt1(0))
arrINDBottomPoint3xyz =Rhino.PointCoordinates(strBottomPt2(0))
arrINDBottomPoint4xyz =Rhino.PointCoordinates(strBottomPt3(0))
‘Get centroid of the four surface pts
dblBottomMidPt1x = ((arrINDBottomPoint1xyz(0) + arrINDBottomPoint3xyz(0))/2)
dblBottomMidPt1y = ((arrINDBottomPoint1xyz(1) + arrINDBottomPoint3xyz(1))/2)
dblBottomMidPt1z = ((arrINDBottomPoint1xyz(2) + arrINDBottomPoint3xyz(2))/2)
dblBottomMidPt2x = ((arrINDBottomPoint2xyz(0) + arrINDBottomPoint4xyz(0))/2)
dblBottomMidPt2y = ((arrINDBottomPoint2xyz(1) + arrINDBottomPoint4xyz(1))/2)
dblBottomMidPt2z = ((arrINDBottomPoint2xyz(2) + arrINDBottomPoint4xyz(2))/2)
dblBottomSrfCentroidx = ((dblBottomMidPt1x + dblBottomMidPt2x) /2)
dblBottomSrfCentroidy = ((dblBottomMidPt1y + dblBottomMidPt2y) /2)
dblBottomSrfCentroidz = ((dblBottomMidPt1z + dblBottomMidPt2z) /2)
arrBottomSrfCentroid = array( dblBottomSrfCentroidx,dblBottomSrfCentroidy,dblBottomSrfCentroidz)
”””””””””””””””””””””””””””””””””””””’
‘store name in var
strTopName0 = “Top(” & CStr(i) & “)(” & CStr(j) & “)”
strTopName1 = “Top(” & CStr(i+1) & “)(” & CStr(j) & “)”
strTopName2 = “Top(” & CStr(i+1) & “)(” & CStr(j+1) & “)”
strTopName3 = “Top(” & CStr(i) & “)(” & CStr(j+1) & “)”
‘selcect 4 points by name
strTopPt0 = Rhino.ObjectsByName(strTopName0)
strTopPt1 = Rhino.ObjectsByName(strTopName1)
strTopPt2 = Rhino.ObjectsByName(strTopName2)
strTopPt3 = Rhino.ObjectsByName(strTopName3)
‘assemble 4 points in one array
arrINDTopPoints = array(strTopPt0(0),strTopPt1(0),strTopPt2(0),strTopPt3(0))
‘create and store 4 points in one group
Dim strGroup2 : strGroup2 = “TopGroup(” & CStr(i) & “)(” & CStr (j) & “)”
Call Rhino.DeleteGroup(strGroup2)
Call Rhino.AddGroup(strGroup2)
Call Rhino.AddObjectsToGroup (arrINDTopPoints, strGroup2)
‘get coordinates of each point
arrINDTopPoint1xyz =Rhino.PointCoordinates(strTopPt0(0))
arrINDTopPoint2xyz =Rhino.PointCoordinates(strTopPt1(0))
arrINDTopPoint3xyz =Rhino.PointCoordinates(strTopPt2(0))
arrINDTopPoint4xyz =Rhino.PointCoordinates(strTopPt3(0))
‘Get centroid of the four surface pts
dblTopMidPt1x = ((arrINDTopPoint1xyz(0) + arrINDTopPoint3xyz(0))/2)
dblTopMidPt1y = ((arrINDTopPoint1xyz(1) + arrINDTopPoint3xyz(1))/2)
dblTopMidPt1z = ((arrINDTopPoint1xyz(2) + arrINDTopPoint3xyz(2))/2)
dblTopMidPt2x = ((arrINDTopPoint2xyz(0) + arrINDTopPoint4xyz(0))/2)
dblTopMidPt2y = ((arrINDTopPoint2xyz(1) + arrINDTopPoint4xyz(1))/2)
dblTopMidPt2z = ((arrINDTopPoint2xyz(2) + arrINDTopPoint4xyz(2))/2)
dblTopSrfCentroidx = ((dblTopMidPt1x + dblTopMidPt2x) /2)
dblTopSrfCentroidy = ((dblTopMidPt1y + dblTopMidPt2y) /2)
dblTopSrfCentroidz = ((dblTopMidPt1z + dblTopMidPt2z) /2)
‘get EXACT centroid
dblSrfCentroidx = ((dblBottomSrfCentroidx + dblTopSrfCentroidx) /2)
dblSrfCentroidy = ((dblBottomSrfCentroidy + dblTopSrfCentroidy) /2)
dblSrfCentroidz = ((dblBottomSrfCentroidz + dblTopSrfCentroidz) /2)
arrSrfCentroid = array( dblSrfCentroidx,dblSrfCentroidy,dblSrfCentroidz)
””””””””””””””””””””””””””””””’
‘store name in var
strDriverName0 = “Driver(” & CStr(i) & “)(” & CStr(j) & “)”
strDriverName1 = “Driver(” & CStr(i+1) & “)(” & CStr(j) & “)”
strDriverName2 = “Driver(” & CStr(i+1) & “)(” & CStr(j+1) & “)”
strDriverName3 = “Driver(” & CStr(i) & “)(” & CStr(j+1) & “)”
‘selcect 4 points by name
strDriverPt0 = Rhino.ObjectsByName(strDriverName0)
strDriverPt1 = Rhino.ObjectsByName(strDriverName1)
strDriverPt2 = Rhino.ObjectsByName(strDriverName2)
strDriverPt3 = Rhino.ObjectsByName(strDriverName3)
‘assemble 4 points in one array
arrINDDriverPoints = array(strDriverPt0(0),strDriverPt1(0),strDriverPt2(0),strDriverPt3(0))
‘create and store 4 points in one group
Dim strGroup3 : strGroup3 = “DriverGroup(” & CStr(i) & “)(” & CStr (j) & “)”
Call Rhino.DeleteGroup(strGroup3)
Call Rhino.AddGroup(strGroup3)
Call Rhino.AddObjectsToGroup (arrINDDriverPoints, strGroup3)
‘get coordinates of each point
arrINDDriverPoint1xyz =Rhino.PointCoordinates(strDriverPt0(0))
arrINDDriverPoint2xyz =Rhino.PointCoordinates(strDriverPt1(0))
arrINDDriverPoint3xyz =Rhino.PointCoordinates(strDriverPt2(0))
arrINDDriverPoint4xyz =Rhino.PointCoordinates(strDriverPt3(0))
‘Get centroid of the four surface pts
dblDriverMidPt1x = ((arrINDDriverPoint1xyz(0) + arrINDDriverPoint3xyz(0))/2)
dblDriverMidPt1y = ((arrINDDriverPoint1xyz(1) + arrINDDriverPoint3xyz(1))/2)
dblDriverMidPt1z = ((arrINDDriverPoint1xyz(2) + arrINDDriverPoint3xyz(2))/2)
dblDriverMidPt2x = ((arrINDDriverPoint2xyz(0) + arrINDDriverPoint4xyz(0))/2)
dblDriverMidPt2y = ((arrINDDriverPoint2xyz(1) + arrINDDriverPoint4xyz(1))/2)
dblDriverMidPt2z = ((arrINDDriverPoint2xyz(2) + arrINDDriverPoint4xyz(2))/2)
dblDriverSrfCentroidx = ((dblDriverMidPt1x + dblDriverMidPt2x) /2)
dblDriverSrfCentroidy = ((dblDriverMidPt1y + dblDriverMidPt2y) /2)
dblDriverSrfCentroidz = ((dblDriverMidPt1z + dblDriverMidPt2z) /2)
arrDriverSrfCentroid = array( dblDriverSrfCentroidx,dblDriverSrfCentroidy,dblDriverSrfCentroidz)
””””””””””””””””””””””””””””””””””””
””””””””””””””””””””””””””””””””””””
”choose which panel To apply
‘panel 1
If dblDriverSrfCentroidz > dblMax Then
‘Call paneling tool
Call PanelCustomGroup(strGroup1,strGroup2,arrPattern1(0))
End If
‘panel 2
If dblDriverSrfCentroidz < dblMax Then
If dblDriverSrfCentroidz > 0 Then
‘Call paneling tool
Call PanelCustomGroup(strGroup1,strGroup2,arrPattern2(0))
End If
End If
‘panel 3
If dblDriverSrfCentroidz < 0 Then
If dblDriverSrfCentroidz > dblNegativeMax Then
‘Call paneling tool
Call PanelCustomGroup(strGroup1,strGroup2,arrPattern3(0))
End If
End If
‘panel 4
If dblDriverSrfCentroidz < dblNegativeMax Then
‘Call paneling tool
Call PanelCustomGroup(strGroup1,strGroup2,arrPattern4(0))
End If
‘print progess bar
Dim intTotal: intTotal = (intVNum * intUNum)
Dim intPercent : intPercent = ((k/intTotal)*100)
Call Rhino.StatusBarMessage (” ” & CStr(k) & ” of ” & CStr(intTotal) & ” panels done………” & CStr(intPercent)& “% Done”)
Dim intReset : intReset = (intCount/intUNum)
‘ If intReset = 1 Then
‘ intLayerCount = intLayerCount + 1
‘ strLayer = “Group ” & CStr(intLayerCount)
‘ strPrevLayer = “Group ” & CStr((intLayerCount)-1)
‘ Call Rhino.DeleteLayer(strLayer)
‘ Call Rhino.AddLayer (strLayer)
‘ Call Rhino.CurrentLayer (strLayer)
‘ Call Rhino.LayerVisible(strPrevLayer, False)
‘ End If
k = k + 1
Next
intCount = intCount + 1
Next
Else
Call Rhino.Print(“not an array”)
End If
”””””””””””””””””””””””””””””””””””””””””’
Call Rhino.HideObject(strBottomSrfObject)
Call Rhino.HideObject(strTopSrfObject)
Call Rhino.HideObjects(arrBottomGrid)
Call Rhino.HideObjects(arrTopGrid)
Call Rhino.HideObjects(arrDriverGrid)
”””””””””””””””””””””””””””””””””””””””””’
Call rhino.EnableRedraw(True)
”””””””””””””””””””””””””””””””””””””””””’
Set PTObj = Nothing
End Sub
Function PanelCustomGroup(strFirGroupName1,strGroupName2,strObject)
Dim strCmd, strPanel
‘strCmd = “! _ptPanel3DCustom _selGroup BottomGroup _Enter _SelGroup TopGroup _Enter _Enter _SelID ” & strObject & ” _Enter _Enter”
strCmd = “! _ptPanel3DCustom _selGroup ” & strFirGroupName1 & ” _Enter _SelGroup ” & strGroupName2& ” _Enter _Enter _SelID ” & strObject & ” _Enter _Enter”
strPanel = Rhino.Command (strCmd)
PanelCustomGroup = strPanel
End Function
Sub PanelCustomPts(arrBottomPts,arrTopPts,strObject)
Dim strCmd
strCmd = “! _ptPanel3DCustom _SelID ” & arrBottomPts & ” _Enter _SelID ” & arrTopPts & ” _Enter _Enter _SelID ” & strObject & ” _Enter _Enter”
Rhino.Command strCmd
End Sub
Function GridByUV(strSrfObject,strGridName,intUNum,intVNum)
Dim arrPoints, PTObj
Const boolUMode = False ‘Divide by number in U direction
Const boolVMode = False ‘Divide by distance in V direction
‘Const intUNum = 15 ‘Number of points in U direction
‘Const intVNum = 150 ‘Number of points in V direction
Const doubleUDis = 0 ‘Distance In U direction
Const doubleVDis = 1.5 ‘Distance In V direction
Const boolURound = False ‘Round in U direction
Const boolVRound = True ‘Round in V direction
Const boolURoundMethod = False ‘RoundMethod in U Dir
Const boolVRoundMethod = False ‘Round up in V direction
Const boolGroup = True
‘strGridName = “MyGrid”
On Error Resume Next
‘Get PanelingTools Object
Set PTObj = Rhino.GetPluginObject(“PanelingTools”)
If Err Then
MsgBox Err.Description
Exit Function
End If
‘Select a surface
‘strSrfObject = Rhino.GetObject(“Select a surface”, 8)
If (strSrfObject <> vbNull) Then
‘Call grid generation function
arrPoints = PTObj.GridBySurfaceUV( strSrfObject, boolUmode, boolVMode, intUNum, intVNum, doubleUDis, doubleVDis, boolURound, boolVRound, boolURoundMethod, boolVRoundMethod, boolGroup, strGridName )
End If
GridByUV = arrPoints
Set PTObj = Nothing
End Function
Rajaa created this gallery some time ago, but it seems as though it has lost its momemtum. If you are using paneling tools I encourage you to contact Rajaa. I am sure she would be happy to add to gallery. Here is the link: Paneling Tools Gallery.
These were screen studies utilizing Paneling Tools. The 4-5 soft components were modeled in Maya, imported into Rhino, and paneled across a surface. The explorations were then 3d printed.






After playing with the PanelingTools plug-in for Rhino4, I noticed its great power for mapping components on a surface efficiently. The one restraint that it has is its inability to map multiple components through conditional statements. The great thing about PanelingTools is that it allows you to access its syntax tree in RhinoScript. After gaining access to its mapping/ordering technique, I wrote a script to populate multiple surfaces with multiple components/panels. The script chooses which component is more appropriate by analyzing a point, surface, or light displacement map. This allows for performance based populations and surface mimicking populations.
Inspired by SJET and theverymany.net ‘s Tesselion.
Utilizing Rhino + PanelingTools + RhinoScript, four base components were modeled and tagged into the script according to their porosity. A “driver surface” ( that could be a height field of a heat dissipation map of the target surface) dictates which component to populate depending on the zed of the corresponding grid point of surface. Further exploration and development is coming.
One thing that should be understood is that this experiment does not clearly match the level of complexity achieved by SJET and theverymany.net!! The surface I used to populate was not a rulled surface nor a faceted surface; therefore, the individual panels are not planar as in the Tesselion. Although it is a nice feature of PanelingTools to “morph” the components to the surface grids, it is not desired for fabricating out of planar materials economically! Script will be posted after cleanup.
Very quick exploration:


AA Summer DLab was a 2 week workshop where with the direction of Dave Pigram and Ezio Blasetti we focused on generative processes utilizing RhinoScript. Although I knew how to read the language, this was my first exposure to these generative techniques. This marks the beginning of a search to know more.
In the workshop, students designed chandeliers utilizing generative algorithms. My group explored the potential for light based parameters in a DLA, diffusion limited aggregation, system.
The first script uses a surface (based on the luminance of a ceiling plan) to aggregate a ceiling plane with “smart” light nodes and develop connections between them based on the amount of light in a given region.
Option Explicit
‘Script written by <Michael McCune,Stephen Crawford, Karol Seamus Mac Gairbheith>
‘Script version Wednesday, August 06, 2008 5:42:24 PM
‘Light based Diffusion Limited Aggregation
Call Main()
Sub Main()
‘declaraions
Dim dblDistance, arrSeeds(), arrSeedThresholds(),arrMinLightPt
Dim i,j,k,l,m
‘because there is nothing in the array, set it at minus one to trick the computer that when we add 1 futher below the first slot will be 0
ReDim arrSeeds(-1)
ReDim arrSeedThresholds(-1)
‘user iputs
Dim dblScaleFactor : dblScaleFactor = Rhino.GetReal(“What is the distance scale factor between seed and emmitter?”,1,.0001,100)
If IsNull(dblScaleFactor) Then Exit Sub
Dim dblVelocityScaler : dblVelocityScaler = Rhino.GetReal(“Velociy Scaler?”,1,.01,1000)
If IsNull(strObject) Then Exit Sub
Dim dblRand : dblRand = Rhino.GetReal(“What is degree of randomness to the movement of the emmitter?”,.2,.01,100)
If IsNull(dblRand) Then Exit Sub
Dim intConnections : intConnections = Rhino.GetReal(“What is the max conections between seed and attractor?”,4,3,10)
If IsNull(intConnections) Then Exit Sub
Dim intStep : intStep = Rhino.GetReal(“How many times do you want to do cycle?”,1000,1)
If IsNull(intStep) Then Exit Sub
Dim intNumberOfStarterEmmitters: intNumberOfStarterEmmitters = Rhino.GetReal(“How many Emmitters to Start With?”,20,1,1000)
Dim strObject : strObject = Rhino.GetObject(“give me a surface to populate with dots”,24)
If IsNull(strObject) Then Exit Sub
‘Call Rhino.EnableRedraw(False)
‘Create Bounding Box so the attractors will not wonder off!!
Dim arrSBox : arrSBox = Rhino.BoundingBox (strObject)
Dim arrBBox : arrBBox = arrSBox
arrBBox(0) = array(arrSBox(0)(0),arrSBox(0)(1),-.1)
arrBBox(1) = array(arrSBox(1)(0),arrSBox(1)(1),-.1)
arrBBox(2) = array(arrSBox(2)(0),arrSBox(2)(1),-.1)
arrBBox(3) = array(arrSBox(3)(0),arrSBox(3)(1),-.1)
arrBBox(4) = array(arrSBox(4)(0),arrSBox(4)(1),9)
arrBBox(5) = array(arrSBox(5)(0),arrSBox(5)(1),9)
arrBBox(6) = array(arrSBox(6)(0),arrSBox(6)(1),9)
arrBBox(7) = array(arrSBox(7)(0),arrSBox(7)(1),9)
‘Create the first seed
arrMinLightPt = GetMinLightPt (strObject)
ReDim arrSeeds(0)
arrSeeds(0) = Rhino.AddPoint(array(arrMinLightPt(0),arrMinLightPt(1),0))
Call Rhino.ObjectLayer(arrSeeds(0), “Attractors”)
‘find the corresponding Threshold
ReDim arrSeedThresholds(0)
arrSeedThresholds(0) = GetThreshold(strObject,Rhino.PointCoordinates(arrSeeds(0)),dblScaleFactor)
‘Call Rhino.Print(arrSeedThresholds(0))
‘place intnumber of emmitters randomly to start with
For l = 0 To intNumberOfStarterEmmitters
Dim arrNewPt2 : arrNewPt2 = array(28*(rnd-0.5), 28*(rnd-0.5),0)
arrNewPt2 = ConstrainToBBox(arrNewPt2, arrBBox)
Rhino.AddPoint arrNewPt2
Call Rhino.ObjectLayer(arrNewPt2, “Emmitters”)
Next
‘start loop for each iteration
For j = 0 To intStep
Dim arrEmmitters : arrEmmitters = Rhino.ObjectsByLayer(“Emmitters”)
‘cycle through each arrEmmitters
‘
For i = 0 To (Ubound(arrEmmitters)-1)
If IsNull(arrEmmitters) Then
Exit For
End If
‘Find the attractors with more than x connections, then place those in an “expired” layer
‘Call SortPoints()
Dim arrPointxyzEmmitter
arrPointxyzEmmitter = Rhino.PointCoordinates(arrEmmitters(i))
‘make the emmitters move
‘RandomizeRandomize
Dim rndDirectionX : rndDirectionX = rnd-0.5
Dim rndDirectionY : rndDirectionY = rnd-0.5
Dim rndDirectionZ : rndDirectionZ = rnd-0.5
‘Dim rndDirectionZ : rndDirectionZ = rnd-0.5
‘get a threshold factor to apply to the speed at which the particles move
Dim dblThresholdFactor
dblThresholdFactor = GetThreshold(strObject,arrPointxyzEmmitter,dblVelocityScaler)
‘Rhino.Print(dblThresholdFactor)
Dim arrNewPt : arrNewPt = array(arrPointxyzEmmitter(0)+3*rndDirectionX, arrPointxyzEmmitter(1)+3*rndDirectionY, 0)
arrNewPt = ConstrainToBBox(arrNewPt, arrBBox)
rhino.DeleteObject arrEmmitters(i)
arrEmmitters(i) = Rhino.AddPoint (arrNewPt)
‘Call Rhino.PointCoordinates (arrEmmitters(i) , arrNewPt)
Dim arrLineCounter : arrLineCounter = Rhino.ObjectsByLayer(“Lines”)
‘start loop for each arrAttrctors
For k=0 To Ubound(arrSeeds)
‘measure distance between emmitter and seed
Dim arrPointxyzAttractor : arrPointxyzAttractor = Rhino.PointCoordinates(arrSeeds(k))
dblDistance = Rhino.Distance(arrPointxyzAttractor,arrNewPt )
If dblDistance < arrSeedThresholds(k) Then
‘If dblDistance > 1.67 And dblDistance < 8.4 Then
‘Rhino.Print dblDistance
‘draw a line from seed to emmitter
Dim strLine : strLine = Rhino.AddLine(arrPointxyzAttractor,arrNewPt)
If Not IsNull(strLine) Then
Call Rhino.ObjectLayer(strLine, “Lines”)
End If
‘switch the emmitter to the attrctor layer
Call Rhino.ObjectLayer(arrEmmitters(i), “Attractors”)
ReDim Preserve arrSeeds(Ubound(arrSeeds)+1) ‘store the name of the new seed (previously an emmiter) in an array
arrSeeds(Ubound(arrSeeds)) = arrEmmitters(i)
‘claculatethe threshold for the new seed and store it in a corresponding array
ReDim Preserve arrSeedThresholds(Ubound(arrSeedThresholds)+1)
arrSeedThresholds(Ubound(arrSeedThresholds)) = GetThreshold(strObject,Rhino.PointCoordinates(arrSeeds(k)),dblScaleFactor)
‘End If
End If
Next
Dim arrCleanedSeeds : arrCleanedSeeds = SortPointsAfterDave(arrSeeds)
Dim arrCleanSeed
ReDim arrSeeds(-1)
For Each arrCleanSeed In arrCleanedSeeds
ReDim Preserve arrSeeds(Ubound(arrSeeds)+1) ‘store the name of the new seed (previously an emmiter) in an array
arrSeeds(Ubound(arrSeeds)) = arrCleanSeed
Next
Dim arrLineCounter2 : arrLineCounter2 = Rhino.ObjectsByLayer(“Lines”)
If Ubound(arrLineCounter) < Ubound(arrLineCounter2) Then
‘create a new emmitter (particle)
arrNewPt2 = array(28*(rnd-0.5), 28*(rnd-0.5), 0*(rnd-0.5))
arrNewPt2 = ConstrainToBBox(arrNewPt2, arrBBox)
For m = 0 To Ubound (arrSeeds)
Dim arrSeedsx: arrPointxyzAttractor = Rhino.PointCoordinates(arrSeeds(k))
dblDistance = Rhino.Distance(arrNewPt2,arrSeeds(m))
If dblDistance > 1.67 Then
Rhino.AddPoint arrNewPt2
Call Rhino.ObjectLayer(arrNewPt2, “Emmitters”)
Else ReLoop
End If
Next
End If
Next
Next
‘Call AverageDistLoft
Call Rhino.EnableRedraw(True)
End Sub
Function GetNumberOfSeedsWithinDist(strSeed,dblDistanceThreshold)
‘Gets the number of seeds within a distance of a seed. that number of seeds should then be multiplied by the z direction of the point
Dim i,arrPointxyzSeed, arrSeeds
Dim arrNumberOfSeedsWithinDistance()
ReDim arrNumberOfSeedsWithinDistance(-1)
ReDim arrNumberOfSeedsWithinDistance(0)
arrNumberOfSeedsWithinDistance(0) = 1
arrSeeds = Rhino.ObjectsByLayer(“ExpiredAttractors”)
‘loop through each seed
For i=0 To Ubound(arrSeeds)
‘get the x,y,z of the seeds
arrPointxyzSeed = Rhino.PointCoordinates(arrSeeds(i))
‘loop through the rest of the seeds
For j=0 To Ubound(arrSeeds)
‘get the x,y,z of the seeds
arrPointxyzOtherSeed = Rhino.PointCoordinates(arrSeeds(j))
‘measure distance between seed and seed
dblDistance = Rhino.Distance(arrPointxyzAttractor,arrPointxyzOtherSeed )
If dblDistance < dblDistanceThreshold Then
ReDim Preserve arrNumberOfSeedsWithinDistance(Ubound(arrNumberOfSeedsWithinDistance)+1) ‘store the name of the new seed (previously an emmiter) in an array
arrNumberOfSeedsWithinDistance(Ubound(arrNumberOfSeedsWithinDistance)) = arrSeeds(j)
End If
Next
Next
dblDistanceThreshold = arrSeeds(Ubound)
GetNumberOfSeedsWithinDist = dblDistanceThreshold
End Function
Function GetThreshold(strObject,arrSeedPt,dblScaleFactor)
GetThreshold = Null
Dim dblThresholdFactor, dblHeightofLine, arrIntersectingPoint, strTempIntersectingLine, arrIntersectingBrepsReturn, arrBrepClosestPointRtn
dblHeightofLine = 100
strTempIntersectingLine = Rhino.AddLine(arrSeedPt,array(arrSeedPt(0),arrSeedPt(1),arrSeedPt(2)+dblHeightofLine))
arrIntersectingBrepsReturn = Rhino.IntersectBreps(strTempIntersectingLine,strObject)
Call Rhino.DeleteObject(strTempIntersectingLine)
‘if there is no intersection, then use closest point on surface instead
If isNull(arrIntersectingBrepsReturn) Then
arrBrepClosestPointRtn = Rhino.BrepClosestPoint(strObject,arrSeedPt)
arrIntersectingPoint = arrBrepClosestPointRtn(0)
Else
arrIntersectingPoint = Rhino.PointCoordinates(arrIntersectingBrepsReturn(2))
End If
dblThresholdFactor = (dblScaleFactor)*arrIntersectingPoint(2) ‘use the Z value of the point on the heighfield surface
GetThreshold = dblThresholdFactor
End Function
Sub SortPoints()
Dim intConnections
intConnections = 4
Dim arrSeeds : arrSeeds = Rhino.ObjectsByLayer(“Attractors”)
If IsNull(arrSeeds) Then Exit Sub
Dim arrIDLines : arrIDLines = Rhino.ObjectsByLayer(“Lines”)
‘Dim arrLines : arrLines = Rhino.PointCoordinates(arrIDLines)
If IsNull(arrIDLines) Then Exit Sub
Dim i,j
For j = 0 To Ubound (arrIDLines)
Dim arrLineStPt : arrLineStPt = Rhino.CurveStartPoint (arrIDLines(j))
Dim arrLineEndPt : arrLineEndPt = Rhino.CurveEndPoint (arrIDLines(j))
Dim intcounterConections : intcounterConections = 0
For i = 0 To Ubound (arrSeeds)
If intcounterConections > intConnections Then
Call Rhino.ObjectLayer (arrSeeds(i) , “ExpiredAttractors”)
Exit For
End If
Dim arrPointxyzAttraction : arrPointxyzAttraction = Rhino.PointCoordinates(arrSeeds(i))
If arrPointxyzAttraction(0) = arrLineStPt(0) Or arrPointxyzAttraction(0) = arrLineEndPt(0) Then
If arrPointxyzAttraction(1) = arrLineStPt(1) Or arrPointxyzAttraction(1) = arrLineEndPt(1) Then
intcounterConections = intcounterConections + 1
End If
End If
Next
Next
End Sub
Function SortPointsAfterDave(arrSeeds)
Dim intConnections : intConnections = 4
Dim arrSeedsClean()
ReDim arrSeedsClean(-1)
‘Dim arrSeeds : arrSeeds = Rhino.ObjectsByLayer(“Attractors”)
If IsNull(arrSeeds) Then Exit Function
Dim arrIDLines : arrIDLines = Rhino.ObjectsByLayer(“Lines”)
‘Dim arrLines : arrLines = Rhino.PointCoordinates(arrIDLines)
If IsNull(arrIDLines) Then Exit Function
Dim i,j
For i = 0 To Ubound (arrSeeds)
Dim intcounterConections : intcounterConections = 0
Dim arrPointxyzAttraction : arrPointxyzAttraction = Rhino.PointCoordinates(arrSeeds(i))
For j = 0 To Ubound (arrIDLines)
Dim arrLineStPt : arrLineStPt = Rhino.CurveStartPoint (arrIDLines(j))
Dim arrLineEndPt : arrLineEndPt = Rhino.CurveEndPoint (arrIDLines(j))
If Rhino.PointCompare (arrPointxyzAttraction, arrLineStPt) Then
intcounterConections = intcounterConections + 1
End If
If Rhino.PointCompare (arrPointxyzAttraction, arrLineEndPt) Then
intcounterConections = intcounterConections + 1
End If
Next
‘prompt intcounterConections
If intcounterConections < intConnections Then
‘Call Rhino.ObjectLayer (arrSeeds(i) , “ExpiredAttractors”)
Dim strTestPt
Dim TestCounter : TestCounter = 0
For Each strTestPt In arrSeedsClean
Dim arrTestPt : arrTestPt = Rhino.PointCoordinates(strTestPt)
Dim blnTest : blnTest = Rhino.PointCompare (arrTestPt, arrPointxyzAttraction)
If blnTest Then
testCounter = TestCounter+1
End If
Next ‘
If TestCounter=0 Then
ReDim Preserve arrSeedsClean(Ubound(arrSeedsClean)+1) ‘store the name of the new seed (previously an emmiter) in an array
arrSeedsClean(Ubound(arrSeedsClean)) = arrSeeds(i)
End If
Else
‘prompt “why am i here?”
‘ Dim strDot : strDot = rhino.AddTextDot (“expired”, arrPointxyzAttraction)
‘ Call Rhino.ObjectLayer (arrSeeds(i) , “ExpiredAttractors”)
‘ Call Rhino.ObjectLayer (strDot , “ExpiredAttractors”)
End If
Next
SortPointsAfterDave = arrSeedsClean
End Function
Function GetMinLightPt (strObject)
GetMinLightPt = Null
Dim i, arrSurfacePoints, dblLowestZ, arrLowestPt
arrSurfacePoints = Rhino.SurfacePoints(strObject)
dblLowestZ = 9999999999999999
For i = 0 To Ubound(arrSurfacePoints)
If arrSurfacePoints(i)(2) < dblLowestZ Then
dblLowestZ = arrSurfacePoints(i)(2)
arrLowestPt = arrSurfacePoints(i)
End If
Next
GetMinLightPt = arrLowestPt
End Function
Function ConstrainToBBox(arrNewPt, arrBBox)
ConstrainToBBox = Null
‘ Dim arrNewAttractors : arrNewAttractors = arrNewPt
Dim arrPoint00 : arrPoint00 = arrBBox(0)
Dim arrPoint01 : arrPoint01 = arrBBox(1)
Dim arrPoint03 : arrPoint03 = arrBBox(3)
Dim arrPoint04 : arrPoint04 = arrBBox(4)
Dim arrXbound : arrXbound = arrPoint01(0) – arrPoint00(0)
Dim arrYbound : arrYbound = arrPoint03(1) – arrPoint00(1)
Dim arrZbound : arrZbound = arrPoint04(2) – arrPoint00(2)
If arrNewPt(0)>arrPoint01(0) Then
arrNewPt(0) = arrNewPt(0) – arrXbound
End If
If arrNewPt(0)<arrPoint00(0) Then
arrNewPt(0) = arrNewPt(0) + arrXbound
End If
If arrNewPt(1)>arrPoint03(1) Then
arrNewPt(1) = arrNewPt(1)- arrYbound
End If
If arrNewPt(1)<arrPoint00(1) Then
arrNewPt(1) = arrNewPt(1) + arrYbound
End If
If arrNewPt(2)>arrPoint04(2) Then
arrNewPt(2) = arrNewPt(2)- arrZbound
End If
If arrNewPt(2)<arrPoint00(2) Then
arrNewPt(2) = arrNewPt(2) + arrZbound
End If
ConstraintoBBox = arrNewPt
End Function
Function AverageDistLoft
‘Call an array of all lines and get start and end points
Dim arrObjects, arrStartPoint, dblDistance, dblScaleFactor
Dim arrEndPoint, arrMidPoint, SumOfAllDistances
Dim dblAverageDistanceStartPt, dblAverageDistanceEndPt
Dim i, j
dblScaleFactor = 100
arrObjects = Rhino.ObjectsByLayer(“Lines”)
‘get start, mid and end points
For i = 0 To Ubound(arrObjects)
If Rhino.IsCurve(arrObjects(i)) Then
arrStartPoint = Rhino.CurveStartPoint(arrObjects(i))
arrEndPoint = Rhino.CurveEndPoint(arrObjects(i))
‘reset the total for this line
SumOfAllDistances = 0
‘for the start point
For j = 0 To Ubound(arrObjects)
arrMidPoint = Rhino.CurveMidPoint(arrObjects(j))
dblDistance = Rhino.Distance(arrStartPoint,arrMidPoint)
SumOfAllDistances = SumOfAllDistances + dblDistance
Next
dblAverageDistanceStartPt = SumOfAllDistances / (Ubound(arrObjects) + 1)
‘for the end point
SumOfAllDistances = 0
For j = 0 To Ubound(arrObjects)
arrMidPoint = Rhino.CurveMidPoint(arrObjects(j))
dblDistance = Rhino.Distance(arrEndPoint,arrMidPoint)
SumOfAllDistances = SumOfAllDistances + dblDistance
Next
dblAverageDistanceEndPt = SumOfAllDistances / (Ubound(arrObjects) + 1)
End If
‘Dim strNewLine : strNewLine = Rhino.AddLine(array(arrStartPoint(0),arrStartPoint(1),dblAverageDistanceStartPt/dblScaleFactor), array(arrEndPoint(0),arrEndPoint(1),dblAverageDistanceEndPt/dblScaleFactor))
Dim strNewLine : strNewLine = Rhino.AddLine(array(arrStartPoint(0),arrStartPoint(1),dblScaleFactor/dblAverageDistanceStartPt), array(arrEndPoint(0),arrEndPoint(1),dblScaleFactor/dblAverageDistanceEndPt))
‘add loft surface between 2 sets of lines
‘Rhino.AddLoftSrf array(arrObjects(i),strNewLine)
Next
End Function
The second script lofts surfaces based on the density of light nodes. The denser the thicker and further the members are from the ceiling. The script also prepares the file for laser cutting by unrolling the surfaces, labeling, and giving the lengths of the light nodes.
Option Explicit
‘Script written by Michael McCune
‘Script version Tuesday, August 12, 2008 1:07:43 PM
‘Lofts line based on density of points
‘Unrolls for laser cutting and labeling
Call Main()
Sub Main()
Dim intSpread : intSpread = Rhino.GetReal(“Space between unrolled surfaces”,1, 1,100)
Call LoftSurfacesBasedOnDensity (intSpread)
End Sub
Function LoftSurfacesBasedOnDensity (intSpread)
Dim arrIDLines : arrIDLines = Rhino.ObjectsByLayer(“Lines2″)
Dim dblDistanceThreshold : dblDistanceThreshold = 2
Dim intcounterConectionsST, intcounterConectionsEnd, intcounterLines
Dim dblDistanceStPt, dblDistanceEndPt
‘Dim arrLines : arrLines = Rhino.PointCoordinates(arrIDLines)
If IsNull(arrIDLines) Then Exit Function
Dim i,j,k
Dim x : x = 0
For i = 0 To Ubound (arrIDLines)
Dim arrLineStPt : arrLineStPt = Rhino.CurveStartPoint (arrIDLines(i))
Dim arrLineEndPt : arrLineEndPt = Rhino.CurveEndPoint (arrIDLines(i))
intcounterConectionsST = 0
intcounterConectionsEnd = 0
intcounterLines = 0
For j = 0 To Ubound (arrIDLines)
Dim arrLineMidPtOther : arrLineMidPtOther = Rhino.CurveMidPoint (arrIDLines(j))
dblDistanceStPt = Rhino.Distance(arrLineStPt,arrLineMidPtOther )
dblDistanceEndPt = Rhino.Distance(arrLineEndPt,arrLineMidPtOther )
If dblDistanceStPt < dblDistanceThreshold Then
If dblDistanceStPt > 0 Then
intcounterConectionsST = intcounterConectionsST + 1
End If
End If
If dblDistanceEndPt < dblDistanceThreshold Then
If dblDistanceEndPt > 0 Then
intcounterConectionsEnd = intcounterConectionsEnd + 1
End If
End If
Next
Call Rhino.Print(intcounterConectionsST)
Call Rhino.Print(intcounterConectionsEnd)
Dim arrNewLineStPt : arrNewLineStPt = array(arrLineStPt(0), arrLineStPt(1), arrLineStPt(2) + (intcounterConectionsST/5))
Dim arrNewLineEndPt : arrNewLineEndPt = array(arrLineEndPt(0), arrLineEndPt(1), arrLineEndPt(2) + (intcounterConectionsEnd/5))
Dim arrNewLoftLineStPt : arrNewLoftLineStPt = array(arrLineStPt(0), arrLineStPt(1), (arrLineStPt(2) + (intcounterConectionsST/5))+ (((intcounterConectionsST/20)*.8)+.1))
Dim arrNewLoftLineEndPt : arrNewLoftLineEndPt = array(arrLineEndPt(0), arrLineEndPt(1), (arrLineEndPt(2) + (intcounterConectionsEnd/5))+ (((intcounterConectionsEnd/20)*.8)+.1))
Dim strNewLines : strNewLines = Rhino.AddLine (arrNewLineStPt, arrNewLineEndPt)
Dim strNewLoftLines : strNewLoftLines = Rhino.AddLine (arrNewLoftLineStPt, arrNewLoftLineEndPt)
Dim SurfaceLoft : SurfaceLoft = Rhino.AddLoftSrf (array(strNewLines,strNewLoftLines))
‘Call rhino.DeleteObjects(arrIDLines(i))
‘Call rhino.DeleteObjects (arrNewLoftLines(j))
Dim dblLineLength : dblLineLength = Rhino.CurveLength(strNewLines)
Dim dblExtend : dblExtend = .2
Dim dblRadious : dblRadious = .1
arrNewLineStPt = Rhino.CurveStartPoint(strNewLines)
arrNewLineEndPt = Rhino.CurveEndPoint(strNewLines)
arrNewLoftLineStPt = Rhino.CurveStartPoint(strNewLoftLines)
arrNewLoftLineEndPt = Rhino.CurveEndPoint(strNewLoftLines)
‘redraw to xyplane
Dim arrNewLinesxy : arrNewLinesxy = Rhino.AddLine (array(x,arrNewLineStPt(2),0), array(x + dblLineLength,arrNewLineEndPt(2),0))
Dim arrNewLoftLinesxy : arrNewLoftLinesxy = Rhino.AddLine (array(x,arrNewLoftLineStPt(2),0), array(x + dblLineLength,arrNewLoftLineEndPt(2),0))
‘Dim arrNewLinesxyStSt : arrNewLinesxyStSt = Rhino.AddLine (array(x,arrNewLineStPt(2),0),array(x,arrNewLoftLineStPt(2),0))
Dim arrNewLinesxyStSt : arrNewLinesxyStSt = Rhino.AddLine (array(x+dblRadious,arrNewLineStPt(2)-dblExtend,0),array(x+dblRadious,arrNewLoftLineStPt(2)+dblExtend,0))
‘Dim arrNewLoftLinesxyEndEnd : arrNewLoftLinesxyEndEnd = Rhino.AddLine (array(x + dblLineLength,arrNewLineEndPt(2),0),array(x + dblLineLength,arrNewLoftLineEndPt(2),0))
Dim arrNewLoftLinesxyEndEnd : arrNewLoftLinesxyEndEnd = Rhino.AddLine (array(x-dblRadious + dblLineLength,arrNewLineEndPt(2)-dblExtend,0),array(x-dblRadious + dblLineLength,arrNewLoftLineEndPt(2)+dblExtend,0))
x = x + dblLineLength + intSpread
Dim arrMidPt : arrMidPt = Rhino.CurveMidPoint (arrIDLines(i))
Dim arrMidPt2 : arrMidPt2 = Rhino.CurveMidPoint (arrNewLinesxy)
‘label peices and corresponding point in plan
Dim strText : strText = Rhino.AddText (CStr(i), array(arrMidPt(0),arrMidPt(1)+ .01,0),.1)
Dim strText2 : strText2 = Rhino.AddText (CStr(i), array(arrMidPt2(0),arrMidPt2(1)+ .02 ,0),.03 )
Next
End Function