Grasshopper Text Dot visibility/overlap

Hello!
I am facing problem with Text Dot visibility when it is intersecting GH previewed object.

For normal Rhino geometry, Text dots are always visible without any issues

However, when I create Grasshopper preview of active objects (Rhino geo is hidden in that case),
text dots can not overlap GH preview and are hardly readable.
Active objects in the pic below are pink and shiny light blue (is that you, SolidWorks?)
As you see, text dots are hardly even noticeable.

Is this something that I can fix?
Maybe control display priority somehow?

Thank you for any input! :slight_smile:

That’s an old problem…

Grasshopper used to have a bump preview feature but it was removed at some point.

Bump preview problem - Grasshopper - McNeel Forum

Hi Martin,
Thanks for the link,
I went through it, but I am not sure if I read the situation correctly.
So this weird preview is known issue for 4 years already, but no solution? (except from using something else that text dot)

I also ran across one topic you also participated in and tried that approach (move text dot location base on camera view angle), but it was not feasible for my case.

Unfortunately, I think there is no solution with text dots.

While there might be plugins available, it’s certainly possible using scripting components. See e.g. this topic for a hack that enables one to draw 2D objects in screen space on top of the 3D viewport objects:

To draw a text dot you can implement the DrawDot method. I’ve used this code pattern quite a bit recently for drawing HUDs etc. For instance the text dots and dynamic bar chart seen here:

4 Likes

Hello, I could make drawing the dots kind of work, but I still can’t make sure that the dots are removed properly once the component is deactivated or the C# script component gets deleted.

Where to remove the event handler for Rhino.Display.DisplayPipeline.DrawForeground?

The script is an edit of Draw To Screen Space Foreground From DrawViewportWires - #13 by mrhe

drawForegroundv2.gh (10.0 KB)

The post mentions my current problem:

This gets you 80% there. You will notice, however, that the dashboard is now persistent even if you remove the script from your document or switch to a different one. Ideally, you would unregister from the DrawForeground event handler in the following two cases but I only know how to do it from a compiled component. Maybe someone else can help you with the script component counterparts:

public override void DocumentContextChanged(GH_Document document, GH_DocumentContext context) {}

public override void RemovedFromDocument(GH_Document document) {}

Does the C# scripting component not have equivalents to the GHPython __enter__/__exit__ methods? I’ve been using those to add/remove event handlers quite robustly since learning about them over here:

1 Like

draw_dot_python_component.gh (6.9 KB)


image

It worked, thank you.

2 Likes

Oh wao, this is beautiful. What if i want to add more than one point? My python knowledge is limited, but if i change the input type to list is not enough :frowning:

Rhino 8 now has native components that allow you to create Annotation Dots. In addition, I believe the preview issue (mentioned above) should be fixed if using these components. In the screenshot below, the Annotation Dot location is located behind the Rhino geometry (if seen from the perspective view). You can see that these dots will still show up on top of that geometry.

4 Likes

Oh! this is great news (I dont have rh8 :cry:). Although i’d like to control more the fonts, size and color of this capsule dot text directly from grasshopper.

Could you add Text3d class to the DrawDot method?
Implement properties such as font, bold in TextDot is necesarry :pray:t2:

You can do all of that if you expose all of the input parameters. Like this.


AnnotationDot.gh (12.7 KB)

2 Likes

Here are a few more details on working on the ZoomUI

thank you but I mean for a custom C# to work with args.Display.DrawDot(

If you pass in a valid TextDot with all of it’s attributes set into the DrawDot method then it should show up accordingly. That’s what we’re using actually to draw these annotation dots on the screen. You can see all of the available Text Dot attributes here.

1 Like

Oh this is fantastic. :star_struck: . Two questions:

  1. does this text dot visualization preserves perspective depth between other tex dots? (Sometimes in this python exercise i’ve notice that the depth in which every text dot is drawn on the screen depends on its order of creation in the list)
  2. Is it possible to change the boundary color of the text dot? (In your image i see the black boundary, but what if i wanted that cyan too?)

For some applications, especially for printing, a text in a capsule is a better solution. You can define the colors and especially the size in an easier way compared to textdots.

The file in my linked post can be used to create annotation styles with the look of a textdot.

The layer color is used for text and boundary.

2 Likes

Guys i’m not an expert in python as much as i wish to. I’m trying to create text dots for a list of points and texts with @martinborst1 script, but I’m kinda lost how to solve it. Do anybody has an answer for this problem?

Capsule tag_draw dot.gh (7.9 KB)

Did you consider using the component from Rhino?