GUI - Rhino - Radial Menu - Cross Platform

Hi, any news about radial menus? It looked quite promising recently, but posts suddenly stopped…

2 Likes

Well I for one got busy and haven’t had a chance to pick up the work. Where it left off was figuring out a good way to let a user choose standard toolbar buttons or macros and populate a radial menu with those.

I still haven’t gotten a chance to test @antoine code he shared but still intend to, hopefully soon

1 Like

Hi @morris
This project is not close but @michaelvollrath , myself and many other people on this forum are not full time dev, and not professional dev, so debugging and finding solution are time-consuming, between a POF that seems to works and something useful by anybody is a long path :slight_smile:
The goal was something easy to manage for everyone from a Rui file, and some bugs for extracting icons from rui had been solved in the latest SR…project will be follow but be patient :slight_smile:

3 Likes

Thank you for your work. There is no hurry, I just wanted to check, if this project is still alive. I’m looking forward to some progress. Please let me know if I could be of any help (like a tester or something?).

2 Likes

Hi @antoine,

Thanks for the XML parser. I started looking into it and comparing against opening an RUI file in notepad++ and found some interesting things that may benefit us.

I don’t know if all RUI files are like this… but I tested by exporting the Enscape toolbar to parse against and here are the interesting bits I found lie within macros and icons:

image

Icons (icons):
The actual SVG code lives here (between the red lines):

We can parse with svg begin through svg end to get the actual .svg code for the icon to generate the image from either as .svg or by converting to bitmap for Eto. Unless someone know if Eto supports .svg images, that would be better yet.

example of the parsed svg code in an online viewer showing the icon under output:
Uploading: image.png…

Commands being ran (macros):

Here ^ you can see between the macros lines we have the actual script block showing the command being ran in this case !EnscapeAboutCommand.

To confirm, we can copy paste this command to the command line in Rhino and the appropriate dialog appears as it would if the toolbar button was pressed.

I don’t understand how to export a single custom toolbar or a single toolbar like “Drafting” for example?
Perhaps someone can shed some light on that.

I need to see if the svg and script code is consistently parsable across other RUI xmls as well.
If so, we are in business and the next step is just plugging those values into the Radial Menu GUI code where we can replace the bitmaps with the parsed svg content either as .svg or converted to Eto.Drawing.Bitmap and the rs.Command strings with the parsed script values.

I’m excited, I think we are close to an easily customizable Radial GUI unless I’m overlooking something obvious?

Curious on everyone else to weigh in on this.

Thanks everyone!

1 Like

I thought I’ll look at it, I don’t know what is the target aim V7 and V8 or V8+?

The thing is that I see inconsistency in handling rui files, V7 rui files are named rui and are in %appdata%\McNeel\Rhinoceros\7.0\UI but in case of V8 there’s no UI folder at all though now it seems that all rui’s are packed into C:\Users\UserName\AppData\Roaming\McNeel\Rhinoceros\8.0\settings\Scheme__Default (?), however I still can’t find where are original rui’s/xml’s for default Rhino Scheme (anybody can share location?)

Plus seems you’ll have to struggle with both svg’s and bitmaps at least according to what I see in here:
image

Worth noting that in V7 RUI had bitmap with 3 sizes BUT all RUI icons were merged to single base64 string :face_with_monocle:

If rui support is planned then it will be a lot of work to handle the correct parsing of those elements.

You have to parse XML and you start with parent of <tool_bars>, which in my “inspection file” seems missing and I don’t see names here, guid’s are to work with but I have no idea where those are pointing. Maybe I’d figure it out if I’d knew where to find the original/default rui/xml :open_mouth:

2 Likes

I think I can parse the .svg for Eto now since an .svg bug? was fixed recently and then use that for the light mode dark mode icons as well.

I’ve been focused on other developments recently but do want to look into this again and share an updated example of the code hopefully soon!

4 Likes

Did you check this alternative out? It’s in GH but for sure full of inspiration.

2 Likes

Thanks @sonderskovmathias !

That’s helpful indeed.

It appears that the icons for this GH Radial Menu implementation are coming from the IGH_ObjectProxy

Here:

    private Image? _icon = null;
    public Image? Icon => _icon ??= Proxy?.Icon;

Within This:

I don’t think Rhino tools are as “nicely” packaged as this ObjectProxy but I also have no idea, so now it’s time to dig back into that and see where the actual toolbar images are being set/stored with each tool.

Hi Michael,

It will be so helpful ans simple if all Rhino Icons, even the regular ones are saved and well packaged in the same place, with name macros shortcut …and icons… toolbars only need to pick them in a unique folder…
Maybe McNeel team could help?.. :slight_smile:

@antoine Agreed.

@stevebaer, @dale, and @curtisw now that R8 uses Eto have there been updates to the API to expose the Icon Bitmaps/SVGs of Macros anywhere?

Can we query these icons?

The use case is something like this (pseudo code):

macro = Rhino.UI.Macro.ByName("macro name")  # Find Macro "Object" By Name
macro_icon = macro.Icon  # Get Macro Icon (Bitmap or .SVG)
macro_command = macro.CommandString  # Get Macro Command (As String)

We would then take these variables and use them to populate an Eto.Forms Form (such as in the above Python code with the Radial Menu example.

We could expose the “find/search” for a macro in a seperate UI that lets users “build” their own Radial Menu GUI.

The missing component is being able to parse Rhino.Common for the Macros and their respective components.

I think macro is the way to go because aren’t most if not all Rhino.Commands just macros under the hood or only some?

EDIT:
Some additional reference material from FreeCAD:

Thanks for the help!

1 Like

Not that I know of. I can probably add something.

– Dale

1 Like

That would be a great help, thanks @dale !

@dale I would like to know if you had some time to look into the best way to use svg icons as icons directly in Eto… since all Rhino icons are svg based…and Rhino Gui … Eto based…

Thank you for your help

1 Like

Hi @antoine,

Use DrawingUtilities.BitmapFromSvg.

You can read the string from a .svg file like this:

public string SvgFromFile(string path)
{
  string rc = null;
  if (File.Exists(path))
  {
    try
    {
      using (var reader = new System.IO.StreamReader(path))
        rc = reader.ReadToEnd();
    }
    catch
    {
      rc = null;
    }
  }
  return rc;
}

Then get the string in bitmap form using the above method.

– Dale

2 Likes

For reference:
One of the most appealing radial menu I have seen for CAD is from Altair Inspire (former Solid Thinking)

The screenshot is fetched from these videos. (Short video, high speed; down-speed to 0,25 to better see the details.)

Also Kajto had radial menu inside Rhino, when they were around.

4 Likes

I use custom popup menus all the tile in Rhino, accessed mostly via an alias or shortcut binding to my Stream Deck. I really like the idea of a radial menu like this. I tried the Cad Mouse implementation for 3D Connexion, but it never really “clicked” for me.

Looking forward to following progress on your project, and would be happy to test if you are looking for testers.

Personally, I think an interesting radial menu idea would be some way to bring up options and inputs for an active command from a radial menu instead of always navigating to the command prompt.

1 Like

Really good work ! Anyway to convert python into c# ?
I’m wondering if it should be easier to drag and drop buttons from toolbar into the radial menu.
So I’ll first trt to convert your code into c# (because I want to learn c# :slight_smile: ) and then think of a drag/drop solution.

Hi @Yannou,

this would be wonderful and of course we welcome this kind of implementation. getting the icon of any tool from a toolbar in Rhino is the current blocker to more progress. happy to see any solutions towards this!

100% agree that Altair has the best looking radials (and UI in general)