vladthedog Posted October 26, 2009 Share Posted October 26, 2009 We use the following code to figure square footage for our jobs individual pieces, as well as total it at the end. Currently it draws a polyline of the selected part (using a layer called "temp" with color 50.) I need for it to delete each temporary polyline as we select each area (meaning, we select area 1, we see a bright yellow line showing what we are getting the sqft of, and then when its time to select the 2nd area, the first yellow line dissapears and draws another). Does that make sense? Thanks. ;;;;;;;;;;;;;;;;;;;;;;;;;;;Total Square Footage for Job ; (defun c:totalft() (command "undo" "BE") (setq dim (ssget "x" '((0 . "dimension")))) (command "chprop" dim "" "la" "sqft" "") (command "layer" "off" "sqft" "off" "cab lines" "off" "cabnets" "") (setq area 0) (command "layer" "m" "sqft" "c" "7" "sqft" "") (if not (command "layer" "m" "temp" "c" "50" "temp" "")) (while (setq pt (getpoint "Please pick inside the area:")) (command "-boundary" "a" "i" "n" "+x" "" PT "") (setq temp (entlast)) (command "area" "o" "l") (setq areatop (getvar "area")) (setq top (rtos (/ AREAtop 92903.04) 2 1)) (setq top (strcat top " sqft")) (setq PT (getpoint "\n pick location for text")) (command "text" "m" PT 0 top) (command "chprop" "l" "" "la" "sqft" "") (command "area" "o" temp "pedit" temp "w" "5" "") (setq area (+ area (getvar "area"))) ) (command "layer" "set" "0" "") (setq FEET (rtos (/ AREA 92903.04) 2 1)) (setq FEET (strcat FEET " sqft")) (princ "\n") (setq TXTPT (getpoint "\n Select Location for sqft total")) (command "text" txtPT 0 FEET) (command "chprop" "l" "" "la" "sqft" "") (command "erase" (ssget "x" ' ((8 . "temp"))) "" "purge" "la" "temp" "n") (command "layer" "on" "sqft" "on" "cab lines" "on" "cabnets" "") (command "chprop" dim "" "la" "sqft" "") (command "undo" "end") (princ) ) Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 26, 2009 Share Posted October 26, 2009 Hi, I've highlighted red what I've added that I think will delete your polyline. The blue highlight are other minor things I changed: ;;;;;;;;;;;;;;;;;;;;;;;;;;;Total Square Footage for Job ; (defun c:totalft(/ [color=Blue]AREA AREATOP DIM FEET PT TEMP TOP TXTPT[/color]) (command "undo" "BE") (setq dim (ssget "x" '((0 . "dimension")))) (command "chprop" dim "" "la" "sqft" "") (command "layer" "off" "sqft" "off" "cab lines" "off" "cabnets" "") (setq area 0) (command "layer" "m" "sqft" "c" "7" "sqft" "") [color=Blue];(if not[/color] (command "layer" "m" "temp" "c" "50" "temp" "")[color=Blue][/color] (while (setq pt (getpoint "Please pick inside the area:")) (command "-boundary" "a" "i" "n" "+x" "" PT "") (setq temp (entlast)) (command "area" "o" "l") (setq areatop (getvar "area")) (setq top (rtos (/ AREAtop 92903.04) 2 1)) (setq top (strcat top " sqft")) (setq PT (getpoint "\n pick location for text")) (command "text" "m" PT 0 top) (command "chprop" "l" "" "la" "sqft" "") (command "area" "o" temp "pedit" temp "w" "5" "") [color=Red][b](entdel temp)[/b][/color] (setq area (+ area (getvar "area"))) ) (command "layer" "set" "0" "") (setq FEET (rtos (/ AREA 92903.04) 2 1)) (setq FEET (strcat FEET " sqft")) (princ "\n") (setq TXTPT (getpoint "\n Select Location for sqft total")) (command "text" txtPT 0 FEET) (command "chprop" "l" "" "la" "sqft" "") (command "erase" (ssget "x" ' ((8 . "temp"))) "" "purge" "la" "temp" "n") (command "layer" "on" "sqft" "on" "cab lines" "on" "cabnets" "") (command "chprop" dim "" "la" "sqft" "") (command "undo" "end") (princ) ) Quote Link to comment Share on other sites More sharing options...
vladthedog Posted October 27, 2009 Author Share Posted October 27, 2009 That works perfectly, thank you. I'm new to lisps, and i was trying to do (command "del" ______) and couldn't figure out what i was doing wrong. forgot about entdel. Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 27, 2009 Share Posted October 27, 2009 That works perfectly, thank you. I'm new to lisps, and i was trying to do (command "del" ______) and couldn't figure out what i was doing wrong. forgot about entdel. While I always encourage entdel or vla-delete, the command method is called with (command "_.erase". Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 27, 2009 Share Posted October 27, 2009 While I always encourage entdel or vla-delete, the command method is called with (command "_.erase". Alan, wouldn't you need to add the temp variable to a selection set to use the erase command? Which is more effort. vladthedog - you're welcome. (perhaps you should put your real name in your profile?) Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 27, 2009 Share Posted October 27, 2009 Alan, wouldn't you need to add the temp variable to a selection set to use the erase command? Which is more effort. vladthedog - you're welcome. (perhaps you should put your real name in your profile?) Long Answer: I didn't add a closing paren because I hadn't completed the call, I was just give enough info to get the ball rolling. It seemed like he knew what to do, he just had "del" instead of "erase". Short Answer: Yes My addition wasn't really needed, I just wanted to make sure he knew how to erase by command. Quote Link to comment Share on other sites More sharing options...
SteveK Posted October 27, 2009 Share Posted October 27, 2009 Long Answer: I didn't add a closing paren because I hadn't completed the call, I was just give enough info to get the ball rolling. It seemed like he knew what to do, he just had "del" instead of "erase". Short Answer: Yes My addition wasn't really needed, I just wanted to make sure he knew how to erase by command. No worries, just making sure (I got a lot of holes in my lisp knowledge) Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 27, 2009 Share Posted October 27, 2009 No worries, just making sure (I got a lot of holes in my lisp knowledge) Mine are just in my head. Quote Link to comment Share on other sites More sharing options...
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.