Results 1 to 8 of 8

Thread: changing layer properties with lisp (line type)

  1. #1
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default changing layer properties with lisp (line type)

    been working with a client on changing their drawing standards and how they do things

    the client now wants to change a layers line type from continuous to hidden on a series of layers inside their drawing templates

    the easy part is that all the layers are prefixed with CORE_*****

    being a person who has a lisp deficiency (rubbish at programming) I can see a work flow but don't have the skills to implement

    I have Autocad electrical 2013/4/5 which has a function to batch run through a series of drawings and run a lisp programme each time it opens a drawing

    so a simple lisp routine will work

    this is how I see it working

    1) Open layer properties manager
    2) Start at the top work you way down till you find a layer starting with "CORE_"
    3) Change current line type to "Hidden"
    4) Move down to next layer beginning with "CORE_"
    5) Repeat Change
    6) Close Layer properties manager when reaching the bottom


    Autocad electrical will automatically save the drawing and move onto the next drawing in the project list


    the client has over 2000 template drawings to change and if they decide to change the historical drawings its at least 500,000 plus drawings

    any help would be appreciated

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

    Default Re: changing layer properties with lisp (line type)

    Often the same drawing can have different layer standards at different stages of a project. For Civil boundaries and existing conditions are the first stage. Design would be the second where design must stand out over existing. As-Built would be the last where As-Built must stand out over design.

    Since you have "a lisp deficiency" a better approach might be using Layer States or Layer Standards. I have several Layer States in my standard templates for different purposes.

    It can also be done with lisp, just wanted to let you know this is something you can do.

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

    Default Re: changing layer properties with lisp (line type)

    For mass changes, you will likely end up using ObjectDBX. This allows for another drawing to be opened and layer properties manipulated without opening the drawing in the editor; very fast, and allows continuous automation from a LISP function unlike opening drawings in the editor in sequence which requires some form of scripting.

  4. #4
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: changing layer properties with lisp (line type)

    yes the layer translator will do this for a single drawing but trolling the forums its clear that you cannot control this feature with a script file im faced with a very long task which is going to burn lots of time if i cant automate this function

  5. #5
    Member
    Join Date
    2013-08
    Posts
    23
    Login to Give a bone
    0

    Default Re: changing layer properties with lisp (line type)

    Try this:




    Code:
    (defun c:foo (/ *error* old_expert linetype lay1)
    
      (vl-load-com)
    
      (defun vercheck ()
    
    	;;checks version, sets version and model space accordingly
    
      (if ((lambda (vrsn)
            (cond
             ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
             ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
             ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
             ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 
    	 ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 
    	 ((vl-string-search "R19.1" vrsn) (setq appstr "10.3")) ;14
            ((alert "This version of C3D not supported!"))
            )
           )
           (vlax-product-key)
          )                         ; end if condition progn is true
          (progn
            (cond (C3Ddoc)
              ((setq C3Ddoc
                (vlax-get
                  (cond (C3D)
                    ((setq C3D
                      (vla-getinterfaceobject
                         (cond (*Acad*)
                         ((setq *Acad* (vlax-get-acad-object)))
                         )
                         (strcat "AeccXUiLand.AeccApplication." appstr)
                      )
                     )
                    )
                  )
                  'ActiveDocument
                 )
               )
              )
            ) ; end main cond
          ) ; end progn
        ) ; end if vsrn
      )
    
      (defun *error* (msg)
        (princ (strcat "Error Incurred: " msg))
        (setvar "EXPERT" old_expert)
        (setvar "cmdecho" 1)
        (setvar "pickfirst" 1)
      )
      
      (setq old_expert (getvar "EXPERT")
    
    		;;CHANGE THIS IF YOU NEED A DIFFERENT LTYPE
                    ;;****************************************
    
            linetype "HIDDEN"  
      )
    
      (command "._linetype" "load" linetype "acad.lin" "")
    
      ;;begin Main
      ;;**************
    
      (vlax-for layer (vla-get-layers c3ddoc)
        (if (wcmatch (setq lay1 (vla-get-name layer)) "CORE_*")
          (progn
            (vla-put-linetype layer linetype)
            (princ (strcat "\nLayer [" lay1 "] has linetype [" linetype "]"))
          )
        )
      )
      
      (setvar "EXPERT" old_expert)
      (princ)
    
    )

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

    Default Re: changing layer properties with lisp (line type)

    Why not just open the DWT, use the -LAYER Command, Linetype option, and enter "CORE_*" WCMATCH string, Save DWT when done? Lemon squeezy.

  7. #7
    Member
    Join Date
    2013-08
    Posts
    23
    Login to Give a bone
    0

    Default Re: changing layer properties with lisp (line type)

    Quote Originally Posted by BlackBox View Post
    Why not just open the DWT, use the -LAYER Command, Linetype option, and enter "CORE_*" WCMATCH string, Save DWT when done? Lemon squeezy.
    Yeah well, sure. =p

    It's doing the same thing, but it would be nice to not have to (vl-load-com)

  8. #8
    Member
    Join Date
    2012-04
    Posts
    11
    Login to Give a bone
    0

    Default Re: changing layer properties with lisp (line type)

    Quote Originally Posted by ngwalters412556 View Post
    Try this:




    Code:
    (defun c:foo (/ *error* old_expert linetype lay1)
    
      (vl-load-com)
    
      (defun vercheck ()
    
    	;;checks version, sets version and model space accordingly
    
      (if ((lambda (vrsn)
            (cond
             ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
             ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
             ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
             ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 
    	 ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 
    	 ((vl-string-search "R19.1" vrsn) (setq appstr "10.3")) ;14
            ((alert "This version of C3D not supported!"))
            )
           )
           (vlax-product-key)
          )                         ; end if condition progn is true
          (progn
            (cond (C3Ddoc)
              ((setq C3Ddoc
                (vlax-get
                  (cond (C3D)
                    ((setq C3D
                      (vla-getinterfaceobject
                         (cond (*Acad*)
                         ((setq *Acad* (vlax-get-acad-object)))
                         )
                         (strcat "AeccXUiLand.AeccApplication." appstr)
                      )
                     )
                    )
                  )
                  'ActiveDocument
                 )
               )
              )
            ) ; end main cond
          ) ; end progn
        ) ; end if vsrn
      )
    
      (defun *error* (msg)
        (princ (strcat "Error Incurred: " msg))
        (setvar "EXPERT" old_expert)
        (setvar "cmdecho" 1)
        (setvar "pickfirst" 1)
      )
      
      (setq old_expert (getvar "EXPERT")
    
    		;;CHANGE THIS IF YOU NEED A DIFFERENT LTYPE
                    ;;****************************************
    
            linetype "HIDDEN"  
      )
    
      (command "._linetype" "load" linetype "acad.lin" "")
    
      ;;begin Main
      ;;**************
    
      (vlax-for layer (vla-get-layers c3ddoc)
        (if (wcmatch (setq lay1 (vla-get-name layer)) "CORE_*")
          (progn
            (vla-put-linetype layer linetype)
            (princ (strcat "\nLayer [" lay1 "] has linetype [" linetype "]"))
          )
        )
      )
      
      (setvar "EXPERT" old_expert)
      (princ)
    
    )
    thanks i will try this now imm back at work today

Similar Threads

  1. Changing Type Properties for Grouped Elements
    By markusb in forum Revit Architecture - General
    Replies: 1
    Last Post: 2012-04-28, 10:53 PM
  2. 2012: Changing layer properties, per tab, on one x-ref
    By Globey in forum AutoCAD General
    Replies: 2
    Last Post: 2011-09-02, 10:11 PM
  3. Changing line properties
    By nmulder in forum AutoLISP
    Replies: 2
    Last Post: 2008-11-04, 05:24 AM
  4. Change display of layer without changing layer properties
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-09-11, 02:33 PM
  5. Changing the angle of a line in the properties window
    By jasontirone in forum AutoCAD General
    Replies: 2
    Last Post: 2005-04-12, 03:25 PM

Tags for this Thread

Posting Permissions

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