Grasshopper

algorithmic modeling for Rhino

Hi all,
This is probably a very simple question.
How do I get the datatree path structure of a vb input which uses item access instead of datatree access?

I have a vb component with an item input "x" and a list of items going into that input.
It is important for the way the component works for the x input to be an item access and not datatree access.
Each input item has a datatree of information applied to it which is then output though "A"
In the component the datatrees are constructed with a "new gh_path(i)"
The issue I have is that because the x input is an item, the path coming out is always "i" not "x,i" for example

input x(0) = output {i}
input x(1) = output {i}
what I would like is:
input x(0) = output {0;i}
input x(1) = output {1;i}

Essentially what I would like is the same scenario when a list is created in a vb component and output, where a branch is added for each item coming in, but with a tree structure instead.

Thanks for any help,
DM

Views: 923

Replies to This Discussion

You can get the VolatileData of any input parameter through the Component member of the VB script:

Dim inputParameter As Grasshopper.Kernel.IGH_Param = Component.Params.Input(0)
Dim tree As Grasshopper.Kernel.Data.IGH_Structure = inputParameter.VolatileData

Thanks David! 

That was exactly what I needed.

As a followup, to get the path for each particular run (each item from the list of inputs) I am using:

tree.Path(Component.RunCount - 1).AppendElement(i)

Is Component.Runcount the appropriate method to use for this?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service