final script

Call Main()
Sub Main()
Dim arrPlane, i,k, strCrv(), strInnerCrv(), strSrf(), arrX, arrPt(), arrInnerPt(), counter, arrHorzSurf(), arrVertSurf(), counter1, counter2, counter3
Dim strCrvv, strInnerCrvv, j, UnrolledSlice, dblDist, arrTempPt, arrTempInnerPt, strHorzSurf, strVertSurf, arrCrvs()
Dim intRandom, loopcounter

counter1 = 0
For loopcounter = 0 To 12
i = Random(2,13)
arrX = sin(i/15*3.14)*12
ReDim Preserve strCrv(counter1)
ReDim Preserve strInnerCrv(counter1)
ReDim Preserve strSrf(counter1)
ReDim Preserve arrHorzSurf(counter1)
arrPlane = Rhino.PlaneFromPoints (array(0,0,i), array(1,0,i), array(0,1,i))
strCrv(counter1) = Rhino.AddCircle (arrPlane, arrX)
strInnerCrv(counter1) = Rhino.AddCircle (arrPlane, arrX-1)
If i = 13 Then
arrHorzSurf(counter1) = Rhino.AddPlanarSrf (array(strCrv(counter1)))
Else
arrHorzSurf(counter1) = Rhino.AddLoftSrf (array(strCrv(counter1),strInnerCrv(counter1)))
End If
counter1 = counter1 + 1
Next
Call Rhino.DeleteObjects (strCrv)
Call Rhino.DeleteObjects (strInnerCrv)

counter2 = 0
For loopcounter = 0 To 5
intRandom = Random(20,120)
For j = -180 To 179 Step intRandom
ReDim Preserve arrVertSurf(counter2)
counter = 0
For i = 1 To 14
arrX = sin(i/15*3.14)*12
ReDim Preserve arrPt(counter)
ReDim Preserve arrinnerPt(counter)
arrTempPt = Rhino.Polar (array(0,0,0), j, arrX)
arrPt(counter) = array(arrTempPt(0),arrTempPt(1),arrTempPt(2)+i)
arrTempInnerPt = Rhino.Polar (array(0,0,0), j, arrX-1)
arrinnerPt(counter) = array (arrTempInnerPt(0),arrTempInnerPt(1),arrTempInnerPt(2)+i)
counter = counter + 1
Next
strCrvv = Rhino.AddCurve (arrPt)
strinnerCrvv = Rhino.AddCurve (arrinnerPt)
arrVertSurf(counter2) = Rhino.AddLoftSrf (array(strCrvv, strInnerCrvv))
Call Rhino.DeleteObject (strCrvv)
Call Rhino.DeleteObject (strInnerCrvv)
Next
counter2 = counter2 + 1
Next

End Sub

Function Random(nMin, nMax)
Randomize
Random = Int((nMax-nMin+1)*Rnd+nMin)
End Function

Kissing Vase

parametricrealizationssheetlayout_01_blogparametricrealizationssheetlayout_02_blog

Toad Stools

parametric_page_1parametric_page_2parametric_page_31parametric_page_4parametric_page_5parametric_page_6

broken window (katie)

2008_12_12_1_title2008_12_12_2_script-22008_12_12_3_open_closed-22008_12_12_4_overlay-22008_12_121Option Explicit
‘Script written by <insert name>
‘Script copyrighted by <insert company name>
‘Script version Sunday, December 07, 2008 4:41:24 PM

