nelsonfok Posted January 13, 2015 Share Posted January 13, 2015 Hi friends It's a very useful lsp for area computation but it does not work in my new CAD. Can anyone tell what's worng with this lsp? (defun C:AUTOAREA (/ N SS1 NUM EN ) (if (not "acadapp.exp") (xload "acadapp.exp")) (setq N 0) (setq SS1 (ssadd)) (while (setq PT (getpoint "\nSelect internal point:")) (C:BPOLY PT) (setq SS1 (ssadd (entlast) SS1)) );while (setq NUM (sslength SS1)) (command ".area" "a" "e") ; (command ".area" "e") (while (/= NUM N) (setq EN (ssname SS1 N)) (command EN) (setq area (getvar "area")) (setq areaac (/ area 4046.85)) (setq areasf (* area 10.7639)) (princ (strcat (rtos area 2 2) "m" (chr 178 "\t" (rtos areaac 2 3) "ac." "\t" (rtos areasf 2 0) "ft" (chr 178) ); princ (setq N (1+ N)) );while (command "" "") (command "erase" SS1 "") (command "redraw") (setq SS nil) (command "textscr") (prin1) );end autoarea.lsp Quote Link to comment Share on other sites More sharing options...
SLW210 Posted January 13, 2015 Share Posted January 13, 2015 Please read the Code Posting Guidelines and edit your post to include the Code in Code Tags. Are you really using "AutoCAD LT pre 2000"? If so, AutoCAD LT does not have the ability to use LISP. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted January 14, 2015 Share Posted January 14, 2015 Get area direct from polyline This line has multiple errors check chr 1st also if you get a smiley on end then something hidden is there. (strcat (rtos area 2 2) "m" (chr 178 "\t" (rtos areaac 2 3) "ac." "\t" (rtos areasf 2 0) "ft" (chr 178) ); (setq area (vlax-get-property (vlax-ename->vla-object en) 'Area)) Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted January 14, 2015 Share Posted January 14, 2015 (edited) please use code Tag to prevent smiley (defun C:AUTOAREA (/ N SS1 NUM EN ) ;;;(if (not "acadapp.exp") (xload "acadapp.exp")) (setq N 0) (setq SS1 (ssadd)) (while (setq PT (getpoint "\nSelect internal point:")) (BPOLY PT) (setq SS1 (ssadd (entlast) SS1)) );while (setq NUM (sslength SS1)) ;;;(command ".area" "a" "e") ;removed ; (command ".area" "e") (while (/= NUM N) (setq EN (ssname SS1 N))[color="red"] (setq area (vlax-get-property (vlax-ename->vla-object EN ) 'Area)) ;as suggested by BIGAL[/color] ;;;(command EN) ;removed ;;;(setq area (getvar "area")) ;removed (setq areaac (/ area 4046.85)) (setq areasf (* area 10.7639)) (princ [color="red"](strcat "\n"(rtos area 2 2) "m" (chr 178) "\t" (rtos areaac 2 3) "ac." "\t" (rtos areasf 2 0) "ft" (chr 178))[/color] ); princ (setq N (1+ N)) );while ;;;(command "" "") ;removed (command "erase" SS1 "") (command "redraw") (setq SS nil) (command "textscr") (prin1) );end autoarea.lsp your routine too old? try advanced Area label area to field Edited January 14, 2015 by hanhphuc link for OP reference Quote Link to comment Share on other sites More sharing options...
nelsonfok Posted January 14, 2015 Author Share Posted January 14, 2015 Sorry friends. I'll remove the smile next time In fact i use R14 but My company upgrade the CAD system recently. Many old lsps do not function well in the new CAD. 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.