Update menus after updating cuix without menu unload/reload?

Update menus after updating cuix without menu unload/reload?

Jason.Rugg
Collaborator Collaborator
3,297 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,298 Views
32 Replies
Replies (32)
Message 21 of 33

ronjonp
Mentor
Mentor

@Jason.Rugg wrote:

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)
)


Glad you got it sorted (y).

0 Likes
Message 22 of 33

Jason.Rugg
Collaborator
Collaborator

@ronjonp Now I'm not sure what's going on with the lisp, it was working perfectly, I closed and relaunched acad ran the command and not it says "too many arguments". Nothing changed, why would it work and then not work after a relaunch?

0 Likes
Message 23 of 33

ronjonp
Mentor
Mentor

Not sure .. it might bomb if the menu is not loaded then the menuunload command is used?

0 Likes
Message 24 of 33

Jason.Rugg
Collaborator
Collaborator

Nope, I manually unloaded and ran the command and it still says too many arguments.

0 Likes
Message 25 of 33

ronjonp
Mentor
Mentor

Sorry don't know what to tell you. I tested the latest snippet with my custom menu and it works fine.

0 Likes
Message 26 of 33

Jason.Rugg
Collaborator
Collaborator

@ronjonp Try this one if you would, maybe I inadvertently changed something and didn't realize it. I did remove the initial (if

 

(defun c:MENUFIX (/ f)
(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
Message 27 of 33

ronjonp
Mentor
Mentor

You could try this code too if you want:

(defun c:menufix (/ f mgs mn o)
  ;; RJP - 03.30.2018
  (vl-load-com)
  (setq mn "KCI-Client_Print")
  (cond	((and (setq mgs (vla-get-menugroups (vlax-get-acad-object)))
	      (= 'vla-object (type (setq o (vl-catch-all-apply 'vla-item (list mgs mn)))))
	 )
	 (setq f (vla-get-menufilename o))
	 (vl-catch-all-apply 'vla-unload (list o))
	 (vl-catch-all-apply 'vla-load (list mgs f))
	)
  )
  (princ)
)
0 Likes
Message 28 of 33

Jason.Rugg
Collaborator
Collaborator
Accepted solution

Well it's fixed, it's amazing what a system reboot can fix sometimes, not sure what was wrong but it works again after a reboot.

0 Likes
Message 29 of 33

ronjonp
Mentor
Mentor

Did you try the code above ?

0 Likes
Message 30 of 33

ВeekeeCZ
Consultant
Consultant

@ronjonp wrote:

Did you try the code above ?


 

I did... unfortunately it's not working due the space with in the file name. See the other thread.

0 Likes
Message 31 of 33

ronjonp
Mentor
Mentor

@ВeekeeCZ wrote:

@ronjonp wrote:

Did you try the code above ?


 

I did... unfortunately it's not working due the space with in the file name. See the other thread.


@ВeekeeCZ 

What other thread? Also .. just tested a cuix that has a space in the name as well as path and it worked fine here?

 

0 Likes
Message 32 of 33

ВeekeeCZ
Consultant
Consultant

@ronjonp wrote:

@ВeekeeCZ wrote:

@ronjonp wrote:

Did you try the code above ?


 

I did... unfortunately it's not working due the space with in the file name. See the other thread.


@ВeekeeCZ 

What other thread? Also .. just tested a cuix that has a space in the name as well as path and it worked fine here?

 


Sorry about that. Too quick assumption. In fact, now I'm not sure if it works or not.

The OP's routine confirms both unload and load to the command line. Yours confirms just the unload, for some reason.

Your routine is twice as fast as the OP's... So that was my assumption.

Now, looking if the test cui is still loaded in MENULOAD dialog... It is... so it probably works, but I cannot prove if the update was successful visually because test cui file is empty.

So please never mind my previous note. And keep on on your good work! Man Wink

 

0 Likes
Message 33 of 33

ronjonp
Mentor
Mentor

@ВeekeeCZ wrote:

@ronjonp wrote:

@ВeekeeCZ wrote:

@ronjonp wrote:

Did you try the code above ?


 

I did... unfortunately it's not working due the space with in the file name. See the other thread.


@ВeekeeCZ 

What other thread? Also .. just tested a cuix that has a space in the name as well as path and it worked fine here?

 


Sorry about that. Too quick assumption. In fact, now I'm not sure if it works or not.

....

So please never mind my previous note. And keep on on your good work! Man Wink

 


Thanks for testing and the encouragement. 🙂 From my quick tests it works pretty well.

0 Likes