Petras1
(Petras Vestartas)
July 11, 2022, 6:28pm
1
Hi,
What type should I cast to, in order to convert GeometryBase to a type in a namespace Grasshopper.Kernel.Types?
CONTEXT: I want to ouput GeometryBase from a grasshopper component using GH_Strcuture
I am trying to add GeometryBase to GH_Structure, I thought IGH_GeometryGoo is the right type, but it is not:
GH_Structure<Grasshopper.Kernel.Types.........> all_geo_groups = new GH_Structure<Grasshopper.Kernel.Types.........>();
kitjmv
(jmv)
July 11, 2022, 6:50pm
2
That’s what I was thinking too.
Maybe you can use “Grasshopper.Kernel.GH_Convert.ToGoo” before storing your objects.
Petras1
(Petras Vestartas)
July 11, 2022, 9:29pm
3
In documentation it says:
This function calls a whole sh*tload of other conversion functions. IT IS SLOW
Is there any alternative ?
kitjmv
(jmv)
July 11, 2022, 9:40pm
4
Yes it is very slow, it is true.
It will try to convert the data into all Goo grasshopper classes, from Boolean to Brep, passing vectors, force fields, Subd, etc… until the conversion succeeds.
But I don’t know of any other solution to pass a GeometryBase type in Goo.
sorry
archimax
(Max Malein)
July 12, 2022, 7:56am
5
Maybe new GH_GeometricGoo(your Geometry)?
Petras1
(Petras Vestartas)
July 16, 2022, 12:56pm
6
This requires the type but thank you for the answer.
Petras1
(Petras Vestartas)
July 16, 2022, 12:56pm
7
This indeed did the trick
all_geo_groups.Append(Grasshopper.Kernel.GH_Convert.ToGeometricGoo(nest_geo.geometry[id]), new GH_Path(i));