06 November 2011

rh phy tower 01











This rhinoscript works as tower generator and tesselates the resulting surface with a seed system that follow a lattice pattern. Colors are defined by the distance of the centroid of seeds to one attractor.

CONFLUENCES_workshop series
This exercise will be explained during the Rhinoscript // Reptile skin Workshop, for more info check this link:

Mesh relaxation 01



Mesh relaxation:
We can assume that each node in mesh is a mass point and that this mass has connections with springs to other nodes. If string length differs from original, node will be forced into movement. Angles between connection can be similarly constrained.

This is a simulation of a tensile structure using kangaroo component, with slider we can simulate the behavior of the mesh applying positive or negative forces on all vertices, except the constrain points.


CONFLUENCES_workshop series
This exercise will be explained during the Grasshopper // Clever skin Workshop, for more info check this link:

17 October 2011

rh color scale attractor


This script apply a gradient color and scales an array of objects.


Option Explicit
Call Main()
Sub Main()
Dim object,attr,bottles,attr1,points,i,arrpoints
bottles= rhino.getobjects (" select bottles")

attr=rhino.getobject (" select attractor",1)
attr1=Rhino.PointCoordinates(attr)
For i=0 To Ubound(bottles)


object=rhino.surfaceVolumecentroid (bottles(i))

Dim dist:dist= rhino.distance ( object(0), attr1)

Dim material5

material5 = rhino.AddMaterialToObject ( bottles(i))
Call rhino.MaterialColor (material5, rgb((dist*100)+10,(dist*30),(dist*60)+10))
Call rhino.MaterialShine (material5, 255)
Call rhino.ScaleObject (bottles(i),object(0),array(dist*0.5,dist*0.5,dist*0.5),False)
Next

End Sub

rh If Then Else


Very simple rhinoscript to understand the "If then else" logic.

Option Explicit
'Script written by davide del giudice
'Script copyrighted by www.co-de-it.com
'Script version lunedì 17 ottobre 2011 16.52.36
Call IfThenElse()
Sub IfThenElse()

Dim arrpointsA,arrpointsB,i,arrA,arrB
arrpointsA=rhino.GetObjects ("select points A",1)
arrpointsB=rhino.GetObjects("select points B",1)



For i=0 To Ubound (arrpointsA)


arrA= Rhino.PointCoordinates (arrpointsA(i))
arrB= Rhino.PointCoordinates (arrpointsB(i))

Dim distance:distance= rhino.distance (arrA,arrB)
If rhino.Distance( arrA, arrB)<4 Then
Dim sphere1:sphere1=rhino.addsphere (arrB,1)
Call rhino.ObjectColor (sphere1, rgb(50,125,50))
Else
Dim sphere2:sphere2= rhino.AddSphere (arrB,1.5)
Call rhino.ObjectColor (sphere2, rgb(150,200,150))
End If

Next
End Sub

14 October 2011

rh in progress

New rhinoscript coming soon: seed tesselationreptile skin
recursive subdivision

09 October 2011

rh UnrollSrfs


This is yet another unroll rhinoscript.
Download the rhino file and .rvb here

----------
Option Explicit
'Script written by davide del giudice
'Script copyrighted by www.co-de-it.com
'Script version Saturday, 09 Oct 2011


Call UnrollSrfs()
Sub UnrollSrfs()
Dim arrsrf
arrsrf=rhino.GetObjects("select surfaces",8+16)
Call unroll(arrsrf)
End Sub
Function unroll(arrsrf)
Dim i,arrUnrolledObj,counter,counter2
ReDim arrUnrolledObj(UBOUND(arrsrf))
counter=0
counter2=0
For i=0 To UBound(arrsrf)

Call Rhino.SelectObject(arrsrf(i))
Dim arrmp:arrmp= rhino.SurfaceAreaCentroid (arrsrf(i))
Dim area1:area1= rhino.surfacearea (arrsrf(i))
Dim area:area=Rhino.Ceil ((area1(0)/100))
Dim dot:dot= rhino.AddTextDot ("n#"&counter, arrmp(0))
Call rhino.ObjectColor (dot, rgb (((counter*10)+10),((counter*10)+50),((counter*10)+50)))
Rhino.Command "_Unrollsrf explode=no enter"
Call Rhino.UnselectAllObjects
arrUnrolledObj(i) = Rhino.FirstObject
Dim centroid:centroid=Rhino.SurfaceAreaCentroid (arrUnrolledObj(i))

If i
rhino.addpoint array(counter*100,50,0)
Call rhino.MoveObject (arrUnrolledObj(i),centroid(0),array(counter*100,50,0))
Dim txt2:txt2=rhino.AddText ("n"&counter&"_"&area&"cmq",array(counter*100,50,0),6)
Call rhino.ObjectColor (txt2, rgb (0,0,255))
Else
rhino.addpoint array(counter2*100,-100,0)
Call rhino.MoveObject (arrUnrolledObj(i),centroid(0),array(counter2*100,-100,0))
Dim txt4:txt4=rhino.AddText ("n"&counter&"_"&area&"cmq",array(counter2*100,-100,0),6)
Call rhino.ObjectColor (txt4, rgb (0,0,255))
counter2=counter2+1
End If
Dim arredge:arrEdge = Rhino.DuplicateEdgeCurves(arrUnrolledObj(i))
Call Rhino.JoinCurves(arrEdge,True)
Call Rhino.DeleteObject(arrUnrolledObj(i))
counter=counter+1
Next
End Function
---------