ExportRuiFile problem

Hi there,

i am trying to get hold of all macros, their (english) names, their command scripts and their svg image in the default.rui file using Rhino 8. Since default.rui file is no more a physical file, this turns out to be a challenge.

So i’ve searched through YT items and found a suggestion by @JohnM to use the _ExportRuiFile command which i did. The resulting xml file is unfortunately incomplete. While it contains 1506 <macro_item> nodes there are only 38 <icon> nodes in it.

Trying to access the ToolbarFileCollection through scripting unfortunately leads to a dead end. The ToolbarFile of default.rui lists its Path property like this:

Rhino.UI.Resources.rui.default.rui

which is nothing i can access to gather the required information from a xml file. I am aware of the TestDumpSvgs command, which does not give the required data.

Could you please help how to aquire the full list of macros as it is displayed using the _Macros command including the svg snippets, if available ?

Addendum: I’ve found that using the _ExportRuiFile command does not actually export the incomplete content of the default.rui, it includes multiple copies of macros which reside in my own linked rui files. Is this the expected behaviour ?

thank you,
c.

Hi Clement,
That falls in line with what most of my practical experiments with .rui’s and toolbars have shown, most of the buttons are missing images after saving an .rui.

Yes, I see that too, the macro library stuff is also very messed up. I have for example more than five hundred entries under “unnamed” - one of them duplicated 200 times - in my default macro library.

Hi @Helvetosaur, this thread is more about the default.rui problem and the _ExportRuiFile command, but thanks a lot for testing. I guess everthing seems to be related to the toolbar problems already known but i hope that todays RC will fix a lot of these problems.

Thats what most users (me included) thought when re-opening custom rui files after re-creating them multiple times and saving them. I wrote multiple rui analysis tools to find that my custom saved rui files do indeed have the icons when saving from:

Rhino Options / Toolbars / File / Save …“SomeCustomRuiFileName”

The reason for Rhino not beeing able to display the images is a copy of SomeCustomRuiFileName in the settings folder which previously tried to keep track of the changes we’ve made to our workspaces. This file contains malformed svg code which just broke the whole system once Rhino was opened. Once that file was removed, the saved rui files will just open as expected. This behavour is worked on by @stevebaer and will hopefully change soon, maybe with the next RC.

Nice, i have created many custom rui files for clients (all in R8) and found that the copy of the Rhino.UI.Recources.rui.default… file saved in the Scheme_Default folder got over 100Mb. It contained 900+ copies each of the same macro(s) which i created. In total i’ve created over 70 custom icons so there where more than 60k entries which i never wanted.

The macro library (visible when opening _Macros) lists such duplicated entries too when “default” is chosen as the Library file. Example after removing that Rhino.UI.Recources.rui.default… file and making a single change to a custom rui file:

This is another issue which might or might not be related to the _SaveRuiFile command.

I hope that someone from McNeel is able to repeat what is reported in this thread and acknowledges that there are multiple bugs which cause that that the copy of default.rui (in the Schemes_Default folder), which is supposed to keep track of changes somehow blows itself up when making changes to either the default or custom rui files.

If i delete that Rhino.UI.Recources.rui.default… file, everything seems to behave for a while, but as soon as i make changes to my own stuff, save custom rui files or add a litle change to the default workspace, it starts growing in size again…

