algorithmic modeling for Rhino
Hi All
I'm scripting a C# module that generates a double layer gridshell over a surface, but I've run into a problem with outputting the generated BReps in DataTrees.
I'm generating the geometry by lofting through a series of rectangles aligned to a surface. This generates a BRep[] for each loft.
If I output a single instance of the resulting BRep[], then Grasshopper recognises this as an untrimmed surface and works OK. However, if I add a series of BRep[]'s to a DataTree, then Grasshopper doesn't seem to recognise the output. Grasshopper displays the contents of the tree as 'Rhino.Geometry.BRep[]', but recognise these as valid geometry and gives the error message 'Data conversion failed from Goo to Brep' - see screenshot: Gridshell%20module.jpg
I don't understand by adding these objects to a DataTree (or Rhinolist) causes Grasshopper to treate them differently...can anyone shed any light on this please?
Thanks
Alex
Tags:
Hi Alex
I normally write in vb.net, but I am planning on jumping into c# very soon. But notmally when I do lofts they create an array, which means inorder to add the created brep to a list/datatree I have to say; mydatatree.add(BRep(0),path)...
Becasue what it seems to be happening is that you are adding the entire array as an object, which isnt a brep but a breparray.
As I said I norammly write in vb.net, so I dont know if this method transcends syntax. Let me know how this turns out, becasue I am sure that it will save me a lot of time when I have to do the step from vb.net to c#.
Good luck
Hi Jens
Thanks - it works perfectly now. I had assumed that the breparray would be added as a list to the DataTree which would be OK, but that's obviously not the case.
Alex
If you want to add lists to a DataTree, you should use the AddRange method instead of the Add method. I cannot automatically convert lists for that would lead to problems. When you add a polyline for example, I shouldn't convert that to a list of points, even though a polyline is in fact a list of points with extra methods.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks David - that makes perfect sense.
Cheers
Alex
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by