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

In reference to the bake event watching, I've tried to do the following with my component (S.geometry is a list of GUIDs already present in Rhino but are hidden prior to this function) :

rhdoc = rc.RhinoDoc.ActiveDoc

def bakeShow(sender,e):
   rs.ShowObjects(S.geometry)


ghenv.Component.PreviewExpired += preview
rhdoc.AddRhinoObject += bakeShow

My goal here is to override the built in Bake component and show the geometry I already have present (but which are hidden at this point) in the Rhino view port. What sort of commands or overriding would I need to do? Right now, the code above doesn't seem to do anything except the normal Bake behavior which is without attributes. I'm aware that EleFront is available but this particular component is meant to bake geometry without the use of other components.

Okay, fixed the problem. On a side note, is there a python/rhino scripting command or set of commands that lets me bake the geometry while retaining the attributes (i.e. color, object print widths)?

Example

There has a lot of examples that you can take as a reference!

For the time being, I'll add subscribe and unsubscribe events to be safe. 

So I should always include an unsubscribing line in my compiled components lest I leave it active and it continues to run in the background or hamper other commands?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service