Erickson1026 Posted June 23, 2012 Posted June 23, 2012 (edited) 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. 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) ) Thanks in advance. Dave Edited June 24, 2012 by Erickson1026 Quote
MSasu Posted June 23, 2012 Posted June 23, 2012 Please try this to dinamically draw the polyline (I didn't checked the rest of the code): (command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) ) Please edit your post and add code tags. Thank you. Quote
Erickson1026 Posted June 24, 2012 Author Posted June 24, 2012 (edited) 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. 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) ) Edited June 24, 2012 by Erickson1026 Quote
MSasu Posted June 24, 2012 Posted June 24, 2012 Seems that you missed the closing paranthesis for WHILE. (command "_PLINE") (while (> (getvar "CMDACTIVE") 0) (command pause) [color=red])[/color] Again, please edit your both posts and add code tags. Quote
Erickson1026 Posted June 24, 2012 Author Posted June 24, 2012 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. 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) ) Quote
MSasu Posted June 25, 2012 Posted June 25, 2012 Just noticed that earlier in the code you are asking for a point input; maybe the code should look like: (command "_PLINE" [color=magenta]pT1[/color]) (while (> (getvar "CMDACTIVE") 0) (command pause) ) 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. Thank you for edit the first posts, it looks much better now. Quote
Erickson1026 Posted June 25, 2012 Author Posted June 25, 2012 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 Quote
MSasu Posted June 25, 2012 Posted June 25, 2012 Glad to hear that is solved now. You're entirely welcome, David! Quote
Erickson1026 Posted June 25, 2012 Author Posted June 25, 2012 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. ;;;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) ) Quote
MSasu Posted June 25, 2012 Posted June 25, 2012 Try to call the LAYER command like this: (COMMAND "[color=red]_[/color]LAYER" "[color=red]_[/color]A" "[color=red]_[/color]S" "DAVE" "" "" "" "") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.