sd2006 Posted April 30 Posted April 30 (edited) I'm using LISP to calculate the hatch area, but it keeps giving me errors, and it only works when I copy the code to a different file. Could you please take a look? Thank you. Edited May 4 by sd2006 Quote
Tsuky Posted April 30 Posted April 30 You need to check if the text style has a set height because the options in the TEXT command are not the same. (defun C:ah () (hatcharea)) (defun hatcharea ( / ss area i eo pt) (setq ss (ssget '((0 . "hatch"))) area 0 i 0 ) (cond ((and(and ss) (> (sslength ss) 0)) (repeat (sslength ss) (setq eo (vlax-ename->vla-object (ssname ss i))) (setq area (+ area (vlax-get eo 'Area))) (setq i (+ i 1)) ) (while (not pt)(setq pt (getpoint "\nSelect area text insertion point >"))) (setq area (/ area 1000000.)) (if (zerop (cdr (assoc 40 (tblsearch "STYLE" (getvar "TEXTSTYLE"))))) (command "_.text" pt "" "" (strcat "" (rtos area 2 2) " m²")) (command "_.text" pt "" (strcat "" (rtos area 2 2) " m²")) ) ) ) (princ) ) 1 Quote
mhupp Posted April 30 Posted April 30 Can't remember but I think it might also error calculating the area of a self intersecting hatch. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autocad-2023-a-lisp-file-that-can-identify-self-intersecting/td-p/11090485 Quote
darshjalal Posted 58 minutes ago Posted 58 minutes ago I found this code which is can calculated the area of the hatch even if its intersection itself. Try it , I think it will help. Regards HAE-SHOW THE AREA OF HATCH EVEN IS NOT SHOWING AREA IN PROPERTIES.LSP 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.