Cabo San LucasSorry 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

Advertisement