Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CUIX load help in LISP

16 REPLIES 16
Reply
Message 1 of 17
RockyBrown4134
1948 Views, 16 Replies

CUIX load help in LISP

I wrote the following code to load a menu and ribbon, based on the user login:

 

(defun c:SCSG_CMS (/ LGN)		;For Testing
(setq LGN (getvar "loginname"))
(if
   (or 	(= LGN "user1")		;List of the possible users
	(= LGN "user2")
	(= LGN "user3")
	(= LGN "user4")
	(= LGN "user5")
   );end or
	(progn
	   (command "netload" "clsCMS_ACAD.dll")
	   (command "menuload" "CMSaddonACADmenu.cuix")
	   (command "cuiload" "CMSaddonACADmenu.cuix")
	   (command "RIBBON")
	   (command "startDE")	
	);end progn
	
);end if
);end defun

We have 40+ users but only a few need to load this menu. I want to keep it so all I have to do is update the list of users as the change. 

 

When I run the routine, the ribbon loads, but the menu does not. I made sure the Support File Search Path was correct.

 

I added the two lines:

	   (command "menuload" "CMSaddonACADmenu.cuix")
	   (command "cuiload" "CMSaddonACADmenu.cuix")

 I added either line  and both but I can not get it to load the Menu on the pulldown.

I must be missing something simple. I tried to search this group for loading .CUIX. Dind't find anything (or if I did it did not register in my mind.)

 

Any Suggetstions where I went wrong? Is there a better way to accomplish this? All comments and suggestions are welcome.

 

Thank you in advance.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
16 REPLIES 16
Message 2 of 17
paullimapa
in reply to: RockyBrown4134

If your menu file: CMSaddonACADmenu.cuix has the following:

1. MENUGROUP name ie: CMSaddon

2. Has a pull down menu section defined as "***POP1"

 

Then you can use the following function to place that pull down menu:

(put-mnugrp "CMSaddon")

 

; Place the mnugrp pulldown 3 positions over to the left from the last pulldown menu
(defun put-mnugrp (mnugrp / n )
  (if (menugroup mnugrp)
      (progn
       (setq n 1)
       (while (< n 24) ; there are 24 pulldown menu positions
        (if (menucmd (strcat "P" (itoa n) ".1=?"))
            (setq n (+ n 1))
            (progn
             (if (> n 3)
                 (setq n (- n 2))
                 (setq n 3)
             );if
             (menucmd (strcat "p" (itoa n) "=+" mnugrp ".pop1"))
             (setq n 25)(princ)
             (princ(strcat"\nMenu Group [" mnugrp "] loaded."))(princ)
            );progn
        );if
       );while
      );progn
  );if
);defun put-mnugrp

 

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 17
RockyBrown4134
in reply to: paullimapa


@paullimapa wrote:

If your menu file: CMSaddonACADmenu.cuix has the following:

1. MENUGROUP name ie: CMSaddon

     MENUGROUP name is CMS

 

2. Has a pull down menu section defined as "***POP1"

        In the CUI, menu name is CMS, Aliases is CMSacad, Element ID is ID_CMSacad

 

 


 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 4 of 17
paullimapa
in reply to: RockyBrown4134

So if your menugroup name is CMS and as I mentioned in my previous posting you'll need to have a pull down menu defined as ***POP1, then all you have to do is run this command: (put-mnugrp "CMS") and your pulldown menu will show.  If you have toolbars defined in your menu using ***TOOLBARS and you have a toolbar labeled as CMSToolbar then you'll need to bring these out with the following format: _.-TOOLBAR "CMS.CMSToolbar" _Top 0,2

 

I'm not aware of a way to just bring out what you have defined under Aliases as CMSacad, & Element ID as ID_CMSacad

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 17
RockyBrown4134
in reply to: paullimapa

Thanks. Heading out for the day. I will try this in the morning.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 6 of 17
paullimapa
in reply to: RockyBrown4134

So your cui file should have a Menu section similar to what's show in attache screen capture.

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 7 of 17
RockyBrown4134
in reply to: paullimapa

Here is what it actually looks like.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 8 of 17
paullimapa
in reply to: RockyBrown4134

Then you could try this:

Either change the Aliases name from CMSacad to Pop1

or

try this revised code which requires you to provide your Aliases name CMSacad instead of the set name of Pop1:

(put-mnugrp "CMSaddon" "CMSacad")

 

; Place the mnugrp pulldown 3 positions over to the left from the last pulldown menu
(defun put-mnugrp (mnugrp popname / n )
  (if (menugroup mnugrp)
      (progn
       (setq n 1)
       (while (< n 24) ; there are 24 pulldown menu positions
        (if (menucmd (strcat "P" (itoa n) ".1=?"))
            (setq n (+ n 1))
            (progn
             (if (> n 3)
                 (setq n (- n 2))
                 (setq n 3)
             );if
             (menucmd (strcat "p" (itoa n) "=+" mnugrp "." popname))
             (setq n 25)(princ)
             (princ(strcat"\nMenu Group [" mnugrp "] loaded."))(princ)
            );progn
        );if
       );while
      );progn
  );if
);defun put-mnugrp

 

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 9 of 17
dgorsman
in reply to: RockyBrown4134

