IntelliCAD.net

The IntelliCAD Network

;;;-===-==-==-==-=-==-==-==-=-==-==-=-==-==-=-==-==-=-==-==-=-==-=-==-
;;;(Menu:loadDynamicPopUpMenu '("Mymen&u" (
;;;              ("&Do Command1" . "command1")
;;;              ("D&o Command2" . "command2")
;;;              ("Do &Command3" . "command3")
;;;)))
;;;-===-==-==-==-=-==-==-==-=-==-==-=-==-==-=-==-==-=-==-==-=-==-=-==-
 
(defun Menu:loadDynamicPopUpMenu (menulist     /
                                  acadapp      cmd
                                  currmenugroup
                                  doc          loadedmenulist
                                  menu         newmenu
                                 )
  (vl-load-com)
  (setq acadapp        (vlax-get-acad-object)
        loadedmenulist '()
        doc            (vla-get-activedocument acadapp)
        currmenugroup  (vla-item (vla-get-menugroups
                                   (vla-get-application doc)
                                 )
                           "BRICSCAD"
                       )
  )
  (if (/= currmenugroup nil)
    (progn
      (vlax-for menu (vla-get-menus currmenugroup)
        (setq loadedmenulist
               (cons
                 (vla-get-namenomnemonic menu)
                 loadedmenulist
               )
        )
      )
      (if (= (vl-position (car menulist) loadedmenulist) nil)
        (progn
          (setq newmenu (vla-add (vla-get-menus currmenugroup)
                                 (car menulist)
                        )
          )
          (foreach e (car (cdr menulist))
            (vla-addmenuitem
              newmenu
              (1+ (vla-get-count newmenu))
              (car e)
              (cdr e)
            )
          )
          (vla-insertinmenubar
            newmenu
            (1+ (vla-get-count
                  (vla-get-menubar acadapp)
                )
            )
          )
        )
        (princ (strcat "\nerror: "
                       (car menulist)
                       " menu is already loaded "
               )
        )
      )
    )
  )
  (princ)
)

Tags: Bricscad

Reply to This

Replies to This Discussion

Its been a really long time since I looked at LISP code. ;-)

Reply to This

I know what you mean, I've been using C++ as my primary language for just long enough to where the lisp is starting to fade. I force myself to jump back in every once and a while so I don't get lost in those parentheses : )

Reply to This

Daniel,

Getting lost in the parentheses was the precise thing which made C++ seem like poetry to me.


Daniel said:
I know what you mean, I've been using C++ as my primary language for just long enough to where the lisp is starting to fade. I force myself to jump back in every once and a while so I don't get lost in those parentheses : )

Reply to This

Reply to This

RSS

Badge

Loading…

© 2010   Created by Deelip Menezes.   Powered by .

Badges  |  Report an Issue  |  Terms of Service

Sign in to chat!