Results 1 to 6 of 6

Thread: Combining/running five different lisp routines at once

  1. #1
    Member
    Join Date
    2015-10
    Posts
    18
    Login to Give a bone
    0

    Default Combining/running five different lisp routines at once

    I need your guys' help with a Lisp routine. I have been trying to find faster ways of completing operations.
    Basically what I am trying to do is create a Lisp that actuates multiple Lisps, or combine one giant lisp, so that I am able to type in the command bar something like "SETUP" and the drawing I have open will be impacted by the operations below. It will help set up the jobs I have way faster. The operations I want to accomplish when using this Lisp are the following in order:

    • Delete all paper space tabs
    • Detach all xrefs (PDFs, DWGs, etc.)
    • Delete all scales (under SCALELISTEDIT)
    • Turn on and thaw all layers
    • Purge all

    If you have any tips, tricks or better ideas, please let me know.
    Thanks in advance!!

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Combining/running five different lisp routines at once

    Here is the scalelist clear function.

    P=

    Code:
    (defun ScaleListClear (/ objDictionary objXRecord)
     (if (setq objDictionary (vla-item (vla-get-dictionaries
                                        (vla-get-activedocument
                                         (vlax-get-acad-object)
                                        )
                                       )
                                       "ACAD_SCALELIST"
                             )
         )
      (vlax-for objXRecord objDictionary
       (vla-delete objXRecord)    
      )   
     )
    )
    (vl-load-com)
    Last edited by peter; 2015-10-11 at 08:04 PM.
    AutomateCAD

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Combining/running five different lisp routines at once

    Delete Layouts.

    Code:
    (defun LayoutsClear (/ colLayouts objLayout)
     (if (setq colLayouts (vla-get-layouts
                           (vla-get-activedocument
                            (vlax-get-acad-object))))
    
      (vlax-for objLayout colLayouts
       (if (/= (vla-get-name objLayout) "Model")
        (errortrap '(vla-delete objLayout))
       )  
      )   
     )
    )
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (X)(set X (eval symFunction)))
                          (list 'result))))
      nil
      (if result result 'T)
     )
    )
    
    
    (vl-load-com)
    AutomateCAD

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Combining/running five different lisp routines at once

    Turn Layers On, Thaw and Unlock for good measure.

    Syntax

    Code:
    (LayerOnThawUnlock "X1*")
    for example will change all layers that match the "X1*" wildcard filter

    Code:
    (defun LayerOnThawUnlock (strWCLayerName / objLayer)
     (vlax-for objLayer (vla-get-layers
                         (vla-get-activedocument
                          (vlax-get-acad-object)
                         )
                        )
      (and
       (wcmatch (strcase (vla-get-name objLayer)) (strcase strWCLayerName))
    
       (ErrorTrap '(vla-put-lock    objLayer :vlax-false))
    
       (ErrorTrap '(vla-put-freeze  objLayer :vlax-false))
    
       (ErrorTrap '(vla-put-LayerOn objLayer :vlax-true))
    
      )
     )
    )
    
    (defun ErrorTrap (symFunction / objError result)
     (if (vl-catch-all-error-p
          (setq objError (vl-catch-all-apply
                         '(lambda (X)(set X (eval symFunction)))
                          (list 'result))))
      nil
      (if result result 'T)
     )
    )
    
    (vl-load-com)
    AutomateCAD

  5. #5
    Member
    Join Date
    2015-10
    Posts
    18
    Login to Give a bone
    0

    Default Re: Combining/running five different lisp routines at once

    Wow thanks Peter!

    Do you know how I could combine these lisps, so if I typed something like "SETUP", it would actuate those lisps?

  6. #6
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    561
    Login to Give a bone
    0

    Default Re: Combining/running five different lisp routines at once

    Just copy all the defuns then at the bottom put each defun in order within a c:defun

    Code:
    (defun c:setup ()
    (ScaleListClear)
    (LayoutsClear)
    (LayerOnThawUnlock "X1*")
    )
    )

Similar Threads

  1. help combining lisp
    By info.white.ca683434 in forum AutoLISP
    Replies: 6
    Last Post: 2014-12-01, 08:56 PM
  2. Replies: 16
    Last Post: 2012-11-06, 06:08 AM
  3. Replies: 2
    Last Post: 2011-06-28, 09:49 PM
  4. Help combining some routines
    By sonny.morales in forum AutoLISP
    Replies: 6
    Last Post: 2007-10-01, 03:18 PM
  5. Replies: 16
    Last Post: 2007-02-05, 04:01 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
  •