Grasshopper

algorithmic modeling for Rhino

I was wondering if anybody could point me to a sample where the display behavior in the rhino view-port of e.g. Rhino.Geometry.TextDot was customized.

I am looking for a feasible (meaning fast) way of doing this:

http://www.grasshopper3d.com/forum/topics/text-dot-size?commentId=2...

best

Richard

Views: 1219

Replies to This Discussion

TextDots can't be customized a great deal. What exactly are you looking to do? Draw camera aligned text in viewports?

--

David Rutten

david@mcneel.com

Yes I would like to draw camera aligned text but also arrows.

All you need to display a directed-graph...

Both are possible. Are you doing this from within a GH_Component RenderXXXX() method?

How is the data you need to draw stored and what is the logical mapping from variables in memory to pixels on screen?

--

David Rutten

david@mcneel.com

The graph information is stored in a custom class (GH_Graph).
The positions of the vertecies are stored as point3d.

At the moment I am computing the needed geometry (Circles, 3d Text, curves )in the solveInstance Sub functioned of the component (if Me.Hidden = true) and storing all geometry within the component.

I am currently trying to improve the display function, so the idea was to be able to display a neat the graph from every direction clearly and maybe with some additional elements e.g. arrows...

I know that you can easily remap coordinates from world to viewport coordinates / screen coordinates. So could I use this information to draw to screen directly? But than I couldn't bake them...

Baked geometry will no longer update to align with the camera, that's a sacrifice you'll have to make.

You can either draw your graph as a 3D object in some world space rectangle (in which case it's easy to position it in the model and baking is possible) or you can draw it on the viewport near plane. This means it will be drawn in front of all other objects and it will face the camera. However exactly where you place the text and polygons and arrow depends on the viewport size. A simple mapping from world-space to screen-space will probably not suffice. You'll have to recalculate the drawn geometry on every redraw.

Option A is how the Legend object in GH works. Pick whichever approach suits you best (fixed 3D and bakeable or camera-oriented and not-bakeable).

--

David Rutten

david@mcneel.com

But would it be possible to create a custom Rhino.Geometry class taking care of this in rhino directly, if possible this should be way faster, than recalculating the preview constantly.

Adding a new object type to Rhino is not something to be undertaken lightly. Especially not something which jumps around in 'real' space just to anchor itself to the camera properties of every viewport.

I'm not even sure if it is possible in RhinoCommon, but even if it is, I'd recommend against it.

--

David Rutten

david@mcneel.com

Let me rephrase my question:

How did you do the point preview flavors? Would it be possible to do a similar thing with different geometry?

The point preview text is drawn in a display pipeline using the camera properties of whatever viewport they are drawn in. Similarly in the Dimensioning components I just released, the text orients itself based on camera position and direction and type (perspective vs orthogonal).

You can draw whatever geometry you like in this way, it is not limited to text.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service