Rhino Osnap On GH_Preview Objects

Hello,

Is it possible to access the vertices and/or lines of Custom Preview Geometry and expose these to Rhino to work with Osnaps?

The use case is being able to push complex models on the GPU only via Custom Preview but still be able to snap to said geometry while drawing/modeling in Rhino.

I realize I’m asking something that is a bit at odds with itself but bear with me please.

Alternatively, I thought about using Deconstruct Brep and baking the Edges and Vertices to a layer called “Osnaps” but I wanted to see first if there was a method for exposing preview geometry vertices.

I want to keep the model light weight by not baking more than necessary to the Rhino Document but still maintain the beneficial functionality of being able to “snap” to the geometry in question.

I’ve found these similar topics:

And Plugins:

But I’m specifically looking to be able to use native Rhino tools while snapping to the Preview geometry but I don’t need to select the preview geometry itself. Does that make sense?

I’m guessing I can work with the PreviewMesh methods to then get the mesh vertices and add those to the document but I’m struggling how best to approach this and looking for some guidance from the kind and talented folks on the forums here.

Thank you all for any leads on this!

EDIT:
I managed to create this hacky method by “baking invisible lines” of the preview geometry to the document and this does give the snapping functionality but obviously this is not ideal for quite a few reasons.

Graph Space:

Model Space:

20231202_snappable_preview_geometry_example_01a.gh (213.2 KB)

1 Like

Wow, your script is fantastic, I had no idea it could be done! Being able to OSnap to Grasshopper geometry will allow much better integration of Grasshopper into my workflow, thank you.

It might be a good move for @mcneel to add simple ‘GH’ tick box into the ‘Selection Filters’ in rhino9

1 Like

Thanks @omichalek,

For you or anyone else coming across this. With Rhino Custom GetPoint class there are functions you can call such as AddSnapPoints in Rhinocommon which could have a similar effect here… you could take the grasshopper brep vertices you care about and then with a python or C# script use those in a GetPoint function and effectively “snap” to that geometry even though nothing is baked or added to the model.

https://developer.rhino3d.com/api/rhinocommon/rhino.input.custom.getpoint/addsnappoints

2 Likes