vipulgos Posted November 19, 2008 Share Posted November 19, 2008 Dear all this is my first post on the forum. Little about me; I am good with excel and VBA, but very much new to Lisp. I have with me Tlen.lsp and LA.lsp lisp commands. Both are working very well. Can any body help me to join both of these. By this I may be able to find the length of a closed body as well as the enclosed area at the same time. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 19, 2008 Share Posted November 19, 2008 Would you be able to post your LISPs so that alterations and modifications can be made to achieve your desired result? Quote Link to comment Share on other sites More sharing options...
vipulgos Posted November 19, 2008 Author Share Posted November 19, 2008 Below are the codes: ;Labels a lot's area using the Boundary command. LPS 2008-10 (defun c:LA () ;(/ cl txtst txtsz oldecho oldsnap B ac sf kw) (setq temperr *error*);store *error* (setq *error* errortrap);reassign *error* (setq cl (getvar "clayer") txtst (getvar "textstyle") txtsz (getvar "textsize") oldecho (getvar "cmdecho") oldsnap (getvar "osmode") );setq (setvar "cmdecho" 0) (command "-style" "SIMPLEX" "simplex.shx" "0" "0.9" "0" "n" "n" "n") (setq ip (getpoint "\nPick internal point: ")) (command "-layer" "m" "calc" "c" "63" "calc" "p" "n" "calc" "") (command "-boundary" ip "") (command "region" (entlast) "") (setq b (entlast)) (command "area" "o" b) (setq ac (strcat (rtos (/ (getvar "area") 10.76) 2 3) " Sq.m.")) (setq sf (strcat (rtos (getvar "area") 2 2) " SQ.FT.")) (command "-layer" "m" "LOT-AREA" "c" "53" "" "") (command "text" "s" "simplex" "c" ip (* 0.12 (getvar "dimscale")) "0" sf ) (command "text" "" ac) (initget "Yes No") (setq kw (getkword "\nErase boundary Yes/No? ")) (if (= kw nil) (command "erase" b "") ) ;if (command "textstyle" txtst) (setvar "clayer" cl) (setvar "textsize" txtsz) (setvar "cmdecho" oldecho) (setvar "osmode" oldsnap) (setq *error* temperr) (princ) );defun c: ;==========ERROR TRAP================= (defun errortrap (msg) ;define function (setvar "textstyle" txtst) (setvar "textsize" txtsz) (setvar "clayer" cl) (setvar "cmdecho" oldecho) ;restore variables (setvar "osmode" oldsnap) (setq *error* temperr) ;restore *error* (prompt "\nResetting System Variables ") ;inform user (princ) );defun ;==========ERROR TRAP================= (prompt "\nLotArea.lsp loaded, type LA to run") (princ) ;| TLEN.LSP - Total LENgth of selected objects © 1998 Tee Square Graphics |; (defun C:TLEN (/ ss tl n ent itm obj l) (setq ss (ssget) tl 0 n (1- (sslength ss))) (while (>= n 0) (setq ent (entget (setq itm (ssname ss n))) obj (cdr (assoc 0 ent)) l (cond ((= obj "LINE") (distance (cdr (assoc 10 ent))(cdr (assoc 11 ent)))) ((= obj "ARC") (* (cdr (assoc 40 ent)) (if (minusp (setq l (- (cdr (assoc 51 ent)) (cdr (assoc 50 ent))))) (+ pi pi l) l))) ((or (= obj "CIRCLE")(= obj "SPLINE")(= obj "POLYLINE") (= obj "LWPOLYLINE")(= obj "ELLIPSE")) (command "_.area" "_o" itm) (getvar "perimeter")) (T 0)) tl (+ tl l) n (1- n))) (alert (strcat "Total length of selected objects is " (rtos tl))) (princ) ) Quote Link to comment Share on other sites More sharing options...
lpseifert Posted November 19, 2008 Share Posted November 19, 2008 I revised LA.lsp to include a perimeter, if that's what you're looking for. You can play with the units you want ;Labels a lot's area using the Boundary command. LPS 2008-10 (defun c:LA () ;(/ cl txtst txtsz oldecho oldsnap B ac sf kw) (setq temperr *error*);store *error* (setq *error* errortrap);reassign *error* (setq cl (getvar "clayer") txtst (getvar "textstyle") txtsz (getvar "textsize") oldecho (getvar "cmdecho") oldsnap (getvar "osmode") );setq (setvar "cmdecho" 0) (command "-style" "SIMPLEX" "simplex.shx" "0" "0.9" "0" "n" "n" "n") (setq ip (getpoint "\nPick internal point: ")) (command "-layer" "m" "calc" "c" "63" "calc" "p" "n" "calc" "") (command "-boundary" ip "") (command "region" (entlast) "") (setq b (entlast)) (command "area" "o" b) (setq ac (strcat (rtos (/ (getvar "area") 10.76) 2 3) " Sq.m.")) (setq sf (strcat (rtos (getvar "area") 2 2) " SQ.FT.")) (setq per (strcat (rtos (getvar "perimeter") 2 2) " FT.")) (command "-layer" "m" "LOT-AREA" "c" "53" "" "") (command "text" "s" "simplex" "c" ip (* 0.12 (getvar "dimscale")) "0" sf ) (command "text" "" ac) (command "text" "" per) (initget "Yes No") (setq kw (getkword "\nErase boundary Yes/No? <Yes>")) (if (= kw nil) (command "erase" b "") ) ;if (command "textstyle" txtst) (setvar "clayer" cl) (setvar "textsize" txtsz) (setvar "cmdecho" oldecho) (setvar "osmode" oldsnap) (setq *error* temperr) (princ) );defun c: ;==========ERROR TRAP================= (defun errortrap (msg) ;define function (setvar "textstyle" txtst) (setvar "textsize" txtsz) (setvar "clayer" cl) (setvar "cmdecho" oldecho) ;restore variables (setvar "osmode" oldsnap) (setq *error* temperr) ;restore *error* (prompt "\nResetting System Variables ") ;inform user (princ) );defun ;==========ERROR TRAP================= (prompt "\nLotArea.lsp loaded, type LA to run") (princ) Quote Link to comment Share on other sites More sharing options...
vipulgos Posted November 19, 2008 Author Share Posted November 19, 2008 Thanx a lot dear. It really works. Now I can expedite my building estimation quite a lot...As it will give me carpet area of block as well as perimeter of wall instantly. 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.