Call Main()
Sub Main()
Dim i,j,k,l,m, arrPt, strPoint, strTestPath, arrPoint, arrCCX, strCurve, counter, arrIntPoint(), strIntPoint, strCrv, strCrv2, strSrf
Dim arrIntPt, TestDistance, OrigDistance, ClosestPoint, strPath, arrDivPts, arrPoint1, arrPoint2, strIntLine(), closestLine
Dim arrPoints : arrPoints = Rhino.Getobjects (“select Points”, 1)
Dim arrCurves : arrCurves = Rhino.Getobjects (“select Curves”, 4)
Dim arrLine1(1), arrLine2(1), arrAngle, arrStepAngle, arrSltLCtrPt, arrSltLCtrFPt, arrSltLCtrBPt, strSltLCrvI1, strSltLCrvI2, arrSltLOutPt, arrSltLOutFPt, arrSltLOutBPt, strSltLCrvO1, strSltLCrvO2, strSltLCrvF, strSltLCrvB, StrSltL
Dim arrSltRCtrPt, arrSltRCtrFPt, arrSltRCtrBPt, strSltRCrvI1, strSltRCrvI2, arrSltROutPt, arrSltROutFPt, arrSltROutBPt, strSltRCrvO1, strSltRCrvO2, strSltRCrvF, strSltRCrvB, strPath2
Dim slotlength : slotlength = .5
Dim slotwidth: slotwidth = .1695
Dim slotoffset: slotoffset = .268
Dim matwidth: matwidth= .114
Call Rhino.UnselectAllObjects
Call Rhino.EnableRedraw (False)
For Each strPoint In arrPoints
arrPoint = Rhino.PointCoordinates (strPoint)
For i = 11.25 To 168.75 Step 45
arrPt = Rhino.Polar (arrPoint, i, 40, Rhino.WorldYZPlane)
strTestPath = Rhino.AddLine (arrPoint, arrPt)
counter = 0
For Each strCurve In arrCurves
arrCCX = Rhino.CurveCurveIntersection (strCurve, strTestPath)
If Not IsArray(arrCCX) Then
Rhino.Print “Selected curves do not intersect.”
Else
ReDim Preserve strIntLine(counter)
ReDim Preserve arrIntPoint(counter)
arrIntPoint(counter) = Rhino.AddPoint (arrCCX(j,1))
strIntLine(counter) = strCurve
counter = counter + 1
End If
Next
OrigDistance = 1000000
For m = 0 To UBound(arrIntPoint)
arrIntPt = Rhino.Pointcoordinates (arrIntPoint(m))
TestDistance = Rhino.Distance (arrPoint, arrIntPt)
If TestDistance < OrigDistance Then
OrigDistance = TestDistance
ClosestPoint = arrIntPt
ClosestLine = strIntLine(m)
End If
Call Rhino.DeleteObject (arrIntPoint(m))
Call Rhino.SelectObject (ClosestLine)
Call Rhino.UnselectAllObjects
Next
strPath = Rhino.AddLine (arrPoint, ClosestPoint)
Call Rhino.DeleteObject (strTestPath)
arrDivPts = Rhino.DivideCurveLength (strPath, 1)
‘Call Rhino.DeleteObject (strPath)
If i Mod 45 = 0 Then
l = 0
Else
l=1
End If
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,1,0)
arrLine2(1) = Array(0,0,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
For k = l To UBound(arrDivPts) Step 2
‘Call Rhino.AddPoint (arrDivPts(k))
arrPoint1 = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
arrPoint2 = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
strCrv = Rhino.AddLine (arrPoint1, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strCrv2 = Rhino.AddLine (arrPoint2, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strSrf = Rhino.AddLoftSrf (Array(strCrv, strCrv2))
Call Rhino.DeleteObject(strCrv)
Call Rhino.DeleteObject(strCrv2)
‘Call Rhino.DeleteObject(strPath)
arrSltLCtrPt = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltLCtrFPt = Rhino.Polar (arrSltLCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI1 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrFPt)
arrSltLCtrBPt = Rhino.Polar (arrSltLCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI2 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrBPt)
arrSltLOutPt = Rhino.Polar (arrSltLCtrPt, i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltLOutFPt = Rhino.Polar (arrSltLOutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO1 = Rhino.AddLine(arrSltLOutPt, arrSltLOutFPt)
arrSltLOutBPt = Rhino.Polar (arrSltLOutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO2 = Rhino.AddLine(arrSltLOutPt, arrSltLOutBPt)
strSltLCrvF = Rhino.AddLine(arrSltLCtrFPt, arrSltLOutFPt)
strSltLCrvB = Rhino.AddLine (arrSltLCtrBPt, arrSltLOutBPt)
arrSltRCtrPt = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltRCtrFPt = Rhino.Polar (arrSltRCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI1 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrFPt)
arrSltRCtrBPt = Rhino.Polar (arrSltRCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI2 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrBPt)
arrSltROutPt = Rhino.Polar (arrSltRCtrPt, i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltROutFPt = Rhino.Polar (arrSltROutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO1 = Rhino.AddLine(arrSltROutPt, arrSltROutFPt)
arrSltROutBPt = Rhino.Polar (arrSltROutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO2 = Rhino.AddLine(arrSltROutPt, arrSltROutBPt)
strSltRCrvF = Rhino.AddLine(arrSltRCtrFPt, arrSltROutFPt)
strSltRCrvB = Rhino.AddLine (arrSltRCtrBPt, arrSltROutBPt)
Next
Next
For i = 33.75 To 191.25 Step 45
arrPt = Rhino.Polar (arrPoint, i, 40, Rhino.WorldYZPlane)
strTestPath = Rhino.AddLine (arrPoint, arrPt)
counter = 0
For Each strCurve In arrCurves
arrCCX = Rhino.CurveCurveIntersection (strCurve, strTestPath)
If Not IsArray(arrCCX) Then
Rhino.Print “Selected curves do not intersect.”
Else
ReDim Preserve strIntLine(counter)
ReDim Preserve arrIntPoint(counter)
arrIntPoint(counter) = Rhino.AddPoint (arrCCX(j,1))
strIntLine(counter) = strCurve
counter = counter + 1
End If
Next
OrigDistance = 1000000
For m = 0 To UBound(arrIntPoint)
arrIntPt = Rhino.Pointcoordinates (arrIntPoint(m))
TestDistance = Rhino.Distance (arrPoint, arrIntPt)
If TestDistance < OrigDistance Then
OrigDistance = TestDistance
ClosestPoint = arrIntPt
ClosestLine = strIntLine(m)
End If
Call Rhino.DeleteObject (arrIntPoint(m))
Call Rhino.SelectObject (ClosestLine)
Call Rhino.UnselectAllObjects
Next
strPath = Rhino.AddLine (arrPoint, ClosestPoint)
Call Rhino.DeleteObject (strTestPath)
arrDivPts = Rhino.DivideCurveLength (strPath, 1)
‘Call Rhino.DeleteObject (strPath)
If i Mod 45 = 0 Then
l = 0
Else
l=1
End If
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,1,0)
arrLine2(1) = Array(0,0,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
For k = 2 To UBound(arrDivPts) Step 2
‘Call Rhino.AddPoint (arrDivPts(k))
arrPoint1 = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
arrPoint2 = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
strCrv = Rhino.AddLine (arrPoint1, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strCrv2 = Rhino.AddLine (arrPoint2, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strSrf = Rhino.AddLoftSrf (Array(strCrv, strCrv2))
Call Rhino.DeleteObject(strCrv)
Call Rhino.DeleteObject(strCrv2)
‘Call Rhino.DeleteObject(strPath)
arrSltLCtrPt = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltLCtrFPt = Rhino.Polar (arrSltLCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI1 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrFPt)
arrSltLCtrBPt = Rhino.Polar (arrSltLCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI2 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrBPt)
arrSltLOutPt = Rhino.Polar (arrSltLCtrPt, i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltLOutFPt = Rhino.Polar (arrSltLOutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO1 = Rhino.AddLine(arrSltLOutPt, arrSltLOutFPt)
arrSltLOutBPt = Rhino.Polar (arrSltLOutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO2 = Rhino.AddLine(arrSltLOutPt, arrSltLOutBPt)
strSltLCrvF = Rhino.AddLine(arrSltLCtrFPt, arrSltLOutFPt)
strSltLCrvB = Rhino.AddLine (arrSltLCtrBPt, arrSltLOutBPt)
arrSltRCtrPt = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltRCtrFPt = Rhino.Polar (arrSltRCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI1 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrFPt)
arrSltRCtrBPt = Rhino.Polar (arrSltRCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI2 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrBPt)
arrSltROutPt = Rhino.Polar (arrSltRCtrPt, i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltROutFPt = Rhino.Polar (arrSltROutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO1 = Rhino.AddLine(arrSltROutPt, arrSltROutFPt)
arrSltROutBPt = Rhino.Polar (arrSltROutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO2 = Rhino.AddLine(arrSltROutPt, arrSltROutBPt)
strSltRCrvF = Rhino.AddLine(arrSltRCtrFPt, arrSltROutFPt)
strSltRCrvB = Rhino.AddLine (arrSltRCtrBPt, arrSltROutBPt)
Next
Next
For i = 213.75 To 356.25 Step 45
arrPt = Rhino.Polar (arrPoint, i, 40, Rhino.WorldYZPlane)
strTestPath = Rhino.AddLine (arrPoint, arrPt)
counter = 0
For Each strCurve In arrCurves
arrCCX = Rhino.CurveCurveIntersection (strCurve, strTestPath)
If Not IsArray(arrCCX) Then
Rhino.Print “Selected curves do not intersect.”
Else
ReDim Preserve strIntLine(counter)
ReDim Preserve arrIntPoint(counter)
arrIntPoint(counter) = Rhino.AddPoint (arrCCX(j,1))
strIntLine(counter) = strCurve
counter = counter + 1
End If
Next
OrigDistance = 1000000
For m = 0 To UBound(arrIntPoint)
arrIntPt = Rhino.Pointcoordinates (arrIntPoint(m))
TestDistance = Rhino.Distance (arrPoint, arrIntPt)
If TestDistance < OrigDistance Then
OrigDistance = TestDistance
ClosestPoint = arrIntPt
ClosestLine = strIntLine(m)
End If
Call Rhino.DeleteObject (arrIntPoint(m))
Call Rhino.SelectObject (ClosestLine)
Call Rhino.UnselectAllObjects
Next
strPath = Rhino.AddLine (arrPoint, ClosestPoint)
Call Rhino.DeleteObject (strTestPath)
arrDivPts = Rhino.DivideCurveLength (strPath, 1)
‘Call Rhino.DeleteObject (strPath)
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,0,0)
arrLine2(1) = Array(0,1,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
If i Mod 45 = 0 Then
l = 0
Else
l=1
End If
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,0,0)
arrLine2(1) = Array(0,1,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
For k = 2 To UBound(arrDivPts) Step 2
‘Call Rhino.AddPoint (arrDivPts(k))
arrPoint1 = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
arrPoint2 = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
Call Rhino.AddLine (arrPoint1, arrPoint2)
strCrv = Rhino.AddLine (arrPoint1, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strCrv2 = Rhino.AddLine (arrPoint2, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strSrf = Rhino.AddLoftSrf (Array(strCrv, strCrv2))
Call Rhino.DeleteObject(strCrv)
Call Rhino.DeleteObject(strCrv2)
‘Call Rhino.DeleteObject(strPath)
arrSltLCtrPt = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltLCtrFPt = Rhino.Polar (arrSltLCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI1 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrFPt)
arrSltLCtrBPt = Rhino.Polar (arrSltLCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI2 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrBPt)
arrSltLOutPt = Rhino.Polar (arrSltLCtrPt, i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltLOutFPt = Rhino.Polar (arrSltLOutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO1 = Rhino.AddLine(arrSltLOutPt, arrSltLOutFPt)
arrSltLOutBPt = Rhino.Polar (arrSltLOutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO2 = Rhino.AddLine(arrSltLOutPt, arrSltLOutBPt)
strSltLCrvF = Rhino.AddLine(arrSltLCtrFPt, arrSltLOutFPt)
strSltLCrvB = Rhino.AddLine (arrSltLCtrBPt, arrSltLOutBPt)
arrSltRCtrPt = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltRCtrFPt = Rhino.Polar (arrSltRCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI1 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrFPt)
arrSltRCtrBPt = Rhino.Polar (arrSltRCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI2 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrBPt)
arrSltROutPt = Rhino.Polar (arrSltRCtrPt, i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltROutFPt = Rhino.Polar (arrSltROutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO1 = Rhino.AddLine(arrSltROutPt, arrSltROutFPt)
arrSltROutBPt = Rhino.Polar (arrSltROutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO2 = Rhino.AddLine(arrSltROutPt, arrSltROutBPt)
strSltRCrvF = Rhino.AddLine(arrSltRCtrFPt, arrSltROutFPt)
strSltRCrvB = Rhino.AddLine (arrSltRCtrBPt, arrSltROutBPt)
Next
Next
For i = 191.25 To 333.75 Step 45
arrPt = Rhino.Polar (arrPoint, i, 40, Rhino.WorldYZPlane)
strTestPath = Rhino.AddLine (arrPoint, arrPt)
counter = 0
For Each strCurve In arrCurves
arrCCX = Rhino.CurveCurveIntersection (strCurve, strTestPath)
If Not IsArray(arrCCX) Then
Rhino.Print “Selected curves do not intersect.”
Else
ReDim Preserve strIntLine(counter)
ReDim Preserve arrIntPoint(counter)
arrIntPoint(counter) = Rhino.AddPoint (arrCCX(j,1))
strIntLine(counter) = strCurve
counter = counter + 1
End If
Next
OrigDistance = 1000000
For m = 0 To UBound(arrIntPoint)
arrIntPt = Rhino.Pointcoordinates (arrIntPoint(m))
TestDistance = Rhino.Distance (arrPoint, arrIntPt)
If TestDistance < OrigDistance Then
OrigDistance = TestDistance
ClosestPoint = arrIntPt
ClosestLine = strIntLine(m)
End If
Call Rhino.DeleteObject (arrIntPoint(m))
Call Rhino.SelectObject (ClosestLine)
Call Rhino.UnselectAllObjects
Next
strPath = Rhino.AddLine (arrPoint, ClosestPoint)
Call Rhino.DeleteObject (strTestPath)
arrDivPts = Rhino.DivideCurveLength (strPath, 1)
‘Call Rhino.DeleteObject (strPath)
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,0,0)
arrLine2(1) = Array(0,1,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
If i Mod 45 = 0 Then
l = 0
Else
l=1
End If
arrLine1(0) = Rhino.CurveStartPoint (strPath)
arrLine1(1) = Rhino.CurveEndPoint (strPath)
arrLine2(0) = Array(0,0,0)
arrLine2(1) = Array(0,1,0)
arrAngle = Rhino.Angle2(arrLine1, arrLine2)
If IsArray(arrAngle ) Then
Rhino.Print “Angle: ” & CStr(arrAngle(0))
End If
For k = 1 To UBound(arrDivPts) Step 2
‘Call Rhino.AddPoint (arrDivPts(k))
arrPoint1 = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
arrPoint2 = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), Sin(k/12)*4, Rhino.WorldYZPlane)
Call Rhino.AddLine (arrPoint1, arrPoint2)
strCrv = Rhino.AddLine (arrPoint1, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strCrv2 = Rhino.AddLine (arrPoint2, Array(arrDivPts(k)(0)-Sin(k/12)*5-1,arrDivPts(k)(1),arrDivPts(k)(2)))
strSrf = Rhino.AddLoftSrf (Array(strCrv, strCrv2))
Call Rhino.DeleteObject(strCrv)
Call Rhino.DeleteObject(strCrv2)
‘Call Rhino.DeleteObject(strPath)
arrSltLCtrPt = Rhino.Polar (arrDivPts(k), i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltLCtrFPt = Rhino.Polar (arrSltLCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI1 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrFPt)
arrSltLCtrBPt = Rhino.Polar (arrSltLCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvI2 = Rhino.AddLine(arrSltLCtrPt, arrSltLCtrBPt)
arrSltLOutPt = Rhino.Polar (arrSltLCtrPt, i+90+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltLOutFPt = Rhino.Polar (arrSltLOutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO1 = Rhino.AddLine(arrSltLOutPt, arrSltLOutFPt)
arrSltLOutBPt = Rhino.Polar (arrSltLOutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltLCrvO2 = Rhino.AddLine(arrSltLOutPt, arrSltLOutBPt)
strSltLCrvF = Rhino.AddLine(arrSltLCtrFPt, arrSltLOutFPt)
strSltLCrvB = Rhino.AddLine (arrSltLCtrBPt, arrSltLOutBPt)
arrSltRCtrPt = Rhino.Polar (arrDivPts(k), i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotoffset/2, Rhino.WorldYZPlane)
arrSltRCtrFPt = Rhino.Polar (arrSltRCtrPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI1 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrFPt)
arrSltRCtrBPt = Rhino.Polar (arrSltRCtrPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvI2 = Rhino.AddLine(arrSltRCtrPt, arrSltRCtrBPt)
arrSltROutPt = Rhino.Polar (arrSltRCtrPt, i+270+(arrAngle(0)-90)*k/UBound(arrDivPts), slotwidth, Rhino.WorldYZPlane)
arrSltROutFPt = Rhino.Polar (arrSltROutPt, i+180+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2-matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO1 = Rhino.AddLine(arrSltROutPt, arrSltROutFPt)
arrSltROutBPt = Rhino.Polar (arrSltROutPt, i+(arrAngle(0)-90)*k/UBound(arrDivPts), slotlength/2+matwidth/2, Rhino.WorldYZPlane)
strSltRCrvO2 = Rhino.AddLine(arrSltROutPt, arrSltROutBPt)
strSltRCrvF = Rhino.AddLine(arrSltRCtrFPt, arrSltROutFPt)
strSltRCrvB = Rhino.AddLine (arrSltRCtrBPt, arrSltROutBPt)
Next
Next

Next
Call Rhino.EnableRedraw (True)
End Sub

FINAL PROJECT

Sina Mesdaghi

Therese Diede

Call Main()
Sub Main()
Dim i,j,d,k,p,q,u,v, arrPlane, Circle, strAttractor, strPath, extrude, arrPoint, arrPoints, intLoop, arrRndNumber, strPoints()
Dim UDomain, VDomain, UStep, VStep, dblDistance, arrAttractor, testDistance
Dim intU : intU = 100 ‘Horizontal
Dim intV : intV = 1 ‘Vertical
ReDim arrCrvPt(intU)
ReDim arrCrv(intV)
ReDim arrFrame(intU,intV)
ReDim arrPts(intU,intV)
ReDim arrPtNormal(intU,intV)
Dim dblMatThick : dblMatThick = 0.25
For q = 0 To 4
For p = 1 To 5
arrPlane = Rhino.PlaneFromPoints (Array(p*8,q*8,0), Array(p*8,q*8+1,0), Array(p*8+1,q*8,0))
circle = Rhino.AddCircle (arrPlane, 3.5)
strPath = Rhino.AddLine (Array(20,30,0), Array(20,30,dblMatThick/2))
extrude = Rhino.ExtrudeCurve (circle, strPath)
arrPoints = Rhino.DivideCurve (circle,(4+p*4))
intLoop = Random(0+p*3, UBound(arrPoints))
If intLoop < 2 Then intLoop = 2
For j = 0 To IntLoop
ReDim Preserve strPoints(j)
arrRndNumber = Random(0, UBound(arrPoints))
arrPoint = arrPoints(arrRndNumber)
strPoints(j) = Rhino.AddPoint (arrPoint)
Next
ReDim arrAttractors(UBound(strPoints))
d = (p+2)*20
k=0
For Each strAttractor In strPoints
arrAttractors(k) = Rhino.pointcoordinates (strAttractor)
k=k+1
Next
UDomain = Rhino.SurfaceDomain(extrude, 0)
VDomain = Rhino.SurfaceDomain(extrude, 1)
UStep = (UDomain(1) – UDomain(0)) / intU
VStep = (VDomain(1) – VDomain(0)) / intV
For j = 0 To intV
For i = 0 To intU
u = UDomain(0) + UStep * i
v = VDomain(0) + vStep * j
arrFrame(i,j) = Rhino.SurfaceFrame (extrude, Array(U,V))
dblDistance = d
For Each arrAttractor In arrAttractors
testDistance = Rhino.Distance (arrFrame(i,j)(0), arrAttractor)
If testDistance < dblDistance Then
dblDistance = testDistance
End If
Next
dblDistance = dblDistance/1
arrPtNormal(i,j) = Rhino.PointAdd(arrFrame(i,j)(0), Rhino.VectorScale (arrFrame(i,j)(3),dblDistance+(j*0.5)))
arrCrvPt(i) = arrPtNormal(i,j)
Next
arrCrv(j) = Rhino.AddCurve (arrCrvPt)
Next
Call Rhino.addLoftSrf (arrCrv)
Call Rhino.DeleteObjects (strPoints)
Call Rhino.DeleteObject (extrude)
Call Rhino.addLoftSrf (Array(circle,arrCrv(0)))
Call Rhino.SelectObject (arrCrv(1))
Call Rhino.Command (“PlanarSrf “)
Call Rhino.UnselectAllObjects
Call Rhino.MoveObject (circle, Array(0,0,0),Array(0,0,dblMatThick+0.1))
Call Rhino.OffsetCurve (circle, Array(0,0,0), 0.125)
Call Rhino.deleteObject (circle)
Call Rhino.deleteObjects (arrCrv)

Next
Next

End Sub

Function Random(nMin, nMax)
Random = Int((nMax – nMin)*Rnd + nMin)
End Function

final_render

final_process1

parametric lace_heath west

081211_layout_08

081211_layout_04

081211_layout_05

081211_layout_06

081211_layout_07

081211_layout_03

081211_layout_02

081211_layout_09

081211_layout_01

Option Explicit

Call distanceBasedRecursion()
Sub distanceBasedRecursion()

Dim strSrf : strSrf = Rhino.GetObjects (“Select surfaces”,8)
Dim arrPts : arrPts = Rhino.GetObjects (“Select points”,1)
Dim arrParameters : arrParameters = array(“Fall Off Distance from Points”, “Minimum Division Length”, “Maximum Division Length”)
Dim arrValues: arrValues = array(“2”, “2”, “4”)
Dim arrResults : arrResults = Rhino.PropertyListBox(arrParameters, arrValues, “Parameters”, “Distance Based Recursion” )
Dim fallOffDist, minLen, maxLen

If IsArray(arrResults) Then
fallOffDist = FormatNumber(arrResults(0))
fallOffDist = fallOffDist
minLen = FormatNumber(arrResults(1))
minLen = minLen
maxLen = FormatNumber(arrResults(2))
maxLen = maxLen
End If

Dim triangle
Call Rhino.Command (“selsrf “)
Dim arrTriangle : arrTriangle = Rhino.SelectedObjects
Rhino.EnableRedraw False
For Each triangle In arrTriangle
subdivideTriangle triangle
Next
Rhino.EnableRedraw True
End Sub

Function subdivideTriangle(triangle)
Dim triangleLength, vertexPts, centerPt, triangleCrv, srfParam, srfNormal, arrTri, nMin, nMax, i, j
arrTri = Rhino.DuplicateSurfaceBorder (triangle)

For Each triangleCrv In arrTri
triangleLength = Rhino.CurveLength(triangleCrv)

For i=0 To UBound(arrTri)
If (triangleLength > 1.5) Then

centerPt = Rhino.CurveAreaCentroid(triangleCrv)
srfParam = Rhino.SurfaceClosestPoint(triangle, centerPt(0))
srfNormal = Rhino.SurfaceNormal(triangle, srfParam)
vertexPts = Rhino.PolylineVertices(triangleCrv)

Dim midpt0, midpt1, midpt2, midpt3, midpt4, midmid3, midmid4, quarterPt0, quarterPt1, quarterPt2, quarterPt3, quarterPt4
Dim triangle0, triangle1, triangle2, triangle3, triangle4, triangle5, triangle6, triangle7

midPt0 = Array(((vertexPts(1)(0) + vertexPts(0)(0)))/2, ((vertexPts(1)(1) + vertexPts(0)(1)))/2, ((vertexPts(1)(2) + vertexPts(0)(2)))/2)
midPt1 = Array(((vertexPts(2)(0) + vertexPts(1)(0)))/2, ((vertexPts(2)(1) + vertexPts(1)(1)))/2, ((vertexPts(2)(2) + vertexPts(1)(2)))/2)
midPt2 = Array(((vertexPts(0)(0) + vertexPts(2)(0)))/2, ((vertexPts(0)(1) + vertexPts(2)(1)))/2, ((vertexPts(0)(2) + vertexPts(2)(2)))/2)
‘midPt3 = Array((vertexPts(3) (0) + vertexPts(4) (0))/2,(vertexPts(3) (1) + vertexPts(4) (1))/2, (vertexPts(3) (2) + vertexPts (4) (2))/2)
‘midPt4 = Array((vertexPts(4) (0) + vertexPts(0) (0))/2,(vertexPts(4) (1) + vertexPts(0) (1))/2, (vertexPts(4) (2) + vertexPts (0) (2))/2)

quarterPt0= Array((midPt0(0) + centerPt(0)(0))/2, (midPt0(1) + centerPt(0)(1))/2, (midPt0(2) + centerPt(0)(2))/2)
quarterPt1= Array((midPt1(0) + centerPt(0)(0))/2, (midPt1(1) + centerPt(0)(1))/2, (midPt1(2) + centerPt(0)(2))/2)
quarterPt2= Array((midPt2(0) + centerPt(0)(0))/2, (midPt2(1) + centerPt(0)(1))/2, (midPt2(2) + centerPt(0)(2))/2)
‘quarterPt3= Array((midPt3(0) + centerPt(0)(0))/2, (midPt3(1) + centerPt(0)(1))/2, (midPt3(2) + centerPt(0)(2))/2)
‘quarterPt4= Array((midPt4(0) + centerPt(0)(0))/2, (midPt4(1) + centerPt(0)(1))/2, (midPt4(2) + centerPt(0)(2))/2)

triangle4 = Rhino.AddSrfPt(Array(vertexPts(0), quarterPt0, quarterPt2))
triangle5 = Rhino.AddSrfPt(Array(vertexPts(1), quarterPt1, quarterPt0))
triangle6 = Rhino.AddSrfPt(Array(vertexPts(2), quarterPt2, quarterPt1))
‘triangle7 = Rhino.AddSrfPt(Array(quarterPt0, quarterPt1, quarterPt2, quarterPt0))

subdivideTriangle triangle4
subdivideTriangle triangle5
subdivideTriangle triangle6
‘subdivideTriangle triangle7’comment out this line to produce a sierpiński triangle

Rhino.DeleteObjects(Array(triangle, triangleCrv))
End If
Next

For j=0 To UBound(arrTri)
If (triangleLength > 3) Then

midPt0 = Array((vertexPts(0) (0) + vertexPts(1) (0))/2,(vertexPts(0) (1) + vertexPts(1) (1))/2, (vertexPts(0) (2) + vertexPts (1) (2))/2)
midPt1 = Array((vertexPts(1) (0) + vertexPts(2) (0))/2,(vertexPts(1) (1) + vertexPts(2) (1))/2, (vertexPts(1) (2) + vertexPts (2) (2))/2)
midPt2 = Array((vertexPts(2) (0) + vertexPts(3) (0))/2,(vertexPts(2) (1) + vertexPts(3) (1))/2, (vertexPts(2) (2) + vertexPts (3) (2))/2)
‘midPt3 = Array((vertexPts(3) (0) + vertexPts(4) (0))/2,(vertexPts(3) (1) + vertexPts(4) (1))/2, (vertexPts(3) (2) + vertexPts (4) (2))/2)
‘midPt4 = Array((vertexPts(4) (0) + vertexPts(0) (0))/2,(vertexPts(4) (1) + vertexPts(0) (1))/2, (vertexPts(4) (2) + vertexPts (0) (2))/2)

triangle0 = Rhino.AddSrfPt(Array(vertexPts(0), midPt0, midPt2))
triangle1 = Rhino.AddSrfPt(Array(vertexPts(1), midPt1, midPt0))
triangle2 = Rhino.AddSrfPt(Array(vertexPts(2), midPt2, midPt1))
triangle3 = Rhino.AddSrfPt(Array(midPt0, midPt1, midPt2, midPt0))

subdivideTriangle triangle0
subdivideTriangle triangle1
subdivideTriangle triangle2
subdivideTriangle triangle3’comment out this line to produce a sierpiński triangle

Rhino.DeleteObjects(Array(triangle, triangleCrv))
End If
Next
Next
End Function

Function RandomNumber(nMin, nMax)
RandomNumber = Null

If Not IsNumeric(nMin) Then Exit Function
If Not IsNumeric(nMax) Then Exit Function

If nMin >= nMax Then Exit Function
Randomize

RandomNumber = Int((nMax – nMin + 1) * Rnd + nMin)
End Function

TEN-Nobuhara_Rings : Series 1

rings_overal_croppedl

Series 1 by Thad Nobuhara @ smallscalecollective:

Set of parametric rings.  User can design # of faces, size of ring opening, and length of ring.   Project also allows for user to ‘design’ their own profile which is generated along the ring loops.

Script:

Option Explicit
‘Ring Script written by <Thad Nobuhara>
‘Script copyrighted by <smallscalecollective>
‘Script version Sunday, December 10, 2008 9:07:55 PM
‘Note: 1.815 is diameter of Thad’s finger

‘Script written for centimeter units

Call Main()
Sub Main()
Dim i, strElpse(), arrPlane
Dim intFacets : intFacets = rhino.GetInteger (“how many sides to your ring?”,16)
If IsNull (intFacets) Then Exit Sub
Dim dblWidth : dblWidth = rhino.GetReal (“how wide would you like your ring? (diameter)”,2.2)
If IsNull (dblWidth) Then Exit Sub
Dim dblLength : dblLength = rhino.GetReal (“how long would you like your ring?”,1)
If IsNull (dblLength) Then Exit Sub
Dim strObj : strObj = Rhino.GetObject(“select profile to orient”,4)
Dim dblRotAngle : dblRotAngle = 360/intFacets
For i = 0 To intFacets – 1
ReDim Preserve strElpse(i)
arrPlane = Rhino.PlaneFromPoints (Array(0,0,dblWidth/2), Array(1,0,dblWidth/2),array(0,1,dblWidth/2))
strElpse(i) = Rhino.AddEllipse (arrPlane,dblWidth/2,dblLength/2)
Call Rhino.RotateObject (strElpse(i),array(0,0,0),i*dblRotAngle,array(0,1,0))
‘call addProfile function
Next
Call orientProfile(strElpse, strObj)
End Sub
Sub orientProfile(strCrvs, strObj)
Dim arrCtPt : arrCtPt = Rhino.CurveAreaCentroid(strObj)

Dim strdecide: strdecide = Rhino.GetString(“wanna try to select points on your own?”,”no”,Array(“yes”,”no”))
Dim objDom : objDom = CurveDomain(strObj)
Dim xP
Dim yP

If strdecide = “no” Then
xP = Rhino.EvaluateCurve(strObj,0)
yP = Rhino.EvaluateCurve(strObj,(objDom(1)-objDom(0))/4)
Else
arrCtPt(0) = Rhino.GetPoint (“center Pt”)
xP = Rhino.GetPoint(,,”pt 1 on X dir”)
yP = Rhino.GetPoint(,,”pt 1 on Y dir”)
End If

Dim vNormal : vNormal = Rhino.VectorAdd (Rhino.VectorUnitize(Rhino.VectorCrossProduct(xP,yP)),arrCtPt(0))
‘Rhino.AddPoint vNormal
‘Rhino.AddTextDot “Nr”, vNormal
‘Rhino.AddPoint arrCtPt(0)
‘Rhino.AddTextDot “arrCtPt(0)”, arrCtPt(0)
‘Rhino.AddPoint (xP)
‘Rhino.AddTextDot “xP”, xP
‘Rhino.AddPoint (yP)
‘Rhino.AddTextDot “yP”, yP

Dim arrPerpPlane : arrPerpPlane = Rhino.PlaneFromFrame(arrCtPt(0),xP,yP)

‘let’s try to do the same with the curves…
Dim strCrv
Dim crvPt, crvTangent, crvPerp, crvNormal
Dim crvCurvature
Dim t

Dim orientObj()
Rhino.EnableRedraw False

For Each strCrv In strCrvs

Dim crvDom : crvDom = Rhino.CurveDomain(strCrv)

Dim arrStPt : arrStPt = Rhino.CurveStartPoint(strCrv)
Dim arrEnPt : arrEnPt = Rhino.CurveEndPoint(strCrv)
Dim m : m=0

For t =0 To crvDom(1) Step (crvDom(1)-crvDom(0))’/2
crvCurvature = Rhino.CurveCurvature(strCrv,t)
If IsNull (crvCurvature) Then
crvPt = Rhino.EvaluateCurve(strCrv,t)
crvTangent = Rhino.VectorUnitize(Rhino.CurveTangent(strCrv,t))
crvPerp = Array(0,0,1)
Else
crvPt = crvCurvature(0)
crvTangent = Rhino.VectorUnitize(crvCurvature(1))
crvPerp = Rhino.VectorUnitize(crvCurvature(4))
End If

crvNormal = Rhino.VectorAdd(Rhino.VectorUnitize(Rhino.VectorCrossProduct(crvTangent,crvPerp)),crvPt)
Dim CrossSectionPlane : CrossSectionPlane = Rhino.PlaneFromFrame(crvPt,crvPerp,crvNormal)
Dim xPtgt : xPtgt = Rhino.VectorAdd(Rhino.VectorUnitize(CrossSectionPlane(1)),crvPt)
Dim zPtgt : zPtgt = Rhino.VectorAdd(Rhino.VectorUnitize(CrossSectionPlane(2)),crvPt)

‘Rhino.AddPoint crvNormal
‘Rhino.AddTextDot “Nr”, crvNormal
‘Rhino.AddPoint xPtgt
‘Rhino.AddTextDot “xPtgt”, xPtgt
‘Rhino.AddPoint zPtgt
‘Rhino.AddTextDot “zPtgt”, zPtgt

Dim strObj2 : strObj2 = Rhino.CopyObject(strObj,Array(0,0,0),Array(0,0,0))

‘We orient the object
ReDim Preserve orientObj(m)
orientObj(m) = Rhino.OrientObject (strObj2,Array(arrCtPt(0),xP,yP),Array(crvPt,xPtgt,crvNormal),1)

‘we scale the object
‘for the scalefactor we need to “unitize” the domain
”   Dim scalefactor, n
”   Dim unitize : unitize = crvDom(1)-crvDom(0)
”   n = 180*(t-crvDom(0))/unitize
”   Rhino.Print(n)
”   If n = 0 Or n Mod 180 =0 Then
”    scalefactor =.5
”   Else
”    scalefactor = .5
”   End If

”   Rhino.ScaleObject orientObj(m),crvPt,Array(scalefactor,scalefactor,scalefactor)
Rhino.DeleteObject(strObj2)
m =m+1
Next
Rhino.Command “-Sweep1 _SelID ” & strCrv & ” _SelID ” & orientObj(0) & “_enter _enter Natural enter enter”
Rhino.DeleteObjects orientObj
Rhino.DeleteObject strCrv
‘” _SelID ” & orientObj(1) & ” _SelID ” & orientObj(2) &

Next
Rhino.EnableRedraw True

End Sub