Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to create a script that contains a lisp based on one that selects the largest and smallest polyline. I changed it to only select the largest mpolygon, then delete it. The original inspiration is here (thanks to @Kent1Cooper
The lisp executes fine, but when I try to continue with an explode command, it does NOT delete the largest mpolygon and goes on to explode into polylines. The end result I am looking for is just regular lines with no duplicates, overlaps, etc.
Here is what I have now. It works until the commented-out section:
-XREF D *
-LAYER SET LNK_SPC_UA
-LAYER OFF "Q_TXT_SPC,LNK_DOOR_IDEN,LNK_FLR,DEFPOINTS,0"
(defun getlen (ent) (vla-get-perimeter (vlax-ename->vla-object ent)))
(foreach pl (mapcar 'cadr (ssnamex (ssget "_X" '((0 . "MPOLYGON") (8 . "LNK_SPC_UA")))))
(cond
((not shortest) (setq shortest pl longest pl))
((> (getlen pl) (getlen longest)) (setq longest pl))
); cond
); foreach
(setq extremes (ssadd longest))
(sssetfirst extremes)
(command "_.Erase" extremes "")
(setvar "qaflags" 17)
;;;(command "explode" "all" "")
;;;(command "explode" "all" "")
;;;(setvar "qaflags" 0)
;;;
;;;-OVERKILL
;;;ALL
;;;
;;;T
;;;Y
;;;E
;;;Y
Any help is appreciated. Using AutoCAD 2021
Thanks, L
Solved! Go to Solution.