AutoCAD 2010/2011/2012

Reply
Member
matthew.long
Posts: 5
Registered: ‎04-15-2011
Message 1 of 7 (1,296 Views)
Accepted Solution

Continuous Lisp Command

1296 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

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

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.

Active Contributor
GOLEN
Posts: 31
Registered: ‎05-24-2011
Message 2 of 7 (1,291 Views)

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
*Expert Elite*
azrdgldr
Posts: 1,250
Registered: ‎01-09-2007
Message 3 of 7 (1,290 Views)

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. 

Member
matthew.long
Posts: 5
Registered: ‎04-15-2011
Message 4 of 7 (1,283 Views)

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

*Expert Elite*
azrdgldr
Posts: 1,250
Registered: ‎01-09-2007
Message 5 of 7 (1,277 Views)

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.

Member
matthew.long
Posts: 5
Registered: ‎04-15-2011
Message 6 of 7 (1,272 Views)

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

Contributor
PeterJansoone
Posts: 15
Registered: ‎04-24-2001
Message 7 of 7 (1,221 Views)

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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.