Here is a very helpful routine that I seemed to have forgotten about. It lets you select a closed polyline and it will trim and delete everything outside of it. Anything that crosses its edge will be trimmed on the outside, while everything that is outside of the selected closed Polyline will be erased.
Known limitation: Closed polyline has to consist of straight segments (no arcs)
- Here’s how:
- OCD to start
- Select closed Polyline
; Required Express tools ; OutSide Contour Delete with Extrim ; Found at http://forums.augi.com/showthread.php?t=55056 (defun C:OCD ( / en ss lst ssall bbox) (vl-load-com) (if (and (setq en (car(entsel "\nSelect contour (polyline): "))) (wcmatch (cdr(assoc 0 (entget en))) "*POLYLINE")) (progn (setq bbox (ACET-ENT-GEOMEXTENTS en)) (setq bbox (mapcar '(lambda(x)(trans x 0 1)) bbox)) (setq lst (ACET-GEOM-OBJECT-POINT-LIST en 1e-3)) (ACET-SS-ZOOM-EXTENTS (ACET-LIST-TO-SS (list en))) (command "_.Zoom" "0.95x") (if (null etrim)(load "extrim.lsp")) (etrim en (polar (car bbox) (angle (car bbox)(cadr bbox)) (* (distance (car bbox)(cadr bbox)) 1.1))) (if (and (setq ss (ssget "_CP" lst)) (setq ssall (ssget "_X" (list (assoc 410 (entget en))))) ) (progn (setq lst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))) (foreach e1 lst (ssdel e1 ssall)) (ACET-SS-ENTDEL ssall) ) ) ) ) ) (princ "\nType OCD to start") (princ)