Grasshopper

algorithmic modeling for Rhino

I wonder if anyone come across a working routine that you want to update your geometries (previously baked) with new ones. For example, from the bakeAttributres c# component written by Giulio Piacentino, we can bake to rhino an object with names.

 

I looked into the script and saw: (for surface)

Rhino.DocObjects.ObjectAttributes att = new Rhino.DocObjects.ObjectAttributes();

att.Name = name;

doc.Objects.AddSurface(obj as Surface, att);

 

From the RhinoCommons help I found that ObjectAttributes.ObjectId can be accessed as well: (however it seems to be read only)

Every object has a UUID (universally unique identifier). The default value is Guid.Empty. When an object is added to a model, the value is checked. If the value is NULL, a new UUID is created. If the value is not NULL but it is already used by another object in the model, a new UUID is created. If the value is not NULL and it is not used by another object in the model, then that value persists. When an object is updated, by a move for example, the value of ObjectId persists.

 

So my question is: Is it possible to bake object with a desired ObjectId, then being able to reference the object with the Id, then even update the geometry?

 

 

Otherwise, would it be easier to bake an object with a unique object name, and then reference it with the current available method (<layerName>.<objectName> string plug into a primitive geometry battery). When I want to update (overwrite) the baked geometry in rhino, I (in VB) select the geometries by their names, delete them, and write the new geometries with the same name again.

Views: 1563

Replies to This Discussion

Hi Victor

If you use it like this you can get back the UUID of the object:

Guid uuid = Guid.Empty;
uuid = doc.Objects.AddSurface(obj as Surface, att);

in the next step you can use following

Rhino.DocObjects.ObjRef RefObj = new Rhino.DocObjects.ObjRef(uuid);
doc.Objects.Replace(RefObj, srf);

hope this helps

best

to]

Thank you Thomas, 

I'll try it out, its seems quite straight forward.

 

VL

Dear Thomas,

Is there a way to retrieve / ObjRef object by the object name not the UUID?

Thanks a lot

VL

Hi Victor, this is exactly what I'm currently trying to do! I'm wondering if you've got anywhere with your Update Bake project?

Cheers.

I'm sorry, but I didn't adopt this routine of working now.

But I think it is do-able.

 

The idea is that you need to get back the uuid from Rhino when you bake the objects.

Next time when you want to overwrite, you use the update functions.

Thanks. I'm a newbie to VB scripting but it does seem like a logical thing which can be done... Hopefully!

Hello, please help me on a similar topic,

I would like to create a code bake in VB components with information layer.

If is possible that geometrie udpate bake.

Sorry, I dont really understand what you are trying to say, what do you mean by information layer?

did anyone get anywhere with this?

 

i have a definition that modifies the input geometry, but i'd like for it to nuke the input geometry when I bake the geometry generated by the definition, is that possible?

 

or would that be a time paradox? ;-)

thanks?

There is a new thing called Geometry Cache.

You specify a name to that component and connect a geometry to it.

You then press the bake button on the component to bake. Next time if you have an update, and if you didn't change the name, the Geometry will be overwritten. 

See if that helps.

will it overwrite the geometry picked in Rhino at the beginning of the definition?

 

If so that's exactly what I am looking for.

 

thanks for the reply Victor,

ryan

Hi Ryan,

 

Try it yourself, I believe it overwrite what it had baked before, not your input. Otherwise it will be an infinite loop.

 

Cheers

 

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service