20 April 2010
project 2 - scripting extended - BojaShell
for this project i used creation of curves with user defined parameters to surface the spine of shell. the script is not user friendly until i start managing the function calls to speed up script building. until such time i am doing everything long way to understand the inner workings of scripting to the full.
'calculation x
Dim M, n, Mx
ReDim M(z), Mx(z)
For n = 0 To z
M(n) = Rhino.Distance(cPt, Pt(n))
Mx(n) = Rhino.Distance(cPt, Ptx(n))
Next
for script details and other info read more.
.::DOWNLOAD SCRIPT::.
the script will be modified for user input if i get the time, there is just too many interesting possibilities to be making pretty scripts that are fairly basic with the shapes they create. for now if you choose to play with the script do not forget to keep the creator tagged somewhere.
project 3 - BojaShell
Option Explicit
'Script written by shane gregoran
'Script copyrighted by sinQb
'Script version 17. april 2010 15:35:44
Call BojaShell()
Sub BojaShell()
Dim cPt : cPt = Array(0,0,0) 'can be user defined later
Dim cPtz : cPtz = Array(0,0,3) 'can be user defined later
'user input for the relative size will be added later
Dim Ax : Ax =20
Dim A : A = 20
Dim Ay : Ay = A*2
Dim z : z = 3 'separation on Ay
Dim z1 : z1 = Ay/z
'starting point for the arcs
Dim cirC : cirC = Array(Ax,0,-Ax)
Dim PtStrt : PtStrt = Array(Ax,0,0)
'far side end points along y
Dim Pt(), b, Ptx
ReDim Pt(z), Ptx(z)
For b = 0 To z
Pt(b) = Array (Ax*2,b*z1,0)
Ptx(b) = Array (b*z1,Ay,0)
Next
'first arc displacement - can be user defined - center point of arc
Dim distSPt1 : distSPt1 = Rhino.Distance(cPt, cirC)
Dim P : P = distSPt1*1.05 'height of central arcs
'calculation x
Dim M, n, Mx
ReDim M(z), Mx(z)
For n = 0 To z
M(n) = Rhino.Distance(cPt, Pt(n))
Mx(n) = Rhino.Distance(cPt, Ptx(n))
Next
'calculation y
Dim Gy, hy, Gx
ReDim Gy(z), Gx(z)
For hy = 0 To z
Gy(hy) = Sqr((M(hy)/2)^2 - Ax^2)
Gx(hy) = Sqr((Mx(hy)/2)^2 - A^2)
Next
'mid calculation for arcs
Dim arc1(), d, arc1x()
ReDim arc1(z), arc1x(z)
For d = 0 To z
arc1(d) = Array(Ay/2,Gy(d),-Ax+P)
arc1x(d) = Array(Gx(d),Ax*2/2,-Ax+P)
Next
'arcs from center point
Dim arrArc(), c, arrArcX()
ReDim arrArc(z), arrArcX(z)
For c = 0 To z
arrArc(c) = Rhino.AddArc3Pt(cPt,Pt(c),arc1(c))
arrArcX(c) = Rhino.AddArc3Pt(cPt, Ptx(c),arc1x(c))
Next
'making cross arcs
Dim CsA(), CsB(), Yax(), u, uu, CsAx(), CsBx()
Dim i : i = z-1
ReDim Yax(i), CsB(i), CsBx(i)
For u = 0 To i
Yax(u) = (z1/2)+(u*z1)
Next
'last digit 4 can be changed for hight
For uu = 0 To i
CsB(uu) = Array(Ax*2,Yax(uu),4)
CsBx(uu) = Array(Yax(uu),Ay,4)
Next
Dim j, jj
ReDim CsA(i), CsAx(i)
For j = 0 To i
jj = j+1
CsA(j) = Rhino.AddArc3Pt(Pt(j),Pt(jj),CsB(j))
CsAx(j) = Rhino.AddArc3Pt(Ptx(j),Ptx(jj),CsBx(j))
Next
'lets loft the thing
Dim LoftA(), r, rr, LoftB(), SurfA()
ReDim LoftA(i), LoftB(i), SurfA(i)
For r = 0 To i
rr = r + 1
LoftA(r) = Array(arrArc(r), arrArc(rr), CsA(r))
LoftB(r) = Array(arrArcX(r), arrArcX(rr), CsAx(r))
'this bit is for string set if i choose to use it in future
SurfA(r) = Rhino.AddEdgeSrf (Array(arrArc(r), arrArc(rr), CsA(r)))
Rhino.AddEdgeSrf LoftB(r)
Next
End Sub
Labels:
Downloads,
Rhino VB Script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment