Grasshopper

algorithmic modeling for Rhino

How can I have a list of the components being drawn on the GH_Canvas?

Views: 424

Replies to This Discussion

There is no such list. You can get all the objects in the loaded document, then filter out everything that is not a component, then filter out all components whose attribute bounds do not intersect with the canvas boundary, and that final list probably contains all components that were last drawn.

Hi David, thanks for the explanation.

I'm currently using GH_Document.BoundingBox() to get the canvas area, although maybe I should use GH_Canvas? if so, what are the difference between them?

It seems to me that the GH_Document.BoundingBox() is different for every component on the canvas, what does this mean?

Also, I'm using GH_Component.ClippingBox to get the current box containing the component, I guess this is the right rectangle I need to check against the canvas area.

GH_Document.BoundingBox() gets you the rectangle that contains all the components and other objects that populate the document. This boundingbox is the same no matter what part of the document is being viewed and no matter the zoom which it is being viewed at.

GH_Canvas.Viewport.VisibleRegion gets you the rectangle (in document space coordinates) that is currently visible through the canvas control. This region depends only on the pan and zoom state of the canvas.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service