Grasshopper

algorithmic modeling for Rhino

What condition should I be checking for if I want to listen for a bake event? I.e. when the user decides to bake the geometry, which environment variable should I use to determine if the state is True/False? I need this to determine when to draw the geometry as Rhino GUIDs in the Rhino view port.

Views: 765

Replies to This Discussion

Maybe you can try event AddRhinoObject

Hmm, this does return an event, but I can't use it as an 'if-else' condition parameter. Is there any other way to go about checking for a Bake event?  I've tried baking the geometry using the built-in GH component Bake, but what I'm having trouble with is maintaining the line print widths when I bake the geometry. How do I ensure that the object print widths are also baked, and not just the geometry as default print widths?

You can set print widths value to the object attributes before bake!

And see attached!

Attachments:

Is there a way to do something similar in python? That's the scripting language I'm using.

Also, with the line print widths, what I'm currently doing is drawing them using rhinoscriptsyntax then hiding them (the geometry generated here is correct and has the object print widths). When I bake the geometry generated by the component, I use the built in bake option for all components, custom or not, but this only draws the lines with a default line print width.

To better illustrate what I mean:

The geometry on the left has two lines with thicker print widths than the rest, while the preview on the right doesn't retain these attributes, only the default line widths.

PY

Attachments:

So essentially I'm adding the extra event to the document when a new geometry is added to Rhino?

EDIT: Also, I'm not sure what's causing this, but when I try to do the same adding to the ActiveDoc in another script completely separate from the sample you sent, the dialog box with 'Bake Done' pops up and refuses to close even after I try to close it.

Right

Not sure if you saw my edit: I'm not sure what's causing this, but when I try to do the same adding to the ActiveDoc in another script completely separate from the sample you sent, the dialog box with 'Bake Done' pops up and refuses to close even after I try to close it. Do I need to restart Rhino completely or clear any caches, etc? 

Restart Rhino...

Without Restarting!

Attachments:

I don't intend to use any actual dialog boxes in my actual component, but thanks for the warning.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service