I`m looking forward to the next RC and will continue to report my findings but have the feeling that most of them are just beeing ignored.

_
c.

Hi Clement - I exported the RUI here - does this have the right stuff if you open it?

testExport.zip (561.7 KB)

-Pascal

Hi @pascal, thanks for trying this out.

Your testExport.rui file has 1467 macro nodes but only 4 icon nodes (opened in Notepad++):

maybe we should ask if _ExportRuiFile command is supposed to export the icons at all when default is chosen ? If i export one of my custom rui files, it contains all macros and icons, below is a rui with a single toolbar, having 8 buttons and 11 macros:

It lists 9 icons as it includes one extra icon for the toolbar tab. So why does it fail exporting default.rui ?
_
c.

Yeah… I need to ask what the process is but my guess of the moment is that since the dedfault icons are already in place - in the Rhino installation, and so available to the exported rui file without storing them, they are not included.

If I make a new button with its own svg icon, that and the macro are exported to the RUI.

-Pascal

Hi @pascal,

to me it looks like that the _ExportRuiFile command has a bug and tries to export the icon nodes but somehow overwrites the icon nodes except the last when default is chosen. Please Open this report which was generated using one of my scripts using your file:

Summary_testExport.txt (175.1 KB)

The script searches for macro items and tries to locate their associated bitmap_id. If you look at the end of the summary, 2 macros stand out which are flagged as valid as their icon has been found:

Summary: 2 valid “macro_items” having “icon” nodes detected:
MacroItem 0 Zoom no lights Script: …
MacroItem 1 Zoom no lights all Script: …

So if what you wrote is true:

Why did it export the icon node(s) for the last two macro_item nodes which seem to start with letter Z at all ? :face_with_monocle:

_
c.

Hi @Helvetosaur and @pascal,

i think i’ve found out why these duplicated entries in the default macro library arise. Could you please try to repeat this:

  1. Create a new button macro “AAA” in any toolbar of a custom rui file, use eg. “Point” as the command script and assign any image

  2. Open _Macros and search for “AAA”, it should find no entry

  3. Use the “AAA” button a few times

  4. Open _Macros now it lists the “AAA” entry at least once

  5. Use the “AAA” button, then alternate with any other button you have

  6. Open _Macros and you’ll find multiple entries for “AAA” as often as you’ve used it

It seems the default rui gets “messed up” using above sequence. If i remove these duplicated entries in the macro library, re-open Rhino and do above at a later time, i get the entries again. Can you repeat that ?

tested this with (8.5.24072.13001, 2024-03-12):

In my example video i alternate using Rhino’s “Single Point” button command. If the alternating button resides in a custom rui too, i get duplicate entries in the default.rui for that macro too.

_
c.

Hi Clement,

I will try this later, thanks…

Hi McNeel team,

Am I the only one thinking that maybe the most sensible, efficient and financially viable solution to fix this historic mess of a V8 release due to workspace re-write and limited knowledge and/or bandwidth by your internal team is hiring @clement on contractor basis?

I’m sure he’s not very available or cheap, but can we really afford not have more of this type of know-how helping you/us more?

It’s time.

G

2 Likes

Hi @gustojunk, thanks for the kind words.

I’m glad to be not in charge for this and try to report my findings anyway. Imho, from a users point of view the system may look easier as it is. Once i’ve tried to parse the rui files with code i’ve noticed the real complexity of containers, toolbars, toolbar groups, macros, left and right buttons, button text, menu text, help text, tooltip text, light and dark icons, commands in the script section and multiple language locales…

It’s a large beast to tame but i’m confident McNeel’s developers will handle this, it’s just a matter of time and maybe a bit of support from users who are willing to report their findings.

_
c.

Hi Clement,

So I set up a button ‘AAA’ in a new toolbar in a new .rui as you showed using Point as the command, I just did not give it an image…

In the Macro library under the .rui, the macro shows up, under default not.

Ran the button a few times - but didn’t run any other command - and then went to macros/default and yes, the macro showed up there too.

Ran the button again a number of times and now I have two entries.

Note, I have not run any other command as you did - simply keep pressing the AAA button, nothing else.

Now, I noticed something funny. Totally bizarre. It is related to opening the Macros library window. If you just run the AAA button several times it will not produce more entries. However, EVERY TIME I open the macro window after having executed the command just once, I get a new entry.

To test:

  • I deleted all the ‘AAA’ macros in default.

  • Closed the window and re-opened it to verify (twice) - nothing there.

  • Ran the AAA button (point) just once.

  • Opened the macro window, now I see one ‘AAA’ entry under default. Hit OK to close.

  • Ran the AAA button once again.

  • Opened the macro window, now I see two ‘AAA’ entries

  • Ran the AAA button once again.

  • Opened the macro window, now I see three ‘AAA’ entries

  • Ran the AAA button once again.

  • Opened the macro window, now I see four ‘AAA’ entries

  • Etc. ad infinitum…

In fact, opening the macro window is also a command… So what it shows is that running alternately ‘AAA’ and then any other command will produce as many entries as the number of times you repeat. It is not necessary to run either the ‘AAA’ or the other command more than once each time.

I tested this simply by alternating between ‘AAA’ and ‘Cancel’ (the arrow button). I ran that half a dozen times in alternance and got 6 entries under Macros…

So yes, that could explain the several hundred unnamed (EditPythonScript) macros I have - I frequently use a script to quickly change object colors for example.

How bizarre… Nice find…!

1 Like

Thank you @Helvetosaur for testing this. I can repeat your sequence too, it is enough to run a command from a custom rui and just open _Macros. Adds one entry each. Using multiple commands also seems to add new entries.

I’ve recently deleted this file as it got very big again:

Rhino.UI.Resources.rui.default_c7da84fc-2991-4824-832a-4f2509bd0ede.xml

then used Rhino 8 for some hours. It was build again and grew in size. Upon inspection the 372 svg icons inside it are all my own ones coming from mutliple opened custom rui files.

When a user saves default using _ExportRuiFile then these duplicated icons coming from custom rui filles are included. But not a single icon from the default workspace.

Pascal’s example file contained only these, which seem to be custom ones too:

grafik

It’s bizarre indeed, maybe there is a purpose for this we don’t know yet…

still, i’m trying to get a full list of the default icons with their macro names plus commands.
_
c.

I never really looked at the file size of this, mine is currently about 5.3mb…

From the header:
<!--This file was generated by Rhinoceros and contains modified RUI file content-->
I assume it is what actually records the changes to default. In that case deleting it will nuke any changes one makes… I don’t want to do that as I have made a lot of mods I want to keep.

I do see that a 'virgin" file in a scheme that has never been modified is only 2kb and has only about 20 lines.

Yes, i’ve renamed mine multipe times to see what is missing in default when i open Rhino. The size increases after making changes to custom rui files or just using macros from custom rui files.

That Rhino.UI.Resources.rui.default_..... file seems to have hundrets of duplicates of my custom icons stored as svg files as well as duplicated macro_item entries. I don’t make any changes to default except small modifications eg. to the PopUp toolbar. If i nuke it, these changes are gone so it’s good to have a backup of that file…
_
c.

Hi @clement,

I have not yet read this entire thread. My apologies if something I ask or say has already been mentioned.

Just curious, how come?

This seems like the obvious command. However, it does not export the .svg. files of Rhino’s build-in .RUI file. I’ve logged. the issue. Keep in mind that if/when this is fixed, the export file will be quite large.

https://mcneel.myjetbrains.com/youtrack/issue/RH-81029

I’ve been unable to reproduce this. Are you are you have not modified your Default toolbars, macros, etc. in any way? You can tell by looking here:

%APPDATA%\McNeel\\Rhinoceros\8.0\settings\Scheme__Default

If you’ve done any modifications, where will be a Rhino.UI.Resources.rui.default_c7da84fc-2991-4824-832a-4f2509bd0ede.xml that contains the changes/additions.

– Dale

Hi @clement, @Helvetosaur,

I can repeat this (I think). Let me my head around the procedure, and I’ll log the issue.

Thanks,

– Dale

1 Like

Hi @dale, thank you for taking the time to answer.

i have not made any modifications to my default workspace except that i removed some macro entries from the _Macros dialog. These entries where all macros i have in my custom rui files. No idea how they came into the list of macros which is shown in the dialog when Library=default is selected.

After the last RC6 came out, i’ve removed the file:

Rhino.UI.Resources.rui.default_c7da84fc-2991-4824-832a-4f2509bd0ede.xml

from my system. Then i’ve installed SR6 (8.6.24074.1001, 2024-03-14) and made a few modifications to my custom rui files. Meanwhile, the above mentioned file got re-created in the Scheme_Default folder.

If i parse this file with my own rui analyser script, it contains 637 svg icons. If i look at these icons i see that they are all my own custom made icons which reside in custom rui files but not in default.

If i use the command _ExportRuiFile and export the default entry, it creates an rui file which contains these 637 icons. I can send you the script and rui file if required.

I’m trying to allow users to choose existing (default) macros from a dialog and use them in my own kind of toolbar. Therefore i need not only the command, but also the associated image (or svg) and the command script.

_
c.

@clement, @Helvetosaur - here is the duplicate macro issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-81061

– Dale

1 Like

RH-81061 is fixed in Rhino 8 Service Release 7 Release Candidate