Standard Layers Menu

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

  1. ctindall

    ctindall Guest

    When we implement our new layer standard, I would like to offer an option of a "Standard Layers" menu pulldown. This pulldown would have all of our standard layer broken down in to discipline, then system, then object (similar to the National Cad Standard layer naming convention).

    Does anyone have this menu created? If not, could you give me the code to create layer M-HVAC-SUPP-DUCT (color 160, linetype continuous, lineweight 0.015 inches) from a menu if the layer does not exist, or to set the layer current (with the stated color, linetype and lineweight) if it does exist?

    I can copy and create the rest of the layers in the menu on my own. Thanks in advance for any assistance.

    Chris
     
    ctindall, Nov 8, 2004
    #1
  2. (if (not (tblsearch "LAYER" "M-HVAC-SUPP-DUCT"))

    (command "LAYER" "M" "M-HVAC-SUPP-DUCT" "COLOR" "160" "M-HVAC-SUPP-DUCT"
    "LINETYPE" "CONTINUOUS" "LINEWEIGHT" "0.015" "")(setvar "clayer"
    "M-HVAC-SUPP-DUCT")

    )



    I think.....



    of a "Standard Layers" menu pulldown. This pulldown would have all of our
    standard layer broken down in to discipline, then system, then object
    (similar to the National Cad Standard layer naming convention).
    create layer M-HVAC-SUPP-DUCT (color 160, linetype continuous, lineweight
    0.015 inches) from a menu if the layer does not exist, or to set the layer
    current (with the stated color, linetype and lineweight) if it does exist?
    Thanks in advance for any assistance.
     
    Casey Roberts, Nov 8, 2004
    #2
  3. (if (not (tblsearch "LAYER" "M-HVAC-SUPP-DUCT"))
    (command "LAYER" "M" "M-HVAC-SUPP-DUCT" "COLOR" "160" "M-HVAC-SUPP-DUCT"
    "Ltype" "CONTINUOUS" "lw" "0.015" "")(setvar "clayer" "M-HVAC-SUPP-DUCT")
    )



    Thats better.
     
    Casey Roberts, Nov 8, 2004
    #3
  4. ctindall

    hulioman Guest

    ;;;FUNCTION
    (DEFUN MAKELAY (LNAME1 COL1 LT1)
    (entmake (list
    (cons 0 "LAYER")
    (CONS 100 "AcDbSymbolTableRecord")
    (CONS 100 "AcDbLayerTableRecord")
    (CONS 2 LNAME1) ;;LAYER NAME
    (CONS 70 0)
    (CONS 62 COL1)
    (CONS 6 LT1)
    (CONS 290 1)
    (CONS 370 -3)
    )
    )
    )


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ADD MUTIPLE LINES LIKE THIS TO CREATE MORE;;;;;;;;;;;;EXAMPLE;;;;;;;;;;;;;;;;;;;;;;
    (MAKELAY "M-HVAC-SUPP-DUCT" 160 "CONTINUOUS")
    (MAKELAY "SAMPLE 2" 5 "HIDDEN")
     
    hulioman, Nov 8, 2004
    #4
  5. ctindall

    ctindall Guest

    Where do I add the (MAKELAY "M-HVAC-SUPP-DUCT" 160 "CONTINUOUS") ? And what do the CONS lines do. Perhaps you coud direct me to a primer of this programming language. Thanks for all of the responses.
     
    ctindall, Nov 9, 2004
    #5
  6. ctindall

    Walt Engle Guest

    You can also have an ACAD.LSP to automatically make the layers you want, such as:

    (DEFUN S::STARTUP ()
    (COMMAND "STYLE" "STANDARD" "arial.ttf" "" "" "" "" "")
    (SETVAR "AUPREC" 2) ;angular units precision set to 2 places
    (SETVAR "BLIPMODE" 0) ;turns off blips
    (SETVAR "CMDECHO" 0) ;turns off lisp echoing
    (COMMAND "SETVAR" "COORDS" 0) ;turns off dynamics coordinate updating
    ;(COMMAND "SETVAR" "DIMCLRT" 0) ;dimension text color
    (SETVAR "DIMEXE" 0.09) ;extension line distance past dim line
    (COMMAND "SETVAR" "DISPSILH" 1) ;to hide during plotting
    (SETVAR "DIMTAD" 1) ;dim text above dim line-default is 0
    (SETVAR "DIMTIH" 1) ;dim text aligned
    (SETVAR "DIMTXSTY" "STANDARD") ;dim text style
    (SETVAR "DIMTXT" 0.125) ;dim text height
    (SETVAR "DIMCEN" 0.09) ;zero draws no centermark for
    ;center, dia & radius subcommands

    (SETVAR "DIMUNIT" 6) ;arch units format
    (SETVAR "DIMDEC" 5) ;dimension decimal places-5= 1/32th inch
    (SETVAR "DIMAUNIT" 0) ;no decimal places on angular dimension
    (SETVAR "LUNITS" 4) ;arch linear units
    (COMMAND "UNITS" 4 32 1 2 0 "N") ;arch, sixteenths, dec deg, 2 places

    ;(SETVAR "DIMUNIT" 2) ;decimal units format
    ;(SETVAR "DIMDEC" 2) ;dimension decimal places-two 1/4 inch
    ;(SETVAR "DIMAUNIT" 0) ;no decimal places on angular dimension
    ;(SETVAR "LUNITS" 2) ;decimal linear units
    ;(COMMAND "UNITS" 2 4 1 2 0 "n") ;decimal units

    (SETVAR "DIMUPT" 0) ;user placement of dim text-1allows dim placed outside for radius and diam
    (COMMAND "SETVAR" "DIMZIN" 7) ;supresses zero feet but not zero inches
    (COMMAND "SETVAR" "EDGEMODE" 1) ;cutting & boundary edge
    (SETVAR "FILEDIA" 1) ;dialog boxes enabled
    (COMMAND "SETVAR" "FONTALT" "ROMANS") ;alternate font
    (SETVAR "FACETRES" 10) ;smoothness of shaded and hidden lines
    (SETVAR "ISAVEPERCENT" 0) ;saves all of dwg instead of most recent part
    (SETVAR "MIRRTEXT" 0) ;mirroring text normally
    (COMMAND "SETVAR" "OSMODE" 32) ;intersection obj snap
    (COMMAND "SETVAR" "LTSCALE" (/ (GETVAR "DIMSCALE") 2))
    (COMMAND "SETVAR" "SAVETIME" 10) ;10 minutes automatic saving
    (SETVAR "SORTENTS" 23) ;object sort order
    (SETVAR "TEXTQLTY" 25) ;faster regen for texts
    (COMMAND "SETVAR" "TEXTSTYLE" "STANDARD") ;text style name
    (COMMAND "SETVAR" "TEXTSIZE" 0.125) ;text height
    (COMMAND "TIME" "OFF" "") ;"on" checks times, dates of when
    ;dwg worked on
    (SETVAR "UCSICON" 1) ;ucs icon on
    (COMMAND "VIEWRES" "" 1000) ;resolution for smoother circles

    (if (not (tblsearch "layer" "M-HVAC-SUPP-DUCT"))
    (command "layer" "M" "M-HVAC-SUPP-DUCT" "c" "160" "M-HVAC-SUPP-DUCT" "L" "continuous" "M-HVAC-SUPP-DUCT" ""))
    (command "SETVAR" "CLAYER" "0")
    )
    ;
    (VMON)
    (prompt "\nLoading Acad.lsp...Please wait.....")
    ;
    (WHILE E
    (IF (= L (CDR (ASSOC 0 (ENTGET E))))
    (ENTDEL E)
    )
    (SETQ E (ENTNEXT E))
    )
    )
    ;
    (defun dtr (a)
    (* pi (/ a 180.0))
    )
    ;
    (Defun Extang (A)
    (Setq A (Tblsearch "STYLE" A))
    (Setq J (Cdr (Assoc 50 A)))
    )
    ;
    (defun rtd (a)
    (/ (* a 180.0) pi)
    )
    ;
    (defun dmstdd (a)
    (setq d (fix a)
    m (/ (fix (* 100 (rem a 1))) 60.0)
    s (/ (* 100 (rem (* 100 (rem a 1)) 1)) 3600.0)
    a (+ d m s)
    )
    )
    ;
    (defun dmstr (a)
    (setq d (fix a)
    m (/ (fix (* 100 (rem a 1))) 60.0)
    s (/ (* 100 (rem (* 100 (rem a 1)) 1)) 3600.0)
    a (dtr (+ d m s))
    )
    )
    ;
    (defun c:rtdms (a)
    (setq a (* a (/ 180.0 pi))
    min (* (- a (fix a)) 60)
    sec (* (- min (fix min)) 60)
    deg (fix a)
    min (fix min)
    )
    )


    Where it says "CLAYER" "0", change the "0" to whatever layer you want to start with. You can add or delete whatever you want from this lsp routine. Anything listed with a semicolon in front will NOT be used.
     
    Walt Engle, Nov 9, 2004
    #6
  7. ctindall

    ECCAD Guest

    Try this one:
    ;; Make_Layer.lsp
    ;; In Menu, typical:
    ;; [Layer M-HVAC-SUPP-DUCT]^c^c(setq lay "M-HVAC-SUPP-DUCT" col "160" lt "CONTINUOUS" lw "0.015") make_layer;

    (defun C:make_layer ()
    ; Menu sends in layer info, this Lisp provides the Layer
    (if (not (tblsearch "LAYER" lay)); if not exist, Make / Set Layer
    (command "_layer" "_M" lay "_c" col lay "_lt" lt lay "_lw" (atof lw) lay "")
    (command "_layer" "_S" lay ""); if exist, just set us there
    ); end if
    (princ)
    ); end function
    (princ); silent load

    Cut/paste above in Notepad. Saveas "mlayer.lsp". Place mlayer.lsp in \support path.
    In Menu, for each Layer, add a line such as:
    [Layer M-HVAC-SUPP-DUCT]^c^c(setq lay "M-HVAC-SUPP-DUCT" col "160" lt "CONTINUOUS" lw "0.015") make_layer;
    In acaddoc.lsp (or other startup lisp), add the following.
    (load "mlayer.lsp")
    Restart Acad, compile your menu, and have fun.

    Bob
     
    ECCAD, Nov 9, 2004
    #7
  8. ctindall

    hulioman Guest

    you can add it to the end of your acad.lsp file.
    make sure you add the function first.
    Then, you can add the individual lines for each new layer.

    Note: you must have the linetypes loaded, or the layer entities will not be created.
     
    hulioman, Nov 9, 2004
    #8
  9. Try this one

    I'm supossing you now how to load a menu file.

    Saludos

    Marco Jacinto



    ***MENUGROUP=LAYSTD

    ***POP0

    **LAYERSTANDARDS

    ID_LAYERSTANDARDS [&LAYERSTANDARDS]

    ID_M-HVAC-SUPP-DUCT

    [&M-HVAC-SUPP-DUCT ]^C^C^P-layer;make;"M-HVAC-SUPP-DUCT";Color;160;;ltype;co

    ntinuous;;lweight;0.015;;;
     
    Marco Jacinto, Nov 9, 2004
    #9
  10. ctindall

    j.buzbee Guest

    Sorry for jumping in so late . . .

    Go to the Customer Files NG and download a little routine called
    jbImportLayers. It lets you import layers from a drawing. Set up a drawing
    with all your standard layers created using the Layer Manager. Set up Layer
    Filters to filter the layers based on your standard. Unzip all the files in
    the jbImportLayers.zip into it's own folder - I use "jbTools". Make sure
    AutoCAD's support search path includes that folder - Options dialog. Load
    jbImportLayer.lsp, jbImportLayerDCL.lsp and ObjectDCL.arx using appload then
    type "jbImportLayer" at the command line. Use the button in the top left
    corner of the dialog to navigate to the file with your standard layers.

    Sorry for the long explanation. This was not intended to be an end-user
    product - it was a programming example for ObjectDBX and ObjectDCL.

    jb
     
    j.buzbee, Nov 11, 2004
    #10
  11. ctindall

    Scot-65 Guest

    Chris,

    Late reply, but my two cents worth:

    Create a blank template (say [your_company_name].dwg).

    NO ENTITIES IN THIS FILE.
    Just Layer, Linetype, and Plot Style declarations ONLY.

    (Lineweights is the ctb file...)

    Insert this through S::STARTUP.
    Then Erase ENTLAST.
    (this will not redefine color or linetype properties of existing layers)

    Pop Menu will be of your design... If needed.

    While you are at it, is your symbol library
    located in the Screen Menu area for easy access?
    (you can set a layer as current here too... with just one click!)


    Scot-65
     
    Scot-65, Nov 11, 2004
    #11
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.