Please try this to dinamically draw the polyline (I didn't checked the rest of the code):
Please edit your post and add code tags. Thank you.Code:(command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) )
Registered forum members do not see this ad.
Hello all,
Somewhat new at using lisp for a very specific function.
Here's the issue, I have a lisp routine that needs to save a layerstate, set a specif ic layer current, lock the others, then run the poly line command, exit the pline command, then reset back to the original layer state after running the pline command. Here's the code so far.
The pline is erroring out before I get to the layer state which are still being developed.
So main question, can I get the pline command to work properly first.
Thanks in advance.Code:LOA.LSP 2012 by David W. Erickson ;;; DESCRIPTION ;;; ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command. (DEFUN C:LOA (/ LAYER OFF ) (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "" ) (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. ")) (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "") (command "pline" pt1 pause ) (COMMAND "-LA" "A" "R" "DAVE" "" "" "" ) (COMMAND "-LA" "A" "D" "DAVE" "" "" "" ) (princ) )
Dave
Last edited by Erickson1026; 24th Jun 2012 at 09:53 pm.
Please try this to dinamically draw the polyline (I didn't checked the rest of the code):
Please edit your post and add code tags. Thank you.Code:(command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) )
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Revised Code below. I am getting closer. Thanks for the tips and hopefully I wrapped the code appropriately. It works to set the layer and draw the polyline but before I can pick the first point, the "command line dialog" comes and asks to pick the first point, which then requires an additional (2) picks in the drawing editor to initiate the pline. Something simple perhaps.
Code:LOA.LSP 2012 by David W. Erickson ;;; DESCRIPTION ;;; ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command. (DEFUN C:LOA (/ LAYER OFF ) (COMMAND "-LAYER" "A" "S" "DAVE" "" "") (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. ")) (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "") (command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "") (COMMAND "-LAYER" "A" "D" "DAVE" "" "") (princ) )
Last edited by Erickson1026; 24th Jun 2012 at 09:54 pm.
Seems that you missed the closing paranthesis for WHILE.
Again, please edit your both posts and add code tags.Code:(command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) )
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Thanks for that. Figured out code tags this time. Still no luck with extra command line dialog window popping up and extra mouse clicks required to start command.
Code:LOA.LSP 2012 by David W. Erickson ;;; DESCRIPTION ;;; ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command. (DEFUN C:LOA (/ LAYER OFF ) (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "") (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. ")) (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "") (command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) ) (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "") (COMMAND "-LAYER" "A" "D" "DAVE" "" "") (princ) )
Just noticed that earlier in the code you are asking for a point input; maybe the code should look like:
If it still doesn’t work as expected, then please post here the drawing you will use it in (without content, only for layers three) to test the rest of the code.Code:(command "_PLINE" pT1) (while (> (getvar "CMDACTIVE") 0) (command pause) )
Thank you for edit the first posts, it looks much better now.
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
That worked! Your patience and assistance is much appreciated. This routine will be great to work with for months to come!
Thanks a million and take care.
David
Glad to hear that is solved now. You're entirely welcome, David!
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
I actually had to modify it a bit more this morning after getting to work. The previous version worked well the first time through, but then if I ran it again, I was hit with the F2 screen and had to re-pick on the screen to begin the polyline. I added the graphscr commands at a few spots to supress the screen and keep rolling through.
Again, thanks for your help.
Code:;;;LOA.LSP 2012 by David W. Erickson ;;; DESCRIPTION ;;; ;;; This function turns on a-wall-e layer and locks all non Ioffice layers, sets io-area-indv current and starts the polyline command. (DEFUN C:LOA (/ LAYER OFF ) (COMMAND "-LAYER" "A" "S" "DAVE" "" "" "" "") (GRAPHSCR) (SETQ pT1 (GETPOINT "\nSelect the 1st POINT. ")) (GRAPHSCR) (command "-layer" "fr" "*" "th" "io*" "th" "a-*-e" "lo" "*" "unlock" "io*" "set" "io-area-indv" "fr" "a-anno*" "th" "_close_door" "u" "_close_door" "off" "a-door-e" "OFF" "A-FLOR-STRS-E" "OFF" "IO-SEC-SPCS" "OFF" "A-EQPM-E" "") (command "_PLINE" pt1) (while (> (getvar "CMDACTIVE") 0) (command pause) ) (GRAPHSCR) (COMMAND "-LAYER" "A" "R" "DAVE" "" "" "") (COMMAND "-LAYER" "A" "D" "DAVE" "" "") (GRAPHSCR) (princ) )
Registered forum members do not see this ad.
Try to call the LAYER command like this:
Code:(COMMAND "_LAYER" "_A" "_S" "DAVE" "" "" "" "")
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
Bookmarks