Author Topic: list layer in popup list  (Read 1556 times)

0 Members and 1 Guest are viewing this topic.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
list layer in popup list
« on: March 21, 2016, 09:34:31 PM »
Hi I'm trying to have a list of layers in a drawing in my popup_list but can not find the solution  :thinking:

attached a piece of code

  : Popup_list {width = 40; key = "listlayer"; }

  (Action_tile "listlayer" "(setq * screenpointE2 * (done_dialog 9))")
  (If (= ddiag 9) (AX: list))

(Defun AX: list (/ a b)
   (If (setq a (tblnext "layer" t))
     (While at
       (Setq b (cons (cdr (assoc 2)) b)
to (tblnext "layer"))))
   (Reverse b))
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18

Lee Mac

  • Seagull
  • Posts: 12928
  • London, England
Re: list layer in popup list
« Reply #2 on: March 22, 2016, 06:37:33 AM »
A couple of existing solutions:

List Box
List Box with Filter

Example:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test1 ( )
  2.     (LM:listbox "Select a Layer" (layers) 1)
  3. )
  4. (defun c:test2 ( )
  5.     (LM:filtlistbox "Select a Layer" (layers) t)
  6. )
  7. (defun layers ( / x l )
  8.     (while (setq x (tblnext "layer" (not x)))
  9.         (setq l (cons (cdr (assoc 2 x)) l))
  10.     )
  11. )
« Last Edit: March 22, 2016, 06:40:36 AM by Lee Mac »