Option Explicit
Call Weld()
Sub Weld()
Dim aSrfs : aSrfs = Rhino.GetObjects(“Select Surface”,
Dim i,n
Dim aPts()
Dim udom, vdom, uparam, vparam, arrpt, udiv, vdiv
udiv = 100
vdiv = 50
For i = 0 To UBound(aSrfs)
n = 0
Dim strsurface : strSurface = aSrfs(i)
ReDim colec2d(udiv, vdiv)
udom = Rhino.SurfaceDomain(strsurface,0)
vdom = Rhino.SurfaceDomain(strsurface,1)
Rhino.EnableRedraw False
Do Until n = 1000
uparam = udom(0) + rnd * (udom(1) – udom(0))
vparam = vdom(0) + rnd * (vdom(1) – vdom(0))
ReDim Preserve aPts(n)
aPts(n) = Rhino.EvaluateSurface(strsurface, array(uparam, vparam))
If n >= 1 Then
Dim vDir : vDir = rhino.VectorCreate(aPts(n-1), aPts(n))
vDir = rhino.VectorScale(rhino.VectorUnitize(vDir), 0.05)
Dim aPtEnd : aPtEnd = rhino.PointAdd(aPts(n), vDir)
Dim aParam : aParam = rhino.SurfaceClosestPoint(strSurface,aPtend)
’ curly
’Dim scrv : sCrv = Rhino.AddInterpCrvOnSrfUV (strSurface, array(array(uparam, vparam),aParam))
’ ribars
Dim scrv : sCrv = Rhino.AddLine (aPts(n), rhino.EvaluateSurface(strSurface,aParam) )
Call Rhino.ExtendCurveLength (sCrv, 0, 0, (RN(0.05, 0.2)))
End If
n = n + 1
Loop
Rhino.EnableRedraw True
Next
End Sub
Function RN (nMin, nMax)
RN = Null
Randomize
RN = (nMax – nMin) * Rnd + nMin
End Function
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
You must be logged in to post a comment.