20.2.09
Today NAO saved me
This graasshopper definition create a self turning tower in elliptic base
Thanks to Jonas of NAO for the fantastic tutorial
It's just an exercise, but the result is very nice
19.2.09
Surface tesselation
Hey everyone! I made some experiments with surface tesselation, here they are!
I tried different kind of tesselation on a ruled surface and on a spiral loft surface, the script which made the spiral has been published yet so I won't bother you with that (you can just scroll down to see some examples)..
First of all a simple script that use the u & v surface's parameters to tesselate them with simple 2nd grade lofted curves (I am nesting words). It is very similar to the one we made in class, so, no surprises..
Option Explicit
' . Script written by Vincenzo Reale
' . univin@libero.it
'Script version lunedì 16 febbraio 2009 15.15.59
Call Main()
Sub Main()
'strline = rhino.GetObject("get line for extrusion lenght")
'this is for the following part, uncheck later
'input surface
Dim strSurf: strSurf = rhino.GetObject("select a surface",8)
Dim Intuint : intuInt = rhino.GetInteger("n. of U intervals?",10,10)
Dim Intvint : intvInt = rhino.GetInteger("n. of v intervals?",10,10)
'get surface domain (u and v), dobbiamo dirgli la direzione
Call rhino.EnableRedraw (False)
Dim arrUdom, arrVdom
arrUdom = Rhino.SurfaceDomain(strsurf,0)
arrVdom = Rhino.SurfaceDomain(strsurf,1)
Dim i, j
Dim arrPt, upar, vpar
Dim srfframe
ReDim arrPt(intUint-1, intVint-1)
' evaluating points on surface
For i = 0 To Intuint-1
For j = 0 To intvint-1
'calculating u and v steps
upar = arrudom(0) + i*(arrudom(1)-arrudom(0))/(intuint-1)
vpar = arrudom(0) + j*(arrvdom(1)-arrvdom(0))/(intvint-1)
arrpt (i,j) = rhino.EvaluateSurface(strsurf,array(upar,vpar))
Next
Next
' !!! the next part is the one that will be changed during the experiment, so just
' paste the new lines from here....
Dim arrpanel
Dim strcurve1
For i = 0 To Intuint-2
For j = 0 To intvint-2
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,2)
Call rhino.AddPlanarSrf(array(strcurve1))
arrpanel = array (arrpt(i+1,j), arrpt(i+1,j+1), arrpt(i,j+1),arrpt(i+1,j))
strcurve1 = rhino.addcurve(arrpanel,2)
Call rhino.AddPlanarSrf(array(strcurve1))
Next
Next
' ...to here !!!!!
Call rhino.DeleteObject(strsurf) 'you can switch this off
Call rhino.EnableRedraw(True)
End Sub
Then, the surface is tessellated with hexagonal cells. Perimeter of hexagons are extruded to look like honeycomb. Extrusion height is taken from a line you have to draw! (so don't forget unchecking the line part)
In this case there are no planar surfaces that can be created with that six points (they are not on a plane) so do you know what is the right command to create three dimensional surfaces with six points or a three dimensional border? By the way different inclinations of the extrusion line path will give you different results (the first is perpendicular to the base plane, se second parallel to it). Possibilities: the extrusion path may be linked either with the perpendicular vector of the surface in any point, or with one or more influence points.
just put into the first scritp this:
Dim arrpanel
Dim strcurve1
For i = 1 To Intuint-3 Step 4
For j = 1 To intvint-4 Step 2
'this is the hexagonal tesselation point, you can imagine them on a grid
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+1,j+2),arrpt(i,j+2),arrpt(i-1,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,1)
Call rhino.ExtrudeCurve(strcurve1,strline)
Call rhino.AddPlanarSrf(array(strcurve1))
Next
Next
For i = 3 To Intuint-3 Step 4
For j = 2 To intvint-4 Step 2
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+1,j+2),arrpt(i,j+2),arrpt(i-1,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,1)
Call rhino.ExtrudeCurve(strcurve1,strline)
Call rhino.AddPlanarSrf(array(strcurve1))
Next
Next
Now, third tesselation is similar to the previous one but the nesting is different, in this case you have three loops
Dim arrpanel
Dim strcurve1
For i = 0 To Intuint-3 Step 3
For j = 0 To intvint-3 Step 3
'this is the other nesting, draw it on a grid to undestand how it works
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,1)
Call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
For i = 2 To Intuint-1 Step 3
For j = 1 To intvint-2 Step 3
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,1)
Call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
For i = 1 To Intuint-2 Step 3
For j = 2 To intvint-1 Step 3
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
strcurve1 = rhino.addcurve(arrpanel,1)
Call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
Fourth, variation with three planar surfaces interpolated with the hexagonal points (Same problem, how to make a non planar surface from six points? And by the way i CAN'T FIND how to pipe a curve!)
Dim arrpanel, arrcrvpoint
Dim strcurve1, strcurve2, strcurve3, strcurve4
For i = 0 To Intuint-3 Step 3
For j = 0 To intvint-3 Step 3
' i take the hexagon border point and I made two dimensional curves with three points at time as control points
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
arrcrvpoint= array(arrpanel(0), arrpanel(1),arrpanel(4),arrpanel(0))
strcurve1 = rhino.addcurve(arrpanel,1)
strcurve2 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(2), arrpanel(3),arrpanel(0),arrpanel(2))
strcurve3 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(4), arrpanel(5),arrpanel(2),arrpanel(4))
strcurve4 = rhino.AddCurve(arrcrvpoint,2)
Call Rhino.AddPlanarSrf (array(strcurve2,strcurve3,strcurve4))
Call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
For i = 2 To Intuint-3 Step 3
For j = 1 To intvint-3 Step 3
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
arrcrvpoint= array(arrpanel(0), arrpanel(1),arrpanel(4),arrpanel(0))
strcurve1 = rhino.addcurve(arrpanel,1)
strcurve2 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(2), arrpanel(3),arrpanel(0),arrpanel(2))
strcurve3 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(4), arrpanel(5),arrpanel(2),arrpanel(4))
strcurve4 = rhino.AddCurve(arrcrvpoint,2)
Call Rhino.AddPlanarSrf (array(strcurve2,strcurve3,strcurve4))
call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
For i = 1 To Intuint-3 Step 3
For j = 2 To intvint-2 Step 3
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i+2,j+1),arrpt(i+2,j+2),arrpt(i+1,j+2),arrpt(i,j+1),arrpt(i,j))
arrcrvpoint= array(arrpanel(0), arrpanel(1),arrpanel(4),arrpanel(0))
strcurve1 = rhino.addcurve(arrpanel,1)
strcurve2 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(2), arrpanel(3),arrpanel(0),arrpanel(2))
strcurve3 = rhino.AddCurve(arrcrvpoint,2)
arrcrvpoint= array(arrpanel(4), arrpanel(5),arrpanel(2),arrpanel(4))
strcurve4 = rhino.AddCurve(arrcrvpoint,2)
Call Rhino.AddPlanarSrf (array(strcurve2,strcurve3,strcurve4))
call rhino.ExtrudeCurve(strcurve1,strline)
Next
Next
At last a triangular tesselation within a planar curve (2°grade) tasselation which creates holes dipending on the distance between the tassel and the control point. You can change the threshold for the point influence and also choose different behaviour for border panels (I made some notes). I wonder if there is a way to create holes directly to the three dimensional surface instead on the triangolar tassels .
Nevertheless, here is the script
Option Explicit
' . Script written by Vincenzo Reale
' . univin@libero.it
'Script version since mercoledì 18 febbraio 2009 23.40.00 to very very late at night
Call Main()
Sub Main()
' get a surface
Dim strSurf: strSurf = rhino.GetObject("select a surface",8)
Dim Intuint : intuInt = rhino.GetInteger("n. of U intervals?",10,2)
Dim Intvint : intvInt = rhino.GetInteger("n. of v intervals?",10,2)
'get point attractor
Dim strAtt: strAtt = Rhino.GetObject("select attractor point",1)
Dim arrpatt: arrpAtt = Rhino.PointCoordinates(stratt)
Dim dblTdist: dblTdist = Rhino.GetReal("threshold distance?", 2,1)
Call rhino.EnableRedraw (False)
Dim arrUdom, arrVdom
arrUdom = Rhino.SurfaceDomain(strsurf,0)
arrVdom = Rhino.SurfaceDomain(strsurf,1)
Dim i, j
Dim arrPt, upar, vpar
ReDim arrPt(intUint-1 , intVint-1)
For i = 0 To Intuint-1
For j = 0 To intvint-1
'calculating u and v steps
upar = arrudom(0) + i*(arrudom(1)-arrudom(0))/(intuint-1)
vpar = arrudom(0) + j*(arrvdom(1)-arrvdom(0))/(intvint-1)
arrpt (i,j) = rhino.EvaluateSurface(strsurf,array(upar,vpar))
Next
Next
Dim arrpanel
Dim strcurvepanel, strcurvecircle
Dim arrsurfpanel, arrsurfcircle, arrlateral
Dim strcut, arrCP, dbldist1, dblscale
For i = 0 To Intuint-2
For j = 0 To intvint-2
'arrpanel is the triangular tesselation, strcurve panel is the curve that trim the first tesselation with rhino.splitbrep
' the scale is weighted with the distance of the surface central point (area centroid) and the threshold
arrpanel = array (arrpt(i,j),arrpt(i+1,j), arrpt(i,j+1),arrpt(i,j))
strcurvepanel = rhino.addcurve(arrpanel,1)
strcurvecircle = rhino.addcurve (arrpanel,2)
arrsurfpanel = rhino.addsrfpt(arrpanel)
arrCP = Rhino.CurveAreaCentroid (strcurvepanel)
dbldist1 = rhino.distance(arrcp(0),arrpatt)
If dblDist1 <>
dblscale = 1-(dbltdist-dbldist1)/dbltdist
Call rhino.scaleobject(strcurvecircle,arrCP(0),array(dblscale,dblscale,dblscale))
End If
'if you put this part from here...
arrsurfcircle = rhino.AddPlanarSrf(array(strcurvecircle))
strcut = Rhino.SplitBrep(arrsurfpanel,arrsurfcircle(0),True)
Call rhino.deleteobject (arrsurfcircle(0))
' Call rhino.deleteobject (arrsurfpanel(0))
Call rhino.deleteobject (strcut(0))
Call rhino.deleteobject (strcurvepanel)
Call rhino.deleteobject (strcurvecircle)
' to here inside the if clause you get the surface outside the threshold influence whith holes (this case) or not, first two pics. Do it also in the other loop
Next
Next
For i = 1 To Intuint-1
For j = 0 To intvint-2
arrpanel = array (arrpt(i,j),arrpt(i,j+1), arrpt(i-1,j+1),arrpt(i,j))
strcurvepanel = rhino.addcurve(arrpanel,1)
strcurvecircle = rhino.addcurve (arrpanel,2)
arrsurfpanel = rhino.addsrfpt(arrpanel)
arrCP = Rhino.CurveAreaCentroid (strcurvepanel)
dbldist1 = rhino.distance(arrcp(0),arrpatt)
If dblDist1 <>
dblscale = 1-(dbltdist-dbldist1)/dbltdist
Call rhino.scaleobject(strcurvecircle,arrCP(0),array(dblscale,dblscale,dblscale))
End If
arrsurfcircle = rhino.AddPlanarSrf(array(strcurvecircle))
strcut = Rhino.SplitBrep(arrsurfpanel,arrsurfcircle(0),True)
Call rhino.deleteobject (arrsurfcircle(0))
' Call rhino.deleteobject (arrsurfpanel(0))
Call rhino.deleteobject (strcut(0))
Call rhino.deleteobject (strcurvepanel)
Call rhino.deleteobject (strcurvecircle)
Next
Next
Call rhino.deleteobject(strsurf)
Call rhino.enableredraw(True)
End Sub
Subscribe to:
Posts (Atom)