Hello, how to bake an object and replace it when bake again?
This script of @603419608 , work fine except it duplicate the object everytime
bake.gh (6.4 KB)
Hello, how to bake an object and replace it when bake again?
This script of @603419608 , work fine except it duplicate the object everytime
bake.gh (6.4 KB)
Hi,
Simply keep track of the unique identifier (i.e. GUID) of the object, like rhinoscriptsyntax does, and use it to delete the legacy object before or after creating the new one.
You can take a peak on how this is done in rhinoscriptsyntax with the inspect
module:
import rhinoscriptsyntax as rs
import inspect
print inspect.getsource(rs.AddPoint)
print inspect.getsource(rs.DeleteObject)
I think you are missing the basics of this script. All RhinoObjects are stored in one collection. This collection obviously is part of the active document instance. So essentially it is all about modifying this collection of objects.
You are already giving your objects a custom name, just find all objects in your document with that name, remove them from the document and add the new ones instead. More bulletproof if you keep the unique identifier of your previous bake (which is a property of a RhinoObject), but this is not necessary if your name is already unique.
Thank you i will check this and try
Thank you, the problem that all baked objects have the same name, i read something about Geometry Cache but don’t find a way how to use it for baking
You can use the second argument when calling the rs.Add...
functions, to replace an object with the object you’re adding. Here’s an example file that will reverse or offset (i.e. rotate) the vertex order of the selected polylines in the Rhino document, which demonstrates this:
Thank you i will check the file and try it