See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: LISP routine to load layers

  1. #1
    100 Club
    Join Date
    2016-01
    Location
    South Jersey
    Posts
    101
    Login to Give a bone
    0

    Default LISP routine to load layers

    Is it better to load layers Via a lisp routine or can I use a block insert to do the same thing? And what would the lisp look like?

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    It would be more manageable to insert a drawing with the necessary layers. You could also open said drawing through Design Center and insert only the layers you need.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    1

    Default Re: LISP routine to load layers

    Quote Originally Posted by rbhazie View Post
    Is it better to load layers Via a lisp routine or can I use a block insert to do the same thing? And what would the lisp look like?
    Opie is correct, it's a little easier to control when you insert an up to date drawing file with the layers you want, or drag them from design center, or insert a block with the desired layers.

    I used to use a lisp routine to load layers all the time, but not so much anymore.
    Instead I have a template set up with the layers I use all the time.

    But a lisp routine I wrote to make layers (which also includes line weights) looked like this:
    (this is a watered down version to show as an example only, the original was much bigger)
    Code:
    ;;;;;MAKE STANDARD LAYERS BASED ON NCS 3.1 LAYER NAMES WITH OBJECT LINE WEIGHTS
    (DEFUN C:NCSLYRS (/ CME LYR RGM)     
    	(SETQ CME (GETVAR "CMDECHO"))   
    	(SETQ LYR (GETVAR "CLAYER"))
    	(SETQ RGM (GETVAR "REGENMODE"))   
    	(SETVAR "CMDECHO" 0)
    	(SETVAR "REGENMODE" 0)   
    ;;;;***************************************************************************************
    ;;;;ARCHITECTURAL LAYERS     
    	(COMMAND "LAYER" "MAKE" "A-ANNO-DIMS" "COLOR" "1" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-FUTR" "COLOR" "202" "" "LW" "0.35" "" "")
            (COMMAND "LAYER" "MAKE" "A-ANNO-STRS-E" "COLOR" "20" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-STRS" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-SYMB" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-TEXT" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-TEXT-D" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-TITL" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-MTCH" "COLOR" "5" "" "LW" "0.5" "" "")
    	(COMMAND "LAYER" "MAKE" "A-AREA" "COLOR" "5" "" "LW" "0.5" "" "")
    	(COMMAND "LAYER" "MAKE" "A-AREA-PATT" "COLOR" "10" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-AREA-IDEN" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-CLNG-D" "COLOR" "122" "" "LW" "0.35" "" "LT" "HIDDEN2" "" "")
    	(COMMAND "LAYER" "MAKE" "A-CLNG-EQPM-E" "COLOR" "50" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-CLNG-EQPM" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-CLNG-GRID-E" "COLOR" "10" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-CLNG-GRID" "COLOR" "11" "" "LW" "0.25" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-COLS-E" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-ANNO-COLS" "COLOR" "5" "" "LW" "0.5" "" "")
    	(COMMAND "LAYER" "MAKE" "A-COLS-E" "COLOR" "1" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-COLS" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "A-GRID-E" "COLOR" "250" "" "LW" "0.25" "" "LT" "CENTER2" "" "")
    	(COMMAND "LAYER" "MAKE" "A-GRID" "COLOR" "10" "" "LW" "0.18" "" "LT" "CENTER2" "" "")
    	(COMMAND "LAYER" "MAKE" "A-PLAN-D" "COLOR" "3" "" "LW" "0.35" "" "LT" "HIDDEN2" "" "")   
            (COMMAND "LAYER" "MAKE" "A-DOOR-E" "COLOR" "10" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "A-DOOR-IDEN" "COLOR" "3" "" "LW" "0.35" "" "")   
    	(COMMAND "LAYER" "MAKE" "A-DOOR" "COLOR" "192" "" "LW" "0.35" "" "")
    ;;;;***************************************************************************************
    ;;;;GENERAL LAYERS  
       	(COMMAND "LAYER" "MAKE" "G-ANNO-TEXT" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "G-ANNO-TITL" "COLOR" "14" "" "LW" "0.7" "" "") 
    	(COMMAND "LAYER" "MAKE" "G-ANNO-REFR" "COLOR" "7" "" "LW" "1.4" "" "")
    	(COMMAND "LAYER" "MAKE" "G-ANNO-SYMB" "COLOR" "3" "" "LW" "0.35" "" "")       
    	(COMMAND "LAYER" "MAKE" "G-ANNO-MISC" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "G-ANNO-ELEV" "COLOR" "4""" "LT" "PHANTOM" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "G-ANNO-NPLT" "COLOR" "140" "PLOT" "N" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "G-AREA" "COLOR" "2" "" "LW" "0.25" "" "")   
    	(COMMAND "LAYER" "MAKE" "G-SITE-PLAN" "COLOR" "4" "" "LW" "0.35" "" "")   
    	(COMMAND "LAYER" "MAKE" "G-SITE-VCTY" "COLOR" "3" "" "LW" "0.35" "" "")  
            (COMMAND "LAYER" "MAKE" "G-DETL-HDLN" "COLOR" "10""" "LT" "HIDDEN" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "G-DETL-PHTM" "COLOR" "5""" "LT" "PHANTOM" "" "LW" "0.50" "" "") 
            (COMMAND "LAYER" "MAKE" "G-DETL-PATT" "COLOR" "10" "" "LW" "0.18" "" "")   
            (COMMAND "LAYER" "MAKE" "G-DETL-CNTR" "COLOR" "10""" "LT" "CENTER" "" "LW" "0.18" "" "")
    ;;;;***************************************************************************************
    ;;;;MECHANICAL LAYERS   
            (COMMAND "LAYER" "MAKE" "M-EQIP-E" "COLOR" "10" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "M-DUCT" "COLOR" "7" "" "LW" "1.4" "" "")   
            (COMMAND "LAYER" "MAKE" "M-PLMB-E" "COLOR" "10" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "M-PLMB" "COLOR" "3" "" "LW" "0.35" "" "")   
    	(COMMAND "LAYER" "MAKE" "M-PLMB-FLOR-DRAN" "COLOR" "3" "" "LW" "0.35" "" "")
    ;;;;***************************************************************************************
    ;;;;STRUCTURAL LAYERS
    	(COMMAND "LAYER" "MAKE" "S-ANNO-DIMS" "COLOR" "1" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-SYMB" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-IDEN" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-KEYN" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-LABL" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-LEGN" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-NOTE" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-NPLT" "COLOR" "112" "" "PLOT" "N" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-MARK" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-MATC" "COLOR" "14" "" "LW" "0.70" "" "LT" "PHANTOM2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-TEXT" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-COLS-E" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-COLS" "COLOR" "5" "" "LW" "0.5" "" "")
    	(COMMAND "LAYER" "MAKE" "S-ANNO-WKPT" "COLOR" "6" "" "LW" "1.0" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS-E" "COLOR" "20" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS-ALUM" "COLOR" "12" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS-CONC" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS-WOOD" "COLOR" "22" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-COLS-STEL" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-STEL-BPLT" "COLOR" "3" "" "LW" "0.35" "" "")  
            (COMMAND "LAYER" "MAKE" "S-WALL-CMUW" "COLOR" "33" "" "LW" "0.5" "" "")
            (COMMAND "LAYER" "MAKE" "S-WALL-MSNW" "COLOR" "53" "" "LW" "0.5" "" "")    
    	(COMMAND "LAYER" "MAKE" "S-GRID-E" "COLOR" "251" "" "LW" "0.35" "" "LT" "CENTER2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-GRID" "COLOR" "10" "" "LW" "0.18" "" "LT" "CENTER2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-CONC-E" "COLOR" "10" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "S-CONC" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-E" "COLOR" "150" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN" "COLOR" "5" "" "LW" "0.5" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-DOOR-OPNG" "COLOR" "1" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-HEAD-ABOV" "COLOR" "30" "" "LW" "0.18" "" "LT" "HIDDEN2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FLOR-STRS" "COLOR" "30" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-FTNG-E" "COLOR" "30" "" "LW" "0.18" "" "LT" "HIDDEN2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-FTNG" "COLOR" "3" "" "LW" "0.35" "" "LT" "HIDDEN2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-FNDN-PIER" "COLOR" "5" "" "LW" "0.5" "" "")  
    	(COMMAND "LAYER" "MAKE" "S-FNDN-REBR" "COLOR" "14" "" "LW" "0.7" "" "")   
            (COMMAND "LAYER" "MAKE" "S-BEAM-STEL-E" "COLOR" "10" "" "LW" "0.18" "" "")   
    	(COMMAND "LAYER" "MAKE" "S-BEAM-STEL" "COLOR" "5" "" "LW" "0.18" "" "")
    	(COMMAND "LAYER" "MAKE" "S-TRUS" "COLOR" "4" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-JOIS" "COLOR" "3" "" "LW" "0.35" "" "")
    	(COMMAND "LAYER" "MAKE" "S-JOIS-BRGX" "COLOR" "2" "" "LW" "0.25" "" "LT" "HIDDEN2" "" "")
    	(COMMAND "LAYER" "MAKE" "S-SLAB-CJNT" "COLOR" "2" "" "LW" "0.25" "" "LT" "DASHDOT" "" "")       
    ;;;;****************************************************************************************
    		(SETVAR "CMDECHO" CME)   
    		(SETVAR "CLAYER" LYR)
    		(SETVAR "REGENMODE" RGM)   
    	(PRINC))     
    (PRINC "\nCOMMAND: NCSLYRS")

  4. #4
    I could stop if I wanted to
    Join Date
    2015-10
    Location
    Colorado Springs, CO
    Posts
    369
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    I prefer the lisp method, as it will update any layers that have gotten tweaked by a user and not returned to their "correct" state. Though if your company allows for such tweaking, then the lisp could have enough unintended consequences to make it a bad idea.

  5. #5
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    "Better" is quite subjective; I use LISP and data files. Easier to manage with multiple drawing types, client standards, and applications.

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    I've created a handful of Layer States and Exported them to My Documents which is the default folder so I don't need to look for them later. Importing one of those Layer States gives me that group of layers set just how I want them overriding the existing settings if any layers were already there.

    Like tedg I've found having good templates is the key to keeping AutoCAD simple. For the most part the only time I use the method above is when I need to import a group of layers from ArcGIS.

    I use the Layer Manager all the time though. When I Import Survey Data into Civil 3D the Layer State is set to display all Breaklines (as continuous) and Surface Points so I can check for issues. Once it looks OK I set the Layer State to Plan which displays only what should be on the final drawing with their proper linetypes. One of the more underused features in AutoCAD I think.

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    Just be mindful, that inserting a drawing with specific Layers will inherit the the properties of those Layers which already exist in a given drawing, and will not overwrite, or 'correct' said Layer's properties... Only new Layers are actually inserted as-is from the source drawing.

    This, one of the many reasons that the STANDARDS Command exists, despite it too not accounting for all potentialities.

    You might hard-code a specific Layer's properties into a Command Reactor, depending on how critical it is that it be consistent throughout myriad drawings... Use an approach that best meets your (or your employer's) requirements.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  8. #8
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    Quote Originally Posted by BlackBox View Post
    Just be mindful, that inserting a drawing with specific Layers will inherit the the properties of those Layers which already exist in a given drawing, and will not overwrite, or 'correct' said Layer's properties... Only new Layers are actually inserted as-is from the source drawing.

    This, one of the many reasons that the STANDARDS Command exists, despite it too not accounting for all potentialities.

    You might hard-code a specific Layer's properties into a Command Reactor, depending on how critical it is that it be consistent throughout myriad drawings... Use an approach that best meets your (or your employer's) requirements.

    Cheers
    That's why I recommend Importing Layer States rather than inserting a drawing. I also have a lisp that I use as well that only modifies the existing layers when I don't want layers added I don't need. The drawings I use ArcGIS data for are for many different purposes, the layers imported are different for each one.

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    Sorry, Tom - I wasn't responding directly to your post, just more of an FYI to something I read earlier in the thread.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,507
    Login to Give a bone
    0

    Default Re: LISP routine to load layers

    Quote Originally Posted by BlackBox View Post
    Just be mindful, that inserting a drawing with specific Layers will inherit the the properties of those Layers which already exist in a given drawing, and will not overwrite, or 'correct' said Layer's properties... Only new Layers are actually inserted as-is from the source drawing.
    ....
    Cheers
    This is another good use of a lisp routine,
    If a layer exists in the drawing but has been altered to non-standard properties, the routine will re-make it to it's correct standards as long as it's written that way.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 11
    Last Post: 2016-08-23, 02:50 PM
  2. Lisp Routine to Thaw layers when plotting
    By rscampoli in forum AutoLISP
    Replies: 13
    Last Post: 2010-11-24, 02:47 PM
  3. Replies: 10
    Last Post: 2006-10-25, 09:33 PM
  4. Replies: 4
    Last Post: 2006-07-14, 08:34 PM
  5. Lisp routine for layers
    By steven_mott33 in forum AutoLISP
    Replies: 3
    Last Post: 2004-10-01, 11:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •