Compiling DataTrees cast problems / VisualStudio VB

Hi all,

 

I am trying to understand how the datatrees are working in VB. In another post, it is said that GH_Structure has to be called, instead of Grasshopper.DataTree.

My problem is that the casting of GH_Structure elements (i.e. GH_Structure(Of Grasshopper.Kernel.Types.GH_Planes) does not allow me to reuse this geometry as I would like with the rhino.geometry functions.

 

So, is there a way to build a simple datatree of or any geometry, reusable as rhino.geometry stuff?

 

What I try to do is something like this:

With MyCollectionOfPlane as a tree with a simple {A} structure, 1 item by branch.

And with MyCollectionOfPointsForEachPlane as a tree with {A} structure and a list of items by branch.

I wand to have an XY plane on each points of MyCollectionOfPointsForEachPlane, in the good datatree structure.

 

'------------------

Dim MyCollectionOfPlane As New GH_Structure(Of ***planes***)

Dim MyCollectionOfPointsForEachPlane As new GH_Structure(Of ***points***)

Dim MyNewPlanes As new GH_Structure(Of ***planes***)

 

For a as Integer=0 to MyCollectionOfPlanes.Branches.Count -1

For b as Integer=1 to MyCollectionOfPointsForEachPlane(a).Count -1

MyNewPlanes.Add(New Rhino.Geometry.Plane(MyCollectionOfPointsForEachPlane(b), Rhino.Geometry.Vector3d.XAxis, Rhino.Geometry.Vector3d.YAxis)

Next b

Next a

 

DA.SetDataList (0, MyNewPlanes)

'-----------------

 

I'm really stuck on it... I tried to play with .CastTo but had no results... I also tried to wrap geometry with Goo, but I don't understand it very well...

 

Any idea?

Thanks in advance for your help,

TS.

  • up

    David Rutten

    Hi Thibault,

     

    sorry, I don't get it. Are you looking to create a GH_Structure that acts as a single Rhino.Geometry shape? Are you having trouble with the difference between Rhino.Geometry.Plane and GH_Plane?

     

    ps. DA.SetDataList(0, MyNewPlanes)  won't work if MyNewPlanes is a GH_Structure. You need to call SetDataTree() instead.

     

    --

    David Rutten

    david@mcneel.com

    Poprad, Slovakia

    3