progeCAD support, tips and troubleshooting forum. progeCAD works very similar to some versions of AutoCAD. Moderated.

Moderators: caddit, Moderators

#2113 by andyarchitect
Tue Mar 25, 2014 12:28 pm
Hi, I have an AutoCAD LISP file that I previously used alot to find areas, but it doesn't run properly in ProgeCAD. Programming does not come naturally to me and although I looked through it to see if there was a simple change that could be made it's all going over my head. If anyone could tell me what changes need making to make it run in ProgeCAD or of a conversion program I could use I would really appreciate it.

Below is the text from the LISP file.




(defun *error* (msg)
(princ "\n...") (princ msg) (terpri)
(setvar "luprec" oldlup) (setvar "dimzin" oldzin)
)
(defun war(/ oldlup ss ins area tst1 tst arg)
(setq oldlup (getvar "luprec") oldzin (getvar "dimzin"))
(setvar "luprec" 2) (setvar "dimzin" 8)
(setq sty_ht (cdr(assoc 40(tblsearch "style" (getvar "textstyle")))))
(setq ss (entsel "\nPls. pick a closed polyline or circle:"))
(while (= ss nil)
(setq ss (entsel "\nInvalid Selection. Pls try again:"))
)
(COND ((or (= (cdr(assoc 0 (entget(car ss)))) "LWPOLYLINE") (= (cdr(assoc 0(entget(car ss)))) "CIRCLE"))
(progn
(command "area" "e" ss)
(princ "\n ")
(princ "\n ")
(setq ins (getpoint "\nPick text insertion point:"))
(setq area (/ (getvar "area") 1000000))
(setq tst1 (rtos area))
(setvar "textsize" tht1)
(setq tst (strcat tst1 " sq.m."))
(if (> sty_ht 0)
(progn
(command "text" "j""m"ins 0 tst)
(ctxth)
)
(command "text" "j" "m" ins tht1 0 tst)

)
(setvar "luprec" oldlup )(setvar "dimzin" oldzin)
(princ)
))
( (AND (/= (cdr(assoc 0 (entget(car ss)))) "LWPOLYLINE")
(/= (cdr(assoc 0(entget(car ss)))) "CIRCLE")
)
(PROGN
(SETQ ARG "F")
(while (= arg "F")
(SETQ SS (ENTSEL "\nInvalid Selection.Pls. try again."))
(IF (or (= (cdr(assoc 0 (entget(car ss)))) "LWPOLYLINE")
(= (cdr(assoc 0(entget(car ss)))) "CIRCLE")
)
(SETQ ARG nil)
)
)
(command "area" "e" ss)
(setq ins (getpoint "\nPick text insertion point:"))
(setq area (/ (getvar "area") 1000000))
(setq tst1 (rtos area))
(setvar "textsize" tht1)
(setq tst (strcat tst1 " sq.m."))
(if (> sty_ht 0)
(progn
(command "text" "j" "m" ins 0 tst)
(ctxth)
)
(command "text" "j" "m" ins tht1 0 tst)
)
(setvar "luprec" oldlup)(setvar "dimzin" oldzin)
(princ)
)
)
)
)


(defun ctxth(/ entlist)
(setq entlist(entget(entlast)))
(setq entlist(subst (cons 40 tht1)(assoc 40 entlist) entlist))
(entmod entlist)
)


(defun c:art(/ p tht tht1 )
(prompt "\nPls. Enter Text Size ") (princ "<")
(princ (getvar "textsize"))(prompt "> ")
(setq tht (getdist))
(if (equal tht nil)
(setq tht1 (getvar "textsize"))
(setq tht1 tht)
)
(war)
(princ)
(initget "Yes No")
(setq p (getkword "\nDo you want to continue?(Y or N) <Y>" ))
(if (null p) (setq p "YES"))
(WHILE (equal (strcase p) "YES")
(WAR)
(princ)
(initget "Yes No")
(setq p (getkword "\nDo you want to continue?(Y or N) <Y>" ))
(if (null p) (setq p "YES"))
)
)