Tag Archives: Thad Nobuhara

TEN-Nobuhara_Rings : Series 1


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.


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
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)
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)
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)
m =m+1
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) &

Rhino.EnableRedraw True

End Sub


Thad Nobuhara_ten2101_Vase

Option Explicit
‘Script written by TEN of the sscollective
‘Script version Tuesday, October 21, 2008 1:08:31 PM

Call Main()
Sub Main()
Dim arrPlane1, arrPlane2, i, j, strCrv(), strInnerCrv(), arrLftSrf1, arrLftSrf2, arrLftSrf3, arrLftSrf4, arrLftSrf5, arrLftSrf6, strSrf1, strSrf2, strSrf3
Dim intWidth1 : intWidth1  = RandomNumber(2,5)
Dim intWidth2 : intWidth2  = RandomNumber(5,10)
Dim intMatWidth : intMatWidth = .25
Dim intTopWid : intTopWid = intWidth2 – 2
For j = 0 To 5
For i = 0 To 10
ReDim Preserve strCrv(i)
ReDim Preserve strCrv2(i)
ReDim Preserve strCrv3(i)
ReDim Preserve strInnerCrv(i)
arrPlane1 = Rhino.PlaneFromPoints (Array(0,j*25,i*(j+1)+1), Array(1,j*25,i*(j+1)), Array(0,j*25+1,i*(j+1)))
arrPlane2 = Rhino.PlaneFromPoints (Array(0,j*25,i*(j+1)-1), Array(1,j*25,i*(j+1)), Array(0,j*25+1,i*(j+1)))
If i < 6 Then
strCrv(i) = Rhino.AddCircle (arrPlane1, intWidth1)
strInnerCrv(i) = Rhino.AddCircle (arrPlane1, intWidth1-intMatWidth)
End If
If i >= 6 And i<8 Then
strCrv(i) = Rhino.AddCircle (arrPlane2, intWidth2)
strInnerCrv(i) = Rhino.AddCircle (arrPlane2, intWidth2-intMatWidth)
End If
If i >=8 Then
strCrv(i) = Rhino.AddCircle (arrPlane1, intWidth1)
strInnerCrv(i) = Rhino.AddCircle (arrPlane1, intWidth1-1-intMatWidth)
End If
If i = 10 Then
strCrv(i) = Rhino.AddCircle (arrPlane2, 10)
strInnerCrv(i) = Rhino.AddCircle (arrPlane2, 9)
End If
If i = 0 Then
strSrf1 = Rhino.AddPlanarSrf (strCrv)
strSrf2 = Rhino.AddPlanarSrf (strInnerCrv)
End If
arrLftSrf4 = Rhino.AddLoftSrf (strCrv,,,1)
arrLftSrf6 = Rhino.AddLoftSrf (strInnerCrv,,,1)
Call Rhino.deleteobjects (strCrv)
Call Rhino.DeleteObjects (strInnerCrv)
End Sub
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


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

End Function