A lisp file that can read the total area of each hatch and summarize them in a table,
Assume that I have multiple hatches of different patterns and color (attached) and I wanted to calculate their areas (and summarize them in a table along with a symbol represents their color) based on their color such that the areas of hatches of same color are accumulated.
This can be done partially using the command “extract data” but has two issues:
Thank you
Best
Jamal
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@Anonymous , ok but the first column will not have the Hatch , as in the previous DWG
Jamal Hatch Area2-in current units.dwg
in the new dwg 3DS-B62--w description.dwg
will nit show teh hatch pattern
@Anonymous
About TEXT inside the hatch , it seem to be the same as the hatch layer name . Or it be some diferents text .
@Anonymous , as to be able to get the text it shall be inside a closed polyline enclosing the hatch .
This way the text can be selected by CP or WP ssget .
Other way , and as far I know, I can not select the text inside each hatch .
see dwg attached
Removed solution ok for polygons not arcs. need to use HATCHGENERATEBOUNDARY but then convert arcs to a series of shorter segments then can use ssget "WP" pts & TEXT using the co-ordinates of the pline. Now where is convert pline arc to pline with multi arcs.
; get objects using hatch
; By AlanH june 2021
removed not quite right
Hello, anyone helps me to edit this code to area /1000000 and add m2 at end? Thanks!
(defun c:tmp (/ area sset P1)
(vl-load-com)
(cond ((and
(ssget ":L" '((0 . "Hatch")))
(setq area 0)
(vlax-for H (setq sset (vla-get-activeselectionset
(vla-get-activedocument
(vlax-get-acad-object))))
(setq area (+ (vla-get-area h) area))
)
(setq P1 (getpoint "\nPick text point: "))
(entmake
(list
(cons 0 "TEXT")
(cons 40 18.0)
(cons 10 P1)
(cons 1 (strcat
"\nTotal Area = "
(if (or (= (getvar "lunits") 3)
(= (getvar "lunits") 4))
(strcat
(rtos area 2 2)
" sq. in. ("
(rtos (/ area 144) 2 2)
" sq. ft.)")
(rtos area))))
);list
);entmakex
(vla-delete sset)
))
)
)
@Anonymous , will you apply this lisp to this dwg?
If so , the lisp will not work , because your lunits is set to 2, for decimal and up to 4 places decimal part. and your insert units is inches
, and lunits 3 and 4 are for
as follow
LUNITS Value
Description
1 Scientific
2 Decimal
3 Engineering
4 Architectural
5 Fractional.
Please clear it
Why I can't see hatch area pattern? What's wrong with me?
Can't find what you're looking for? Ask the community or share your knowledge.