Partial Menu - Menu on Menubar

Partial Menu - Menu on Menubar

Anonymous
Not applicable
772 Views
2 Replies
Message 1 of 3

Partial Menu - Menu on Menubar

Anonymous
Not applicable

I found some code here...that checks to see if my Custom Menu isloaded when AutoCAD starts..if not, it loads it. However, when this happens, it does not bring in the menu's "POP" menu or Pull down Menu Item in the Menubar

Does anybody have code that can check for that...and bring it in also?

 

I have tried using PROFILES....but PROFILES eveidently do not save PARTIAL MENU loads...so I can get them to come across from machine to machine

Here is what I am using for the menu itself...this is loaded at Startup

(setq flag1 T)
(setq loaded (menugroup "fdvessel"))
(if (= loaded nil)
  (progn
    (setq temp (findfile "fdvessel.MNU"))
    (if temp
      (progn
        (setvar "FILEDIA" 0)
        (command "menuload" "fdvessel")
        (setvar "FILEDIA" 1)

      ) ;progn

      (progn
        (alert "Cannot Locate fdvessel Menu.")
        (setq flag1 nil)
      ) ;progn
    ) ;if
  ) ;progn
)  ;if

(if flag1
  (prompt "\nFD Vessel Custom Menu Loaded....")
)  ;if

(princ)

(princ)

0 Likes
773 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Have you checked if the menu is loaded but not showing in your CUI? We had some troubles with that in the past with a full CUI file. It was loaded but not showing, I couldn't find a way to check wether its showing or not so I fixed it simply by unloading and reloading on startup regardless.

Would be command "Menuunload".

 

Hope this helps you but please ask more if it doesn't

 

0 Likes
Message 3 of 3

scot-65
Advisor
Advisor

I had help building this section of code from other (distinguished) members in this community

therefore, I will share what I have to you.

 

Discovering if the desired POP is visible and displaying the desired POP is two completely

different animals. What is required for the display is both the POP's Element ID and the

POP's Alias Name. You will need to discover these items. I believe there might be a menu

name prefix that is also needed [MenuName.PopAliasName] when displaying(?).

 

The function below takes an argument, which is the POP Alias Name (one of them as there

might be several).

 

You may need to sort thru this and tailor to your needs as this was designed as

"Drawing Mode Switching" where the current mode's POP can be placed anywhere

in the menubar, yet allow swapping to another mode at that position. It will also remove strays.

 

;;
;;==== FUNCTION Set Dwg Mode Menu Bar POP (also removes stray DM POP's) =====
;; Argument is [POP alias name].
(defun XXXX-POP ( a / b f n ELID )
 (setq b nil)
 (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"
 ))))
 ;*** For each "Drawing Mode" POP to be added, add the "Element ID" to this list. ***
 (setq ELID (list "292C2" "11001" "B185C" "2225A" "9789C" "84D56" "91EE8" "126F2"
          "E6690" "98056" "4A7AC" "21D28" "4FF39" "FED66" "EEB50" "B347F" "72FFA"))
 (setq n 1 f nil)
 (foreach x (reverse b)
  (if (member x ELID)
   (if (not f)
    (progn (menucmd (strcat "P" (itoa n) "=" a))(setq f n)) ;swap menu
    (progn (menucmd (strcat "P" (itoa f) "=-"))(setq f (1- f))) ;remove stray
   );if
  );if
  (setq n (1+ n))
  (if f (setq f (1+ f)))
 );foreach
 (if (not f) (menucmd (strcat "P" (itoa n) "=+" a))) ;display if none found
 (setq b nil f nil n nil ELID nil)
);end XXXX-POP
;;

Background: Our previous menu had POP swapping at the 11th position regardless of what was there.

If one was to move the "Drawing Mode" POP to another position (say to the end, which is the 16th position),

what was at the 11th position would be swapped and the 16th position remained (resulting in two unique

Drawing Mode POP's). Removing the "Help" and "Parametric" POPs from the menubar would again disrupt

the position of the POP in which to swap.

 

???

 


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

0 Likes