• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • AutoCAD 2010/2011/2012 DWG Format

    Reply
    Member
    matthew.long
    Posts: 5
    Registered: ‎04-15-2011
    Accepted Solution

    Continuous Lisp Command

    632 Views, 6 Replies
    09-01-2011 11:58 AM

    I currently use the lisp command below for freezing layers.... But after I select the object I want to freeze I have to enter into the command again.... Is there anyway to have this command continuously loop until I am done using it?

     

     

       (defun C:FL ( / layer)     

           (setq layer

             (cdr

               (assoc 8

                  (entget

                     (car

                       (entsel "Pick Item to freeze layer "))))))

          (command "layer" "freeze" layer "")

     

    Thank You,

    MRL

    Please use plain text.
    Active Contributor
    GOLEN
    Posts: 31
    Registered: ‎05-24-2011

    Re: Continuous Lisp Command

    09-01-2011 12:02 PM in reply to: matthew.long

    Check out this site. Has everytihing you need. http://www.afralisp.net/

    ______________________________________________________________
    AutoCAD 2012
    Dell Precision T7400, Intel Xeon @3.4GHz
    Win XP 32bit 4GB RAM
    Nvidia Quadro FX 3700
    Cyborg R.A.T. 7 mouse
    Please use plain text.
    *Expert Elite*
    Posts: 1,242
    Registered: ‎01-09-2007

    Re: Continuous Lisp Command

    09-01-2011 12:03 PM in reply to: matthew.long

    Enter a "while" is T (true) in the lisp and it should loop until you cancel the command.  Look into the AutoLISP help files for more info. 

    Please use plain text.
    Member
    matthew.long
    Posts: 5
    Registered: ‎04-15-2011

    Re: Continuous Lisp Command

    09-01-2011 12:10 PM in reply to: azrdgldr

    So what would the lisp command look like then... would you edit mine to what it would be??

    Thank you

    MRL

    Please use plain text.
    *Expert Elite*
    Posts: 1,242
    Registered: ‎01-09-2007

    Re: Continuous Lisp Command

    09-01-2011 12:25 PM in reply to: matthew.long

    How much money you got to give?  Remember how much of a time-saver this will be today and in the future before you give an answer!!!!!

     

     

     

    Just kidding, here you go.

     

    (defun C:FL ( / layer)
      (while T
        (setq layer (cdr (assoc 8 (entget (car (entsel "Pick Item to freeze layer "))))))
        (command "layer" "freeze" layer "")
      ); end while
    ); end Fl.lsp

     

    Just hit the escape key when done with your picks.  Have fun.

    Please use plain text.
    Member
    matthew.long
    Posts: 5
    Registered: ‎04-15-2011

    Re: Continuous Lisp Command

    09-01-2011 12:36 PM in reply to: azrdgldr

    Thanks to both of you guys for the responses.  the command works great like a freaking charm...and the website perfect for guidance... however I am sure I will have more....

     

    Thank you both again.

    MRL

    Please use plain text.
    Contributor
    Posts: 15
    Registered: ‎04-24-2001

    Re: Continuous Lisp Command

    09-02-2011 12:15 AM in reply to: matthew.long

    Your original code wasn't working because you've made the LAYER variable 'local', that way LISP won't remember it when the FL routine finishes.

    Anyway, the code with While is much better.

    Peter Jansoone
    Consultant Plant Design Software
    Greenock CAD Service
    Please use plain text.