Custom drop-down menu loads into all workspaces EXCEPT current workspace

Custom drop-down menu loads into all workspaces EXCEPT current workspace

toolbox2
Advocate Advocate
447 Views
7 Replies
Message 1 of 8

Custom drop-down menu loads into all workspaces EXCEPT current workspace

toolbox2
Advocate
Advocate

I have a custom partial CUIX that is loaded via the ACADDOC.lsp file. The toolbars and ribbon tab will load but the drop-down menu never loads into the current workspace. If I flick into a different workspace I discover that the drop-down menu is there. In fact, it is available in ALL workspaces EXCEPT the current one at the time of loading.

 

For the current workspace, I have to go into CUI, Customise Workspace, and ensure the menu is ticked. Sometimes it is already ticked and I have to clear it, then reselect. OK to the CUI dialogue and the drop-down menu will appear. I only have to do this once but multiple users have the same problem.

 

If I unload the custom CUIX and reload it using MENULOAD then the drop-down menu will load correctly into the current and other workspaces.

 

My ACADDOC file calls another Lisp file which does the actual loading of the partial CUIX and various custom Lisp routines.

 

Here's the bit that loads the CUIX :

 

;; local variable "support_path" stores the path to the CUIX file on a network drive

(if (findfile (strcat support_path "EngCon_Tools.cuix"))  

 

(if (= (menugroup "EngCon_Tools") nil)

(command "_cuiload" (strcat support_path "EngCon_Tools.cuix"))

(princ "\nEngCon_Tools menu already loaded OK\n")


;; else display error message box
(alert "Unable to locate EngCon_Tools.cuix")

) ;; end if

 

 

This has been happening at least since v2019 and on our current v2021. AutoCAD Map 3D and Civil 3D.

 

Any ideas how I can make the drop-down menu appear when the CUIX file is loaded?

0 Likes
448 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor

Maybe unload it then reload this is done here to make sure latest version is loaded.

 

 

 

(setq Menu_Path "C:\\xxx-CAD-TOOLS\\"); Path to Menu file
(setq Menu_Name "xxx-CAD-TOOLS"); pop menu to load
(setq Group_Name "xxxMENU"); groupname assigned in .mnu or .mns file

(if (menugroup menu_Name)
(command "_MENUUNLOAD" menu_Name)
)

(if  (> (vl-string-search  "BricsCAD" (getvar 'acadver)) 0)
(progn
(command "MENULOAD" (strcat Menu_Path Menu_Name ".CUI"))
(menucmd (strcat "P20=+" menu_Name ".POP1"))
)
(progn
(setq cnt (vla-get-count(vla-get-menuGroups (vlax-get-acad-object))))
(command "MENULOAD" (strcat Menu_Path Menu_Name))
(menucmd (strcat "P" (rtos (+ cnt 1) 2 0) "=+" menu_Name ".POP1"))
)
)

 

 

0 Likes
Message 3 of 8

toolbox2
Advocate
Advocate

Thanks for the suggestion.

 

Unfortunately, it doesn't work for me. Although the commands are carried out (MENUUNLOAD etc) my drop-down menu still doesn't appear in the current workspace.

0 Likes
Message 4 of 8

ronjonp
Mentor
Mentor

@toolbox2 

Have you tried loading your code with a  'EngCon_Tools.mnl' file in the same directory as your CUI ?

0 Likes
Message 5 of 8

Sea-Haven
Mentor
Mentor

I forgot after fixing the menu display resave the workspace, have seen stuff not save and this fixed it. We had user workspace rather than the default acad ones. Bit safer if something goes wrong in the menu load.

0 Likes
Message 6 of 8

toolbox2
Advocate
Advocate

Thanks for this tip. I'd forgotten about MNL files (I thought they were largely defunct) but I found acetmain.mnl which inserts the Express Tools drop-down menu at a particular position, so I'm going to see if that will offer some clues.

0 Likes
Message 7 of 8

toolbox2
Advocate
Advocate

After loading the CUIX, I can go into the CUI editor and force the drop-down menu on and it stays saved in the workspace, so that's not a problem. It's just the initial loading of the menu that doesn't work.

 

I'm going to look into MNL files next.

 

One other thing - you say you unload and reload your CUIX to ensure you have the latest changes made to the CUIX. Doesn't that happen anyway without needing to unload? Our partial CUIX resides on a network drive. Whenever I edit the file, the changes appear for everyone without them needing to unload and reload.

0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

You are correct 8 users only 1 cuix existed on the server, I would make changes to menu's then re save to server, on next opening of Acad new menu would be there for all users.

0 Likes