How to Make Ribbons and Toolbars for BricsCAD and AutoCAD

A collection of notes... Say your menu is MenuName

General points to consider

  • About programs
    • Your CAD program BricsCAD (or AutoCAD)
    • Inkscape for making and exporting icons
    • 7-zip
    • Notepad++
    • XML copy editor
  • About icons
    • Icons as BMP files our outdated, PNG files are the way to go.
    • Keep originals in high resolution, vector based is preferred. If you want sharp images, design them in a 16*16 pixels grid in Inkscape with a line width of 1 pixel. Keep them as good as posible in the grid squares, to prevent blurring of the exported bitmaps. Writing your source icons in SVG gives you an easy way to batch export them to 32*32 and 16*16 pixels size.
  • About file name extensions:
    • MNU files contain all interface information in an easy to edit structure. Life was beautiful until CUI's appeared. MNU's are obsolete but, read on...
    • CUI's contain XML code, defining toolbars, ribbons and so on. Thanks to XML, they are build as blocks. While easier to read by machines, XML is harder to edit manually than good old MNU files.
    • CUIX is what AutoCAD uses, unzip and discover it holds all icon bitmaps and CUI files as parts. Nice because everything is in one file. Not so nice because it holds bloat UID information.
    • RESZ is a container for icons in BricsCAD. It is nothing more than a zipped archive with PNG's (no compression needed and wanted).
    • MNL's are LISP files that are loaded when a menu with the same name is loaded. Splendid solution but Autodesk spoiled the show with forbidding running code outside trusted locations.
    • Then there are several formats to mention briefly: MNR's hold MeNu Resources, icons in one file, obsolete. MNS's are MeNu Source files a precompiled readable step after loading a MNU. Files with *._light.* are for AutoCAD to support their "Light Theme", kind of a cheap hack, should have been part of CUI, hey, that is what XML is for..., see support the dark theme.

Challenges

The way Autodesk introduced trusted paths is at the least to say clumsy because it shut down a lot ways to create applications, ranging from that nice little LISP routine to large applications. On the other hand, security is important and concerns about running malicious code are justified. Bricsys luckily did not follow this path so far but one day they have to answer to the question how to better protect against malicious code execution. Educating users not to download and use code from other sources than trusted ones, like hired and screened coders and evaluated and registered apps from the app store, is not only the least thing to do but also the most important first step. After that, what is left of the risks? Depending on the answer, execution of code could be limited to code in the "program Files" environment. But that should not break things like loading MenuName.cui from the "application data" environment and refuse to run MenuName.mnl. This is an interesting topic and time will tell where we end up with. For now, the most important thing is to design menu's with an as much as possible shared base between BricsCAD and AutoCAD. It was for us the reason to create a cross CAD platform autoloader, see ACME.

Some comments on menu conversions

A while ago, .mnu files were the only way to define menu's. Defining them in XML was a logical step, but it took away - or at least limited - the possibility to use a text editor like notepad++ to maintain menu's. Custom User Interface files, .cui, files were introduced. These XML files could be created from .mnu files and this is possible up to today in both CAD programs. Conversion is lossless. At NedCAD we keep our source menu's, consisting of many hundred lines, in .mnu format because translation to .cui is seemless. We don't use the command CUI for editing .cui files.

When ribbons were introduced, there was a good reason not to use them and to neglect them: They are for starting CAD users and they eat up your priceless monitor space. But some users wanted them so we used CUI to make it and created a file for that:

<RibbonRoot>
All definitions
</RibbonRoot>

This way we can still use our .mnu files as a base and inject the RibbonRoot part later.

For BricsCAD, thumbnails for buttons can be placed in a container by zipping them to a file and then renaming the file to MyMenu.resz. No compression, just storing is preferred.

Autodesk introduced .cuix files at some moment. These zipped files contain everything, including button thumbnails. AutoCAD sees them if you put them in the same folder as the .cuix file. You can feed AutoCAD the BricsCAD .cui file in order to make a .cuix menu.In fact, AutoCAD finds these .cui's and translates them automatically. Unfortunately, there are often problems with fly-outs that are ignored. So the best way to create a .cuix file is to feed a .mnu file at CUILOAD.

For BricsCAD to make a .cui file, it can read an AutoCAD .cuix file. Unfortunately, the bloat AutoCAD xml tags from the .cuix are imported to the .cui file. So when choosing a menu to load in BricsCAD with CUILOAD, always choose .cui, not cuix.

Sometimes these xml files get a bit messed up. Don't hesitate to start XML copy editor end press F11 for "pretty printing". Look what is wrong with Notepad++ or XML copy editor and fix it.

This site is hosted by NedCAD.

De inhoud van deze site wordt aangeboden zoals het is, zonder enige vorm van garantie en heeft verschillende licenties. Meer informatie over licenties staat hier.