Plugin created menu item isn't removed when plugin is unloaded
I am converting a plugin from AutoCAD to BricsCAD and think now I have got the most of it done. Seems that most bugs are fixed, so that's great. One thing that isn't working is that my plugin creates a menu item and when you exit AutoCAD it unload the plugin and the menu item is removed. In BricsCAD the menu item is still here. So even after a restart of BricsCAD without loading the plugin the menu is visible, but you can't press on anything since nothing is assigned to it. This created a lot of crasches since my plugin startup routine tries to create a menu that is already existing and so on.
Comments
-
surely there are some ways to handle this.
have you tried the VLR-DWG-Reactor with the event :vlr-beginClose?0 -
Unfortunately, you have not specified in what language you write plugins And exactly how you create the menu.
It would be logical to check if the CUI file is already loaded or not. Unfortunately, the dotNet API of BricsCAD does not have a way to autoload the CUI along with the plugin, so you have to call LISP:doc.SendStringToExecute($"(if (eq (menugroup \"{name}\") nil) (command \"_CUILOAD\" \"{file}\")) " , false, true, false);
If you still want to implement some actions at shutdown, then it would be logical to place them in the Terminate method of your inheritor of the IExtensionApplication interface.
0 -
I am writing it in C++
0