181008_WeldedWire

aggreg

 

 

 

 

 

 

 

 

 

 

Option Explicit
Call Weld()

Sub Weld()

 Dim aSrfs : aSrfs = Rhino.GetObjects(“Select Surface”, 8)
 
 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

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s