Printing the layer manager list

Discussion in 'AutoCAD' started by John Cutler, Apr 3, 2004.

  1. John Cutler

    John Cutler Guest

    Hi, all --

    I'm working in A2K Map.

    I want to print out the layers list in the Layer Properties Manager -- layer
    name, On, Freeze, Locked, Color, Linetype, Lineweight....

    Help files say to use -layer, ?, etc. and then cut & paste from the AutoCAD
    text window into a text-editor....

    Well, yeah, that works.... sort of.... (sample below)

    ==================================================
    Layer name State Color Linetype Lineweight
    ------------------ ----------- ------------- ------------ ------------

    "0" off -P 7 (white) "Continuous" Default

    "adjacent landowners text" off -P 7 (white) "Continuous" Default

    "BAR SCALES" off -P 7 (white) "Continuous" 0.050 mm.

    "building complex envelope" off -P 7 (white) "Continuous" 1.060 mm.

    "construction" off 150 "Continuous" Default

    ==================================================

    QUESTION: Is there some way to print it out "nice and readable" --
    formatted in columns, etc...? and send it straight to my Windows default
    printer (HP LaserJet)...?

    I seem to recall seeing a routine mentioned years ago on one of the news
    groups.....

    Thanks

    John

    )))))))
    (o)-(o)
    -----oo0---(_)---0oo--------------------------
    | | | | | | | | | | | | | | | | | |
    | | | | | | | | | | | | | | | | | |

    John Cutler -- Mapping/GIS Director,
    Ozark Regional Land Trust
    (Ozark Bioregion - MO/AR/KS/OK)
    2435 Sweetwater Lane
    Mansfield MO 65704
    (417) 741-7363
     
    John Cutler, Apr 3, 2004
    #1
  2. John Cutler

    John Cutler Guest

    Everybody --

    I found one (LayerHtm) by DotSoft, but it's more elaborate than I really
    need -- color, graphics and all....

    Anybody know of a simple black-and-white printout, text formatted in
    columns, .....?

    J
     
    John Cutler, Apr 3, 2004
    #2
  3. John Cutler

    Jeff Mishler Guest

    Hi John,
    Here's a lisp I modified from another lisp I wrote early last year. It will
    save a csv file, suitable for openeing with Excel, either as "Layers.csv" in
    the acad/support folder OR as "Name-of-drawing-Layers.csv" in the same
    folder as the drawing, depending on how it is called. There is no error
    checking, but as long as the function is called as shown it will work
    properly.

    Usage:
    (savelay "") - will save to the support folder
    (savelay "d") - will save to the drawing folder

    Enjoy,
    Jeff

    ;;watch for word wrap......

    (defun savelay (layfile / )
    (vl-load-com)
    (setq *acad* (vlax-get-acad-object))
    (setq *doc* (vla-get-activedocument *acad*))
    (cond ((= layfile "")
    (progn
    (setq paths (getenv "ACAD"))
    (setq paths (substr paths 1 (+ (strlen "Support") (vl-string-search
    "Support" paths))))
    (while (wcmatch paths "*;*")
    (setq paths (substr paths (+ 2 (vl-string-search ";" paths)) (strlen
    paths)))
    )
    (setq layfile (strcat paths "\\\Layers.csv"))
    )
    )
    ((= layfile "d")
    (setq paths (vla-get-fullname *doc*)
    paths (substr paths 1 (- (strlen paths) 4))
    layfile (strcat paths "-Layers.csv")
    )
    )
    )
    (if (setq *file (findfile layfile))
    (setq layfile (open *file "w"))
    (setq layfile (open layfile "w"))
    )
    (write-line "Layername,color#,linetype,plottable,frozen status, on\off,
    lineweight" layfile)
    (write-line "" layfile)
    (setq layers (vla-get-layers *doc*))
    (vlax-for x layers
    (setq layline (vla-get-name x))
    (if (not (wcmatch layline "*|*")) ;; Omit Xref layers
    (progn
    (setq layline (strcat layline "," (itoa (vla-get-color x)) ","
    (vla-get-linetype x) ","
    (if (= (vla-get-plottable x) :vlax-true) "Y" "N") ","
    (if (= (vla-get-freeze x) :vlax-false) "T" "F") ","
    (if (= (vla-get-layeron x) :vlax-true) "On" "Off") ","
    (if (= -3 (setq lwt (vla-get-lineweight x))) "Default" (itoa lwt)))
    )
    (write-line layline layfile)
    )
    )
    )
    (close layfile)
    (princ)
    )
     
    Jeff Mishler, Apr 3, 2004
    #3
  4. To avoid "word wrap" you should include the lisp file as an attachment
    instead of pasting it in the message.
     
    Gary Lafreniere, Apr 4, 2004
    #4
  5. John Cutler

    John Cutler Guest

    Jeff -

    That will do the job. Thanks.

    I cleaned up what looked like "linewrap" in the email code -- I must have
    done it right -- it runs!

    I'll write some code to suck the .csv into a SmartWare database, where I can
    sort it, format it (like changing the lineweight of "106" to "1.06"), create
    page headings (project name, name of the layer manager's "save & restore
    layer settings"), and so on, before printing...

    In other news, my efforts to learn VLISP keep getting sidetracked by work!
    But I will persist!!

    J
     
    John Cutler, Apr 7, 2004
    #5
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.