See the top rated post in this thread. Click here

Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 40

Thread: LISP routine to overwrite layer descriptions...

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

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by dortega4269 View Post
    Code:
    (defun c:dwt ()
    
    ; Layers
    (command "layer" "m" "purlin" "lt" "continuous" "" "c" "7" "" "")
    (command "layer" "m" "wp" "lt" "center" "" "c" "8" "" "") 
    (command "layer" "m" "bolt" "lt" "continuous" "" "c" "6" "" "")
    (command "layer" "m" "bracing" "lt" "continuous" "" "c" "3" "" "")
    (command "layer" "m" "endwall" "lt" "continuous" "" "c" "1" "" "")
    (command "layer" "m" "mezzanine" "lt" "continuous" "" "c" "2" "" "")
    (command "layer" "m" "steel" "lt" "continuous" "" "c" "5" "" "")
    (command "-linetype" "load" "hidden" "" "yes" "" "")
    
    
    )
    I also found this link which has tons of options...
    http://forums.autodesk.com/t5/Visual...p/td-p/3560508
    FWIW -

    Multiple COMMAND calls at startup is about the worst thing you can do for performance at drawing open (aside from an endless loop). You should be accessing the LayerTable Object instead.
    "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

  2. #12
    Active Member
    Join Date
    2006-08
    Location
    Southern California
    Posts
    52
    Login to Give a bone
    0

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by BlackBox View Post
    FWIW -

    Multiple COMMAND calls at startup is about the worst thing you can do for performance at drawing open (aside from an endless loop). You should be accessing the LayerTable Object instead.
    Since I'm not too savvy with LISP I can't complain too much, it works.
    Last edited by dortega4269; 2014-07-21 at 07:54 PM.

  3. #13
    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 overwrite layer descriptions...

    Quote Originally Posted by BlackBox View Post
    *Someone* didn't read the fine, red print in the OP.

    Well I stand behind my original suggestion then...

  4. #14
    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 overwrite layer descriptions...

    Quote Originally Posted by BlackBox View Post
    See post #7 of this thread for a routine that does exactly this.
    Hey BB, that's pretty sweet.
    I have written old-school routines for creating layers, which have the "dreaded" command calls.
    I would like to try out your routine.

    I can't open/download the txt(csv) file for the reference layers in your link (becuase I'm not a CadTutor member), any way you can post it here or send it to me?

    Thanks dude!

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

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by dortega4269 View Post
    Since I'm not too savvy with LISP I can't complain too much, it works.
    We all start somewhere; perhaps one day (soon?), you'll come to see the significant difference for yourself.

    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

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

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by tedg View Post
    Hey BB, that's pretty sweet.
    I have written old-school routines for creating layers, which have the "dreaded" command calls.
    I would like to try out your routine.

    I can't open/download the txt(csv) file for the reference layers in your link (becuase I'm not a CadTutor member), any way you can post it here or send it to me?
    Cheers, tedg; to demonstrate, here's a quick speed test creating 256 layers each, with undo marks of Command calls vs. LayerTable Object....



    Sample functions:

    Code:
    ;;; See "foo.lsp" attached, code is too long for this post


    Sample .CSV file:

    Code:
    ;;; See "foo.csv.txt" attached, code is too long for this post, and rename as "foo.csv"


    Speed test:

    Code:
    (bench '(_Command1) '() 1)
    
    (command "._undo" 1)                                                    ; undo the command calls; no cheating ;o)
    
    (bench '(_CSV->Layers) '() 1)


    Results from console...
    Tested on a Dell Precision T3600, Win8.1 Pro 64-bit OS, Hex-Core Intel Xeon 3.2 Ghz, 32 GB RAM, 3 GB NVIDIA Quadro K4000 using IDSP 2015

    Code:
    _COMMAND1
    Elapsed: 1812
    Average: 1812.0000
    
    _CSV->LAYERS
    Elapsed: 172
    Average: 172.0000
    ... That's +/- 1.8 seconds for Command calls, and 0.17 seconds for LayerTable... And here's the important bit... Each-and-every-single-time you open a drawing when being loaded via AcadDoc.[lsp[fas[vlx]]].



    The latter can also be modified to support ObjectDBX batch processing, and paired with Reactors, etc.

    Cheers
    Attached Files Attached Files
    "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

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

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by BlackBox View Post
    ... That's +/- 1.8 seconds for Command calls, and 0.17 seconds for LayerTable... And here's the important bit... Each-and-every-single-time you open a drawing when being loaded via AcadDoc.[lsp[fas[vlx]]].
    Put another way, if one only opens 5 drawings each day via the Command call method (@1.8 Sec*5==9 Sec/Day), that equates to 37.5 Hours per year, per person (estimating 50, 5 Day work weeks).

    Now compare that against the latter in the same scenario, (@0.17 Sec*5==0.85 Sec/Day), that equates to only 3.54 Hours per year, per person.



    Also worthy of note, is that these processing times are significantly reduced when you step up into the .NET API:


    ADN DevBlog - The Right Tools for the Job – AutoCAD Part 3

    by Fenton Webb

    ...



    ... So the real question is, how many users do you have?

    Cheers
    Last edited by BlackBox; 2014-07-22 at 02:32 PM.
    "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. #18
    Active Member
    Join Date
    2006-08
    Location
    Southern California
    Posts
    52
    Login to Give a bone
    0

    Talking Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by BlackBox View Post
    See post #7 of this thread for a routine that does exactly this.
    Thank you BB. I used your routine with the variations fixo and waders made and it works

    Thank you tedg also for your time and effort, you idea is being thought out further to find the ideal scenario of implementing it during startup.

    If I wanted to take this a step further and only insert/overwrite specific category of layers instead of all layers (example: Casework only), what could I do to create a prompt to apply a selected category of layers? My simple thinking is to break the routine and csv file up into several routines and csv files.

    Previously I used the following routine to insert my layer templates (.dwg), however, they wouldn't overwrite any existing layers, hence the start of this thread...
    Code:
    (defun c:LayerCat (/ ip ans sel1)
    
      (setq ip (list 0 0 0))
    
      (initget "C F EQ")
      (setq ans (getkword "\nSelect Layer Category to Insert [Casework/Furniture/Equipment]: "))
    ib
      (cond	((= (strcase ans nil) "C")
    	 (progn
    	   (command "insert" "Casework" ip nil nil nil)
    	   (setq
    	     sel1 (ssget "x" '((0 . "insert") (2 . "Casework")))
    	  )
    	 )
    	)
    	((= (strcase ans nil) "F")
    	 (progn
    	   (command "insert" "Furniture" ip nil nil nil)
    	   (setq
    	     sel1 (ssget "x" '((0 . "insert") (2 . "Furniture")))
    	  )
    	 )
    	)
    	((= (strcase ans nil) "EQ")
    	 (progn
    	   (command "insert" "Equipment" ip nil nil nil)
    	   (setq
    	     sel1 (ssget "x" '((0 . "insert") (2 . "Equipment")))
    	  )
    	 )
    	)
      )
      (princ)
    )

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

    Default Re: LISP routine to overwrite layer descriptions...

    Quote Originally Posted by dortega4269 View Post
    If I wanted to take this a step further and only insert/overwrite specific category of layers instead of all layers (example: Casework only), what could I do to create a prompt to apply a selected category of layers? My simple thinking is to break the routine and csv file up into several routines and csv files.
    Adding/Correcting layers at drawing open is very different from implementing a user Command that prompts for import.

    Correct; you only need the one sub-function, but you'd need to split your .CSV data accordingly, otherwise you'd need to modify the sub-function so that it can evaluate a WCMATCH, etc. comparison to only Add the desired layers.

    Decide which is best for your needs, and let us know where you get hung up.

    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. #20
    Active Member
    Join Date
    2006-08
    Location
    Southern California
    Posts
    52
    Login to Give a bone
    0

    Default Re: LISP routine to overwrite layer descriptions...

    Again, Thanks BB. I'll explore your recommendations further and see which is more feasible.

Page 2 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Special Layer Freeze LISP Routine
    By dbanker in forum AutoLISP
    Replies: 10
    Last Post: 2017-08-11, 12:32 PM
  2. Layer Color Change LISP Routine
    By guardianfiredesign774457 in forum AutoLISP
    Replies: 19
    Last Post: 2013-08-28, 05:08 AM
  3. Add layer command line to a lisp routine
    By BrianTFC in forum AutoLISP
    Replies: 1
    Last Post: 2012-02-02, 07:47 AM
  4. Layer creation lisp routine?
    By boeris9333 in forum AutoLISP
    Replies: 10
    Last Post: 2009-10-05, 11:24 AM
  5. Lisp routine help, Layer check problem
    By Craig.Baldie in forum AutoLISP
    Replies: 6
    Last Post: 2007-10-12, 06:27 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
  •