Option Explicit
Call Main()
Sub Main()
Call Rhino.AddLayer(“Voro3DCurves”, RGB(0, 255, 0))
Rhino.CurrentLayer(“Voro3DCurves”)
Dim aCrvs : aCrvs = Rhino.GetObjects(“Pick Voronoi Cells”, 4)
Dim i,j
For i = 0 To UBound( aCrvs)
Dim x,y,z,d
x = funcRnd(0.9,0)
y = x + funcRnd(0.3,0.1)
‘y = funcRnd(0.9,0)
‘y = x
‘z = funcRnd(1,0.9)
z = 1
d = funcRnd(0.5,0.1)
If Rhino.IsCurveClosed(aCrvs(i)) And Rhino.IsPolyline(aCrvs(i)) Then
Dim aCtrlPts : aCtrlPts = Rhino.PolylineVertices(acrvs(i))
ReDim aPts(UBound(aCtrlPts)+1)
For j = 0 To UBound(aCtrlPts)
Dim aPlane : aPlane = Rhino.WorldXYPlane
Dim vDir : vDir = Rhino.VectorScale(aPlane(3), funcRnd(600,500))
aPts(j) = Rhino.PointAdd(aCtrlPts(j), vDir)
Next
aPts(UBound(aCtrlPts)+1) = aPts(0)
Dim VoroCurve3D : VoroCurve3D = Rhino.AddCurve(aPts)
Dim arrBBox: arrBBox = Rhino.BoundingBox(VoroCurve3D)
Dim arrCntrPt : arrCntrPt = array((((arrBBox(2)(0)) + (arrBBox(0)(0))) / 2)+d, (((arrBBox(2)(1)) + (arrBBox(0)(1))) / 2)+d, (((arrBBox(0)(2)) + (arrBBox(4)(2))) / 2)+d)
Dim ScVoroCurve3D : ScVoroCurve3D = Rhino.ScaleObject(VoroCurve3D,arrCntrPt,array(x,y,z),True)
Call Rhino.ObjectColor(ScVoroCurve3D, RGB(0, 0, 255))
End If
Next
‘Rhino.Command(“_MeshPatch”)
‘Rhino.Command(“_OffsetMesh”)
End Sub
Function funcRnd(max,min)
Randomize
funcRnd = (max-min) * Rnd + min
End Function
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.