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
---------

0 commenti: