Update menus after updating cuix without menu unload/reload?

Update menus after updating cuix without menu unload/reload?

Jason.Rugg
Collaborator Collaborator
3,292 Views
32 Replies
Message 1 of 33

Update menus after updating cuix without menu unload/reload?

Jason.Rugg
Collaborator
Collaborator

We have a custom tab/panel in our ACAD ribbon. We are always updating our custom items, the cuix is in a network location that all users have access to but users can't simply shutdown ACAD and relaunch to get the newest updates. The users or myself have to manually unload/reload the cuix to get the newest updates. Is there a better/more automated way of reloading the cuix? My initial thought was a simple lisp that silently runs menuload but there doesn't appear to be command line options for this.

 

Any suggestions?

0 Likes
Accepted solutions (2)
3,293 Views
32 Replies
Replies (32)
Message 2 of 33

Jason.Rugg
Collaborator
Collaborator

I did remember that I could set the FILEDIA variable to 0 and that allows a silent MENUUNLOAD and MENULOAD. So I started writing a simple lisp that would set FILEDIA to 0 and then run the menuunload command. I can get our custom menu to unload via command line but not reload because I cant specify the network path to the cuix file, only the cuix filename. 

0 Likes
Message 3 of 33

ronjonp
Mentor
Mentor

Have you tried deleting the MNR file associated with your CUI?

0 Likes
Message 4 of 33

dgorsman
Consultant
Consultant

Menu, or ribbon?  Either way,  you need to be considering the workspace - that's what controls the UI elements the user sees.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 33

Jason.Rugg
Collaborator
Collaborator

This is a ribbon tab/panel.

0 Likes
Message 6 of 33

Jason.Rugg
Collaborator
Collaborator

So do you have a solution by using workspace? 

0 Likes
Message 7 of 33

Jason.Rugg
Collaborator
Collaborator

Can you elaborate on this?

0 Likes
Message 8 of 33

ronjonp
Mentor
Mentor

Just a stab in the dark, but way back when I was changing graphics and adding stuff to menus/ribbons I had to delete the compiled MNR ( Menu Resource File ) to see those changes. I'm not sure this is the problem you're having though. My case is a bit different too as the cui file is located on each computer ( we have travelers with laptops )  so I'm not sure where this compiled file is stored since it's usually in the same directory as the CUI. Clear as mud ? 🙂

0 Likes
Message 9 of 33

Jason.Rugg
Collaborator
Collaborator

Thanks for the clarification, I don't think it's useful in my scenario though.

0 Likes
Message 10 of 33

Moshe-A
Mentor
Mentor

@Jason.Rugg  hi,

 

have you tried this?

 

(command "._cuiload" "YourCuiFile")

 

moshe

 

0 Likes
Message 11 of 33

ronjonp
Mentor
Mentor

Maybe this code HERE can help you with the load/unload.

0 Likes
Message 12 of 33

Jason.Rugg
Collaborator
Collaborator

@Moshe-A I have tried this but my cuix file is in a network location and from what I can tell there isn't a way to specify that location, only the cuix file name which it does not recognize/find.

0 Likes
Message 13 of 33

ronjonp
Mentor
Mentor

@Jason.Rugg wrote:

@Moshe-A I have tried this but my cuix file is in a network location and from what I can tell there isn't a way to specify that location, only the cuix file name which it does not recognize/find.


I just tested the menuunload/menuload for one of my custom CUI's and this worked passing a path to the load?

(setvar filedia 0)
(command "_.menuunload" "IDT")
(command "_.menuload" (findfile "idt.cuix"))
(setvar filedia 1)

I'd probably use the vla route to do this though for a bit more error trapping and not having to mess with setting variables.

0 Likes
Message 14 of 33

Jason.Rugg
Collaborator
Collaborator

@ronjonp Help me understand why it's not working for me, I am not the best at lisp, obviously... Here is my code, when I run it I get the error too many arguments:

 

(defun c:MENUFIX ()
(setvar filedia 0)
(command "_.menuunload" "KCI-Client_Print")
(command "_.menuload" (findfile "KCI-Client_Print.cuix"))
(setvar filedia 1)
(princ)
)

0 Likes
Message 15 of 33

ronjonp
Mentor
Mentor

That was my bad .. forgot to quote the 'filedia variable .. try this below:

(defun c:menufix (/ f)
  ;; Check if we can find the CUI .. otherwise you'll need to hardcode the path in
  (if (setq f (findfile "R:\\CAD\\Keys\\Menu\\2019\\KCI-Client_Print.cuix"))
    (progn (setvar 'filedia 0)
	   (command "_.menuunload" (vl-filename-base f))
	   (command "_.menuload" f)
	   (setvar 'filedia 1)
    )
    (print "KCI-Client_Print.cuix not found...")
  )
  (princ)
)
0 Likes
Message 16 of 33

Jason.Rugg
Collaborator
Collaborator

I think this will eventually get it but I think the network path is going to have to be hard coded, how do I do that? The path is: R:\CAD\Keys\Menu\2019 

0 Likes
Message 17 of 33

ronjonp
Mentor
Mentor

Code updated above .. in lisp you have to escape the \ with \\ in paths.

0 Likes
Message 18 of 33

Jason.Rugg
Collaborator
Collaborator

Still no dice, it still cant find the file, I even added \\ after 2019 before the filename and it still didn't work.

0 Likes
Message 19 of 33

ronjonp
Mentor
Mentor

That is very strange. Are you sure you have the correct path and filename?

0 Likes
Message 20 of 33

Jason.Rugg
Collaborator
Collaborator
Accepted solution

Got it. I had to remove the "_" from the \\KCI-Client Print.cuix")) and then on the menuunload I had to add the underscore back and remove the cuix extension.

 

(defun c:menufix (/ f)
(if (setq f (findfile "R:\\CAD\\Keys\\Menu\\2019\\KCI-Client Print.cuix"))
(progn (setvar 'filedia 0)
(command "_.menuunload" "KCI-Client_Print")
(command "_.menuload" f)
(setvar 'filedia 1)
)
)
(princ)
)

0 Likes