GH - Select disjoint meshes inside BoundingBox?



Hi all,

Is it possible to select meshes being located inside a BoundingBox via code? I had the plan to make a BoundingBox around a mesh, which I know have a bunch of disjoint meshes and bad faces inside.

Is it possible to Select & Delete all such meshes & faces inside the BoundingBox using RhinoCommon? (after I shrink the BB a little so that not also the big mesh gets deleted).

// Rolf

(Using VB.NET for coding a GH component).

(David Rutten) #2

Are you talking about selecting and deleting in Rhino, or culling items from Grasshopper lists?



I need to do some fully automated mesh cleanup by “preprocessing” of a bunch of meshes, something like so:

  1. Open a bunch of meshes (.obj files) from a Rhino instance.
  2. Preprocess the Rhino model mesh objects using code only (no manual interaction)
  3. In some cases using also GH geometry based on the soruce files, + bake back to Rhino .obj file.
  4. Save the .obj files with other names.
  5. Further process the resulting .obj files with another program (invoked from Rhino via .bat file, or by other means if better)
  6. Then continue refining the resulting meshes from prev step in GH, +bake, and more like the above.

So all in all I need to import - process and export objects into and out of both “Rhino space” and “GH space” in several steps depending on problem to fix or geometry to add to the objects using different tools, all this being “orchestrated” from Rhino with extensive use of GH.

I have thousands of files to process according to a complex sequence of steps which works well manually but needs to be fully automated.

I would also want to know if it is possible to invoke Rhino5 + a specific gh-file + model file using a .bat file? (I would then let a GH component do all the above, and then take down Rhino when all model files are done processed)

// Rolf

(David Rutten) #4

I don’t know, this is a Rhino question, not a GH question.

However I can tell you it’s easier to automate stuff from within Grasshopper than from within Rhino, for the simple reason that GH is aware of Rhino but Rhino is not aware of GH.

If you’re willing to accept that in order to perform this automation you will start Rhino manually, start Grasshopper manually, load a gh file manually and assign some folder manually, only then to have GH loop over all files, execute all commands, load stuff into GH, process data, bake it back out and ultimately save the file again under a different name, then I can help out. Although it will require quite a lot of VB or C# code.


what about opening “a specific gh-file”?

Absolutely, no problem. I can define paths etc in a text field and feed a GH component which orchestrates this, although I’d prefer GH to figure out on its own the FilePath to the current Rhino model file.

I’m already doing much of the processing in GH, so yes, GH will be the “Master” in this orchestra. I just need to get it all started automagically and knowing which workfolder to work in (this can be executed on any other computer, its an application for others to use, so GH must figure out in runtime where to pick up and dump its work).

Notice though that even if this is executed from GH,I will still have to let GH poke on the Rhino model at times, preparing it for import into other programs, such as Instant Meshes and other “fix tools”.

// Rolf