Selection set of layers

Discussion in 'AutoCAD' started by starote, Nov 8, 2004.

  1. starote

    starote Guest

    Is it possible to create a selection set containing only the layers of the drawing? Is a layer a type of object in autocad as polyline for exemple? Thanks
     
    starote, Nov 8, 2004
    #1
  2. starote

    Jimmy D Guest

    Hi,

    Have a look at www.jtbworld.com where you can find layer-list.lsp.
    I think this is exactly what you need!

    jimmy
     
    Jimmy D, Nov 8, 2004
    #2
  3. starote

    CAB2k Guest

    This should do it:

    ;; ! ****************************************************************************
    ;; ! LA_GetAllLayers
    ;; ! ****************************************************************************
    ;; ! Function : Find out the names of the 'normal' layers in the drawing
    ;; ! Normal layers are those which belong to the current drawing.
    ;; ! Argument : none
    ;; ! Returns : A list of all current 'normal' layers
    ;; ! Updated : April 17, 1998
    ;; ! e-mail :
    ;; ! Web : www.4d-technologies.com
    ;; ! ****************************************************************************

    (defun LA_GetAllLayers( / LyrLst Lst tmp _tmp )
    (setq
    LyrLst '()
    Lst (MI_tbldata "LAYER")
    )
    (if Lst
    (progn
    (setq Lst (cadr Lst))
    (foreach tmp Lst
    (setq _tmp (LI_item 70 tmp))
    (if (and (zerop (logand _tmp 16)) (zerop (logand _tmp 32))) ; Normal block and block with attribute
    (setq LyrLst (cons (LI_item 2 tmp) LyrLst))
    )
    )
    ))
    (if LyrLst (acad_strlsort LyrLst) nil)
    )
    ;; ! ****************************************************************************
    ;; ! MI_TblData
    ;; ! ****************************************************************************
    ;; ! Function : Returns the number of entries and the entries themselves in the
    ;; ! specified symbol table
    ;; ! Argument : 'tblname' - Table Name (can be BLOCK, LAYER, VIEW, LTYPE, APPID)
    ;; ! Returns : a list containing two elements, the first is a count of the
    ;; ! number of entries and the second is a list containing the actual
    ;; ! entries themselves.
    ;; ! Updated : February 9, 1999
    ;; ! e-mail :
    ;; ! Web : www.4d-technologies.com
    ;; ! ****************************************************************************

    (defun MI_TblData(tblname / tdata cnt TDLst)
    (setq
    tdata nil
    cnt 0
    TDLst '()
    )
    (while (setq tdata (tblnext tblname (not tdata)))
    (setq
    cnt (1+ cnt)
    TDLst (append TDlst (list tdata))
    )
    )
    (list cnt TDLst)
    )
     
    CAB2k, Nov 8, 2004
    #3
  4. starote

    GaryDF Guest

    no function definition: LI_ITEM

    Gary
     
    GaryDF, Nov 8, 2004
    #4
  5. starote

    CAB2k Guest

    Sorry about that:

    ;; ! ***************************************************************************
    ;; ! LI_item
    ;; ! ***************************************************************************
    ;; ! Function : Returns the first occurence of a DXF dotted pair from a list
    ;; ! Argument : 'n' - The DXF code to check
    ;; ! 'alist' - The List to check
    ;; ! Returns : The value of the DXF dotted pair, if it exists else returns nil
    ;; ! Update : December 26, 1998
    ;; ! e-mail :
    ;; ! Web : www.4d-technologies.com
    ;; ! ****************************************************************************

    (defun LI_item (n alist)
    (cdr (assoc n alist))
    )
     
    CAB2k, Nov 8, 2004
    #5
  6. starote

    Don Butler Guest

    ;;Michael Puckett
    (defun tnlist (s / d r)
    (while (setq d (tblnext s (null d)))
    (setq r (cons (cdr (assoc 2 d)) r))
    )
    (reverse r)
    )

    Can't really beat this one for brevity. Also works on the other tables.

    (tnlist "LAYER")
    (tnlist "LTYPE")

    Don
     
    Don Butler, Nov 8, 2004
    #6
  7. starote

    Don Butler Guest

    Just another note:

    You're using the wrong term. This is not a selection set. This is a listing
    from a DXF table.

    The function I sent stands for...

    TableNameList ->TNLIST

    Don
     
    Don Butler, Nov 8, 2004
    #7
  8. starote

    hulioman Guest

    PASTE THE FOLLOWING INTO AUTOCAD


    (SETQ SS (SSGET (LIST (CONS 8 (GETSTRING T "TYPE IN THE LAYER YOU WOULD LIKE TO SELECT ")))))
     
    hulioman, Nov 9, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.