Grasshopper

algorithmic modeling for Rhino

hi

 

i am trying to divide my curve base on divition points , i know i am doing something stupied  somewhere ,, i am getting NUll instead of curves  i äd appriciate any suggestions ... thanks

 

Private Sub RunScript(ByVal x As Curve, ByVal y As Integer, ByRef A As Object)
Dim nl As Double()
Dim nl1 As New List (Of Double)
Dim crv As Curve() =  Nothing
Dim crv1 As New  List (Of Curve())


nl = x.DivideByCount(y, True)
For i As Integer = 0 To Ubound(nl)
nl1.Add(nl(i))
crv = x.Split(nl1)
Crv1.add(crv)

Next


A = Crv1

End Sub

Views: 85

Reply to This

Replies to This Discussion

I'm not sure why the split method doesen't work when using a list of numbers, it might be a bug. A way around it is to do something like this:

 

Dim nl As New list(Of Double)

Dim crvl As New list(Of curve)

 

nl.addrange(x.DivideByCount(y, False))

crvl.add(x)

 

For i As Integer = 0 To nl.count - 1

Dim crv As curve = crvl(crvl.count - 1)

crvl.removeat(crvl.count - 1)

crvl.addrange(crv.Split(nl(i)))

Next

a = crvl

thanks ,,, buddy it helps a lot ,,,

Does anyone know if this bug has been addressed in the latest build of rhinocommon built into 8.0011 (a project I’m working on with others is currently standardised on 8.0010) I'm having a similar issue with a list of parameters on a curve (I’ve checked and they are in the domain of the curve) single doubles work with split but a list or an array doesn’t)

 

If it is still broken i can always use Vicents nice bit of code...

I found the bug and fixed it. I'm hoping to release a new version later today, but for the fix in Rhino5 you'll have to wait until the next R5 update.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2014   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service