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:

3 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.

1 Like