Getting all geometry with enabled preview using GHpython



Is it possible (using GHPython) to get all the geometry from grasshopper which has Enable Preview on?


(Giulio Piacentino) #3

@DavidRutten do you have a sample (even in C# or Vb.Net) that you can refer @Bogdan_Chipara or me to? Thanks!

(David Rutten) #6

When you talk about “geometry”, you mean the actual shapes and points and stuff that Grasshopper currently draws in viewports?

If so, then no, although you can probably find most of it if you inspect the volatile data of each and every IGH_Param in the GH_Document. However you will still miss geometry that is part of clusters, or geometry inside Custom Display components, or other geometry that components decide to draw outside of the regular channels.

(David Rutten) #7 (19.1 KB)

Do note that this collection happens within solutions. So if you expire and execute that script from within the same solution, it will not be able to harvest any data that is computed later than it. However if it is triggered separately using a button or toggle, then it should work.


Interesting. It could be something like “I bake what I see” option, with geometry type filter, maybe.

(Giulio Piacentino) #9

For completeness, this contains the same content of the C# script, also translated into Python. (10.5 KB)

Bake only what has preview on?