Turn on text?

Discussion in 'AutoCAD' started by mikedsjr, Jun 18, 2004.

  1. mikedsjr

    mikedsjr Guest

    Is there a quick and easy way to turn on layers that have a specific text style?
     
    mikedsjr, Jun 18, 2004
    #1
  2. Do you mean layers that have existing text entities, using a specific text
    style, on them?

    Kent Cooper, AIA


    style?
     
    Kent Cooper, AIA, Jun 18, 2004
    #2
  3. Yes, if you know how to program!!!!

    This is not the most elegant and does not use VLA functions, but it does
    work -

    (setq StyleName "STANDARD")
    (if (setq SS (ssget "X" (list (cons 0 "TEXT"))))
    (progn
    (setq LayerList nil)
    (setq KK 0 KS (sslength SS))
    (while (< KK KS)
    (setq LN (cdr (assoc 8 (setq EG (entget (ssname SS KK))))))
    (if (and (= (strcase (cdr (assoc 7 EG))) StyleName) (not (member LN
    LayerList)))
    (setq LayerList (append LayerList (list LN)))
    )
    (setq KK (1+ KK))
    )
    (if LayerList
    (progn
    (command "LAYER")
    (foreach LN LayerList (command "ON" LN))
    (command "")
    )
    )
    )
    )
     
    Alan Henderson @ A'cad Solutions, Jun 18, 2004
    #3
  4. mikedsjr

    ECCAD Guest

    I see Alan beat me to the punch. :(
    But here is another way, with prompt for style.


    ;;
    ;; Define DXF function
    ;;
    (defun dxf (code elist)
    (cdr (assoc code elist))
    ); end function dxf
    ;;
    ;;
    ;; Define function tdlist
    ;;
    (defun tdlist (tbname / tdata tblist)
    (while (setq tdata (tblnext tbname (not tdata)))
    (setq tblist (append tblist (list tdata)))
    ); end while
    ); end function tdlist
    ;;
    ;; make layers list
    ;;
    (foreach tbdata (tdlist "layer")
    (setq lname (substr (dxf 2 tbdata) 1 50))
    ;;
    (if (/= lname nil)
    (progn
    (setq P (strcat "\nFound " lname " Layer"))
    (prompt P)
    ); end progn
    ); end if
    ); end foreach
    ;;
    (defun C:TL ()
    (setq st (getstring "\nStyle name:"))
    (foreach lay (tdlist "layer")
    (setq lname (substr (dxf 2 lay) 1 50))
    (setq ss nil)
    (setq ss (ssget "x" (list (cons 8 lname)(cons 7 st)(cons 0 "TEXT"))))
    (if ss
    (command "_layer" "_T" lname "_on" lname "")
    ); if
    (prompt (strcat "\nChecking Layer " lname))
    (princ)
    ); foreach
    ); defun
    (princ)


    Bob Shaw
    www.bobscadshop.com
     
    ECCAD, Jun 18, 2004
    #4
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.