Announcement

Collapse
No announcement yet.

menu tip

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • menu tip

    These are some routines I found which are very handy for customizing the menu. The first two turn toolbars on or off. The last one looks to see if a menu is displayed.

    I can't take credit for writing any of them but i've found them very useful.

    enjoy.

    cj



    Code:
    ;;syntax (cjf:TurnToolbarOn "ACAD" "Mytoolbar")
    (defun cjf:TurnToolbarOn (menu tbname / tmp obj pixs)
      (vlax-for toolbar (vla-get-toolbars (vla-item (vla-get-menugroups (vlax-get-acad-object)) menu))
        (setq tmp
    	   (cons (list (strcase (vla-get-name toolbar)) toolbar) tmp)))
      (setq obj (cadr (assoc (strcase tbname) tmp)))
      (vla-put-visible obj :vlax-true)
      (princ)
      )
    
    
    ;;syntax (cjf:TurnToolbarOff "ACAD" "Mytoolbar")
    (defun cjf:TurnToolbarOff (menu tbname / tmp obj pixs)
      (vlax-for toolbar (vla-get-toolbars (vla-item (vla-get-menugroups (vlax-get-acad-object)) menu))
        (setq tmp
    	   (cons (list (strcase (vla-get-name toolbar)) toolbar) tmp)))
      (setq obj (cadr (assoc (strcase tbname) tmp)))
      (vla-put-visible obj :vlax-false)
      (princ)
      )

    [code]
    ;;syntax (rrbI:isPopupDisplayed "File")
    ;;;by Robert Bell
    (defun rrbI:IsPopupDisplayed (popName / Found)
    (vl-Load-Com)
    (vlax-Map-Collection
    (vla-Get-MenuBar (vlax-Get-Acad-Object))
    (function
    (lambda (objPopup)
    (cond ((= popName (vla-Get-NameNoMnemonic objPopup))
    (setq Found T))))))
    Found)

    [code]
Working...
X