Option Explicit
Call ControlPointArrange()
Sub ControlPointArrange()
'arrCount will hold 2 values that we'll retrieve later
'arrPoints is an array to hold the u*v amount of grid points
Dim arrCount(1), arrPoints(35), nCount, i, j
 arrCount(0) = 6
 arrCount(1) = 6
 nCount = 0 
'since we're starting at 0, we need to subtract 1 from the initial count
'this For Next Loop creates the grid of points (not visible - arrPoints just holds the points)
'Call Rhino.AddPoints(arrPoints) to see them
For i = 0 To arrCount(0) - 1
  For j = 0 To arrCount(1) - 1
           arrPoints(nCount) = Array(i*2, j*4, 0)
           nCount = nCount + 1
  Next
 Next
'Call Rhino.AddPoints(arrPoints)
 Call Rhino.AddSrfPtGrid(arrCount, arrPoints)
'----------------------------------------------------------------------------------------
 Dim strObject, n
Dim arrGrips(), arrPoint, intGrips
strObject = Rhino.GetObject("Select objects")
'must enable grips before they can be manipulated
'intGrips is used to select the Object Grips of strObject
Call Rhino.EnableObjectGrips(strObject)
intGrips = Rhino.SelectObjectGrips(strObject)
'we have to resize the Array arrGrips() since we didn't declare a size
ReDim Preserve arrGrips(intGrips)
 'since we start at 0, and arrGrips holds 36 points, we need to subtract 1 from the Upper Boundary of arrGrips
For n = 0 To UBound(arrGrips) - 1
'arrGrips is an Array that will hold the locations of the Grips of strObject
arrGrips(n) = Rhino.ObjectGripLocation(strObject, n) 
'once we have an array that holds the original locations of the Grips
'we use the same Method to modify the locations
arrPoint = Rhino.ObjectGripLocation(strObject,n,Array(arrGrips(n)(0), arrGrips(n)(1),3*Rnd))
 Next
End Sub
Tuesday, September 23, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment