23.11.11

Panal


Modelo en Rhinoceros con Scrip a partir de hexagonos creados de forma aleatoria. 

Se crea un panal con un hexagono doble, posteriormente se eleva de forma aleatoria el hexagono interior, y se realiza un loft entre ambos. Se cambia el color de objeto para crear el degradado.

 *Nota: Para acceder al código leer información adicional.

Option Explicit
'Script written by <Nymeria>
'Script copyrighted by
'Script version viernes, 12 de octubre de 2011 21:54:35

Call Main()
Sub Main()
Dim i,j,var
Dim arrPt1, arrPt2, arrPt3, arrPt4, arrPt5, arrPt6
Dim arrPtCenter, arrPtCenter2

Dim maxI, minI, maxJ, minJ
Dim cellSpace
Dim z

minI = Int(3*Rnd)
maxI = Int((17-12)*Rnd+10)

cellSpace = 4
z = 10
Dim strPl, strPl2

Rhino.EnableRedraw False

For i = minI To maxI

minJ = Int(4*Rnd)
maxJ = Int((14-10)*Rnd+8)

For j = minJ To maxJ

If i/2=Int(i/2) Then
var=0
Else
var=2
End If

arrPt1 = array ((3*i)*cellSpace,((4*j)+var)*cellSpace,z)
arrPt2 = array (((3*i)+1)*cellSpace,((4*j)+2+var)*cellSpace,z)
arrPt3 = array (((3*i)+3)*cellSpace,((4*j)+2+var)*cellSpace,z)
arrPt4 = array (((3*i)+4)*cellSpace,((4*j)+var)*cellSpace,z)
arrPt5 = array (((3*i)+3)*cellSpace,((4*j)-2+var)*cellSpace,z)
arrPt6 = array (((3*i)+1)*cellSpace,((4*j)-2+var)*cellSpace,z)

arrPtCenter = array (((3*i)+2)*cellSpace,((4*j)+var)*cellSpace,z)

strPl = Rhino.AddPolyline (array (arrPt1,arrPt2,arrPt3,arrPt4,arrPt5,arrPt6,arrPt1))
strPl2 = Rhino.AddPolyline (array (arrPt1,arrPt2,arrPt3,arrPt4,arrPt5,arrPt6,arrPt1))

Rhino.ScaleObject strPl2, arrPtCenter, array (0.5,0.5,0.5)

If i/2=Int(i/2) Then
arrPtCenter2 = array (((3*i)+2)*cellSpace,((4*j)+var)*cellSpace,z+ Int(8*Rnd))

Else
arrPtCenter2 = array (((3*i)+2)*cellSpace,((4*j)+var)*cellSpace,z- Int(8*Rnd))

End If

Rhino.MoveObject StrPl2,arrPtCenter,arrPtCenter2

Rhino.SelectObject strPl
Rhino.SelectObject strPl2
Dim strSrf
Rhino.Command "-_loft _enter _enter",0
strSrf = Rhino.FirstObject
Rhino.ObjectColor strSrf,RGB (10,250-j*(i+5),99+j*10)
Rhino.UnselectAllObjects

Next
Next

Rhino.EnableRedraw True

End Sub

No hay comentarios:

Publicar un comentario