menucmd Gacad

menucmd Gacad

Anonymous
Not applicable
665 Views
7 Replies
Message 1 of 8

menucmd Gacad

Anonymous
Not applicable

So I looked at past posts of Gacad and it doesn't completely help.

 

Okay, so I have this line 

 

 

 

	(menucmd "Gacad.Help=+CUI NAME.MENU NAME")

 

This is supposed to put my customized menu right beside the "Help" menu.

 

This WORKS in Autocad2014, 2015, 2016 which is fantastic. This DOES NOT work with AutoCAD Mechanical 2016 or AutoCAD Architecture 2016 and this is an issue because I need this to work for all VBA compatible versions of AutoCAD. I tried using "Gamacad" and "Gaca" respecitively because that is what it shows for the cuix name with no luck. Need some help on this. I couldn't even find what "Gacad" refers to inside the AutoCAD2016 'acad.cuix' file. which is mindboggling to me.

 

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

paullimapa
Mentor
Mentor

Try this (cui_mnu) lisp code which would always position your custom menu, if loaded, after the last drop down menu regardless of the name.

After saving it as a lisp file called cui_mnu.lsp, appload it and then type command (cui_mnu).

 

You'll have to replace in the code "CUI NAME.MENU NAME" with the actual names:

--------------------------------
; Places the specified custom drop down menu to the left of the last drop down menu already loaded
(defun cui_mnu( / n )

 (if (menugroup "CUI NAME") ; if this menu group is actually loaded

  (progn
   (setq n 1)
   (while (< n 24)
    (if (menucmd (strcat "P" (itoa n) ".1=?")) ; test if drop down menu exists
     (setq n (+ n 1))
     (progn                                                  ; if available
      (if (> n 3)
       (setq n (- n 2))
       (setq n 3)
      );if
      (menucmd (strcat "p" (itoa n) "=+CUI NAME.MENU NAME")) ; place custom drop down menu to the left
      (setq n 25)
     );progn
    );if

   );while

  );progn

 );if
);defun cui_mnu

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 8

scot-65
Advisor
Advisor

Another method:

 

You will need to know the actual Element ID of the 'target' POP.

Command CUI and expand "Menu" in the first pane.

Highlight target menu and look in the fourth pane for it's Element ID.

 

This will find it's position and you can place your POP.

 

 (setq a "MyPopToAdd")
(vl-catch-all-apply (function (lambda () (vlax-for menu (vla-get-menubar (vlax-get-acad-object)) (setq b (cons (substr (vla-get-TagString menu) 9) b)) ;"Element ID" )))) (setq ELID "292C2") ;the Element ID in question (setq n 1) (foreach x (reverse b) (if (= x ELID) (menucmd (strcat "P" (itoa n) "=+" a)) );if (setq n (1+ n)) );foreach *Note: This is a simplified snippet derived from a working block of code of much different geometry. *untested as shown*

Good Luck!

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 4 of 8

Anonymous
Not applicable

Thanks guys for the reply and sorry it took me forever to reply. An update to my situation is much overdue.

 

(menucmd "Gampp.Help=+loginMenu.login") was able to work on AutoCAD Mechanical 2016, it was however not able to work on AutoCAD Mechanical 2014. what happens is for whatever reason, the entire menubar is replaced, and I still don't get my menu. Here are two pictures of a before and after.

 

 

Before:

before.jpg

 

 

 

 

 

 

 

After:

 

before.jpg

 

 

There is supposed to be a Login button. Right beside the Help button in the 'Before' side.

 

Again, this works for vanilla AutoCAD and AutoCAD Mechanical 2016 and does not work for 2014. I have also tried

 

(menucmd "P(x)=+loginMenu.login")

 

where x is an integer from 0-16 and still does not do anything.

0 Likes
Message 5 of 8

Anonymous
Not applicable

Couldn't find the edit button, but @paullimapa, I tried your code and still no results. Also @scot-65, not quite what I'm looking for.

 

I feel like the solution should be simple enough to get it to display like the other versions of AutoCAD.

0 Likes
Message 6 of 8

scot-65
Advisor
Advisor

Based on the screenshots you show, it looks as if the
desired workspace is not "Default" and/or "current".

 

At least that is what the issue is when the POPs do not show...

 

56719f7a.jpg

 

 

A little background on the snippet I provided.

The menu system I am updating swaps POPs for each

drawing mode. I do not like this however I am working

with it. The system used to swap position 11 regardless

of what was being displayed. Well having a fixed position

does not work so as part of the update, find the currently

displayed drawing mode pop (using Element ID) and swap

that position with the new drawing mode POP.

There are 20 drawing modes we use.

 

???

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 7 of 8

Anonymous
Not applicable

How did you pull up the little window with the workspaces? Also, it doesn't matter which workspace it starts in, it ALWAYS does that until I switch workspaces. I have to switch workspace, then type in the command 'MENUBAR' and make that 1, THEN I will get the bar. It's not intuitive and I'd prefer that to not be the case.

0 Likes
Message 8 of 8

scot-65
Advisor
Advisor
The only comment I have is from past viewings in this wonderful forum...
Verticals sometimes have a mind of their own
(I've seen quite a few PGP issues with the verticals).
???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes