Grasshopper

algorithmic modeling for Rhino

I want to make a series of transformations to a DataTree which was created inside a VB component (iteratively adding vectors to initial points).

Once it's created with the initial points, however, any attempts to change the value returns:

Error: Property 'Item' is 'ReadOnly'. (line xxx)

I'm using: myTree(path, index)+=xVector

is there a way of rewriting datatrees?

Views: 352

Replies to This Discussion

Hi Trevor,

 

Item is indeed a ReadOnly property. I can't for the life of me remember why I did this, though it's probably to do with setting values that don't exist. Anyway, It's easy enough to throw an exception when you do this so I'll make the item accessor Read/Write for the next release. In the meantime:

 

For p As Int32 = 0 To pts.BranchCount - 1      

  Dim branch As List(Of Point3d) = pts.Branch(p)      

  For i As Int32 = 0 To branch.Count - 1        

   branch(i) += Vector3d.ZAxis      

  Next    

Next    

A = pts

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

So, starting with the next release you should be able to write:

 

For i As int32 = 0 To 6      

  myTree(New GH_Path(0, 0), i) += Vector3d.ZAxis      

  myTree(New GH_Path(0, 5), i) += Vector3d.ZAxis    

Next    

A = myTree

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia


Great, thanks!

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service