Giovannino60 Posted March 5, 2023 Share Posted March 5, 2023 I can not calculate the area of this hatch, I also generated the outline, but I do not calculate the area, what can I do? Thank you Retini.dwg Quote Link to comment Share on other sites More sharing options...
Cad64 Posted March 5, 2023 Share Posted March 5, 2023 I think there's something wrong with that hatch pattern. If I delete the hatch and then create a new hatch, using the same hatch boundary lines, the Area will display in the Properties panel. Quote Link to comment Share on other sites More sharing options...
XDSoft Posted April 16 Share Posted April 16 (edited) Mainly due to hatch boundary 1. Self-crossing 2. point too densely ...... It can be restored by re-establishing the boundary, then self-intersecting the boundary, thinning out the vertices, etc. ==================== [XDrX-PlugIn(145)] Fixed Hatch with area 0 (theswamp.org) https://www.theswamp.org/index.php?topic=59461.0 (defun c:xdtb_hafix0 (/ ha ha1 ha-new has loop loops mp old-boundary progress re ss x) (defun _delete-old-boundary (loops) (mapcar '(lambda (loop) (if (and (setq ss (ssget "f" (xdrx-getpropertyvalue loop "vertices") '((0 . "*line,arc,ellipse,circle")))) (ssdel loop ss) (> (sslength ss) 0) ) (progn (mapcar '(lambda (x) (setq re (xdrx-geom-relation loop x t)) (if (or (= re XD:kTangent) (= re XD:kBoundary) (= re XD:kCoincident) ) (xdrx-entity-delete x) ) ) (xdrx-ss->ents ss) ) ) ) ) loops ) ) (if (and (setq ha (xdrx-ssget (xdrx-string-multilanguage "\n选择填充对象<退出>:" "\nSelect Hatch<Exit>:") ' ((0 . "hatch")) ) ) (setq has (xdrx_hatch_get0area ha)) ) (progn (xdrx-begin) (xdrx-sysvar-push '("fitarc" 0)) (xdrx-document-safezoom ha) (xdrx_statusbar_begin (xdrx-string-multilanguage "处理中..." "Procesing...") (length has)) (setq progress 0) (mapcar '(lambda (x) (xdrx_statusbar_setpos (setq progress (1+ progress))) (if (setq mp (xdrx-hatch->mpolygon x)) (progn (setq ha1 (xdrx-mpolygon->hatch mp)) (xdrx-entity-matchprop x ha1) (setq ha x ha-new (car (xdrx-ss-getsub ha1 '((0 . "hatch")))) loops (xdrx-getpropertyvalue ha-new "assocobjids") ) (if (setq old-boundary (xdrx-getpropertyvalue x "assocobjids")) (progn (xdrx-entity-delete old-boundary) ) (progn (_delete-old-boundary loops) ) ) (xdrx-object-swapid ha ha-new) (xdrx-entity-delete ha-new) ) ) ) has ) (xdrx_statusbar_end) (xdrx-prompt (xdrx-string-formatex (xdrx-string-multilanguage "\n修复了 %d 个面积为0的填充." "\nFixed %d Hatchs with area 0." ) (length has) ) ) (xdrx-sysvar-pop) (xdrx-end) ) ) (princ) ) ============================= The code above , using XDRX - API, Before trying the forum code, please download and install XDRX - API xdcad/XDrx-API: Autolisp development library written in ObjectARX (github.com) https://github.com/xdcad/XDrx-API Edited April 17 by XDSoft Quote Link to comment Share on other sites More sharing options...
mhupp Posted April 17 Share Posted April 17 On 3/5/2023 at 12:23 PM, Cad64 said: I think there's something wrong with that hatch pattern. If I delete the hatch and then create a new hatch, using the same hatch boundary lines, the Area will display in the Properties panel. I bet the polyline is self intersecting. use the following to check. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/to-find-self-intersection-of-lwpolyline/m-p/6491654/highlight/true#M343734 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.