TheSwamp

Code Red => Visual DCL Programming => AutoLISP (Vanilla / Visual) => OpenDCL => Topic started by: xshrimp on November 16, 2008, 11:18:06 AM

Title: OpenDCL can do like ...
Post by: xshrimp on November 16, 2008, 11:18:06 AM
command: (setq x '("Line" "" "Circle" "Arc"))
("Line" "" "Circle" "Arc")

command: (setq y '(0 0 1 2))
(0 0 1 2)

command: (dos_popupmenu x y)
0

command: (dos_popupmenu x)
0
Title: Re: OpenDCL can do like ...
Post by: Spike Wilbury on November 16, 2008, 11:30:45 AM
Are you asking if it can be done with OpenDCL ?


(I guess yes - but wait for the helpful users of this application, for a better answer)

HTH.
Title: Re: OpenDCL can do like ...
Post by: jbuzbee on November 17, 2008, 09:13:31 AM
Yes.  But you can actually do that with simple VisualLISP.

Code: [Select]
;;; ;
;;; Create a POP0 menu ;
;;; ;
;;; Use: (kb:DynamicPop (some list) "kb40") ;
(defun kb:DynamicPop (ulist menugrp / acadobj menugrps menu menus shortcut)
  (setq acadobj  (vlax-get-acad-object)
        menugrps (vla-get-menugroups acadobj)
        menu     (vl-catch-all-apply 'vla-item (list menugrps menugrp))
        )
  (if (not (vl-catch-all-error-p menu))
    (progn (setq menus (vla-get-menus menu))
           (vlax-for
                  i menus
             (if (= (vla-get-shortcutmenu i) :vlax-true)
               (setq shortcut i)
               )
             )
           (if shortcut
             (progn (vlax-for ii shortcut (vla-delete ii))
                    (setq cnt 0)
                    (foreach
                           x ulist
                      (vlax-invoke shortcut 'addmenuitem cnt (car x) (cdr x))
                      (setq cnt (1+ cnt))
                      )
                    )
             )
           )
    )
  shortcut
  )

The arguments are a list (see the following) and a string of the Menu ID to use.  NOTE: I use a partial menu for the POP0* menuitem.  I havn't tried using the ACAD.POP0* as it might mess things up.  This is how you would build the list:

Code: [Select]
;;; Return a list of UCSs
;;; use(setq l(kb:ListUCSs))
(defun kb:ListUCSs  (/ ucslist)
  (setq ucslist(list
(cons "World" "ucs World ")
(cons "Bottom" "ucs orthoGraphic Bottom ")
(cons "Front" "ucs orthoGraphic Front ")
(cons "Back" "ucs orthoGraphic Back ")
(cons "Left" "ucs orthoGraphic Left ")
(cons "Right" "ucs orthoGraphic Right ")
(cons "45" "ucs _z 45 ")
(cons "Origin" "ucs _o ")
(cons "Object" "ucs _ob ")
))
  (vlax-for
         x  (vla-get-UserCoordinateSystems (vla-get-ActiveDocument (vlax-get-acad-object)))
   
      (setq ucslist (append ucslist (list (cons (vlax-get-property x 'name)(strcat"ucs restore "(vlax-get-property x 'name)" ")
)))))
  ucslist)



(defun c:kbUCSPop( / ret)
  (if(kb:DynamicPop (kb:ListUCSs) "kb00")
  (progn (menucmd "P0=kb00.POP0")
(menucmd "P0=*")
)))

Using OpenDCL see this:

http://www.theswamp.org/index.php?topic=25357.0 (http://www.theswamp.org/index.php?topic=25357.0)
Title: Re: OpenDCL can do like ...
Post by: xshrimp on November 17, 2008, 10:07:25 AM
 :-) Thank you very much !
Title: Re: OpenDCL can do like ...
Post by: KewlToyZ on November 17, 2008, 02:01:28 PM
Man thats kewl! :kewl: