What would be the way or methodology to script a grasshopper component that outputs a geometry and user could snap to it?
I know that there is selectable preview plugin for grasshopper.
But I just want to output few polylines, that will allways stay as it is, and their coordinates are manually written inside component.
Do I need somehow to fake it ?
Like Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline();
and then lock it?
What would be a process using code?
If the component is refreshed is it being bake twice?
Or is it is added to new layer that is cleaned every time objects are baked and locked?
I know Anders Holden Deleuran this type of thingy for bendy stuff, I am wondering what is the process behind.
From second 4 to 7:
No, it’s a UI object that is not readily callable from C# code.
The cache works by baking geometry to the current 3dm file along with some user data that identifies it as both a cache-baked object and also it’s position within the original data tree. The former data allows the cache to delete the old geometry before baking new one, and the latter data allows the cache to recreate a datatree from the objects in case you want to insert a manual editing step in between.
Here’s an example of the cache, note that you must assign a name to a cache to make it work: cache.gh (4.4 KB)
No it requires manual interaction. There’s a lot goes on in Rhino when you add/delete/replace objects, not least the creation of loads of undo records, so I’ve been shying away from automatic baking.