Don't forget about workspaces as well.  AutoCAD will attempt to load the last used workspace at startup which may or may not include the desired menu.

 

I've also run into problems with client-supplied menus in CUIx files, with the following results:

- doesn't work well with Enterprise-located workspaces; the workspace has to be in the Main

- auto-saving workspace settings makes a real hash out of auto-loading CUIx/UI elements

- after loading the CUIx as partial to the Main, and having the appropriate menu loaded, the active workspace has to be reloaded; setting the system variable is ignored as it ignores the duplicate workspace name, this has to be done from the icon at the lower right of the application window

- trying to dynamically load partial CUIx files can end up with them being loaded multiple times: once at start up (it remembers what was already present)

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


Message 10 of 17
RockyBrown4134
in reply to: paullimapa


@paullimapa wrote:

Then you could try this:

Either change the Aliases name from CMSacad to Pop1

Don't really want to do this since this is a second party addon.

 

or

try this revised code which requires you to provide your Aliases name CMSacad instead of the set name of Pop1:

(put-mnugrp "CMSaddon" "CMSacad")

 

 Tried this several times(After exiting Autocad, Rebooting, combination of both).

Still only loads the Ribbon on my machine.  


 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 11 of 17
RockyBrown4134
in reply to: dgorsman


@dgorsman wrote:

Don't forget about workspaces as well.  AutoCAD will attempt to load the last used workspace at startup which may or may not include the desired menu.

                                         I agree. 

 

I've also run into problems with client-supplied menus in CUIx files, with the following results:

- doesn't work well with Enterprise-located workspaces; the workspace has to be in the Main

                                         the workspace are in the Main CUI

 

- auto-saving workspace settings makes a real hash out of auto-loading CUIx/UI elements

                                             Auto-save is turned off

 

- after loading the CUIx as partial to the Main, and having the appropriate menu loaded, the active workspace has to be reloaded; setting the system variable is ignored as it ignores the duplicate workspace name, this has to be done from the icon at the lower right of the application window

                                             Not sure I understand wich Icon. Can you post a picture?

 

- trying to dynamically load partial CUIx files can end up with them being loaded multiple times: once at start up (it remembers what was already present)

                                            I agree.


 

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 12 of 17
dgorsman
in reply to: RockyBrown4134

Workspace icon.png

 

The active workspace is ticked (its also possible to have no active workspace under some circumstances).  Clicking the active workspace from the list will reload it, which is sometimes necessary to have the changes shown.

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


Message 13 of 17
paullimapa
in reply to: RockyBrown4134

Looks like the Alias must be named Pop1.

I created a sample CMSaddon.mns which I used Menuload to create the cuix.

Right away with Alias named as Pop1, the pull down showed up after Menuload:

 

(command"menuload""cmsaddon.cuix") or (command"menuload""c:/temp/cmsaddon.mns")

(put-mnugrp "CMSaddon" "Pop1")

 

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 14 of 17
RockyBrown4134
in reply to: paullimapa

I just noticed, there are 23 pull down menus. Could that cause a problem?

 

 

cms10-2-14.jpg

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 15 of 17
paullimapa
in reply to: RockyBrown4134

Doing a google search according to this link:

http://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/AutoCA...

 

Pull-Down Menu Aliases

Pull-down menus should have one alias in the range of POP1 through POP499. Menus with an alias of POP1 through POP16 are displayed on the menu bar by default when the customization (CUIx) file is loaded. All other menus must be added to a workspace to be displayed.

 

 

Area Object Link | Dwg Setup | Feet-Inch Calculator | List on Steroids
Exchange App Store

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 16 of 17
RockyBrown4134
in reply to: paullimapa

Thanks. I'll read tonight.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D
Message 17 of 17
RockyBrown4134
in reply to: paullimapa


@paullimapa wrote:

Doing a google search according to this link:

http://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/AutoCA...

 

Pull-Down Menu Aliases

Pull-down menus should have one alias in the range of POP1 through POP499. Menus with an alias of POP1 through POP16 are displayed on the menu bar by default when the customization (CUIx) file is loaded. All other menus must be added to a workspace to be displayed.

 

 


I read the posted link last night and got to thinking.

 

Could I look at this in a different way? Could I load the CMSaddon.cuix, then in the acadmain.cuix, just remove the menu from the workspaces that do not require the add on?

 

Just a thought.

If this response answers your question, Please mark this response as "Accept as Solution"

Rocky Brown
AutoCAD 2020 / Inventor 2020 / Plant 3D

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost