I know that AutoCAD has the extreme trim command which enables you to trim everything either inside or outside a boundary line.
Has anyone put together a routine that will delete everything either inside or outside a specified boundary line?
|
I know that AutoCAD has the extreme trim command which enables you to trim everything either inside or outside a boundary line.
Has anyone put together a routine that will delete everything either inside or outside a specified boundary line?
Simple way
use "erase" "all" "remove" and then window the objects you do not want erased
In a perfect world...with perfect boundaries...
But...
This isn't a perfect world...and my boundary lines are all over the place...
Thanks for the help
have you tried using
"erase" "All" "remove" "f"
?
Please pardon my ignorance, I'm attempting to overcome it. I think Stephen and I are looking for the same thing.
I am very much in need of the "extreme trim command which enables you to trim everything either inside a boundary line." I don't know of this command.
The best that I can do is laboriously apply the xclip command for blocks & xrefs, then trim (standard version) for everything that crosses the boundary, and then erase everything else. [Working strictly 2D in this discussion] I tried this in both 2008 and 2004 using an existing drawing. I didn't understand the erase-all...f suggestion. If I use the erase command, the selected objects are completely removed; "erase" does not give the option for a boundary to slice though objects.
Originally Posted by Stephen.Walz
try it
Code:;Required Express tools ;OutSide Contour Delete with Extrim (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")
azarko,
Can you please have a quick look t this and see where the error is ?
I used your routine and tried to have it allow the user to draw the boundary and then erase it, though somethings not right.
Routine below:
Thank youCode:;Required Express tools ;Erases Everything OutSide Contour Delete (defun C:OCD (/ en ss lst ssall bbox) (vl-load-com) (setq oldclayer (getvar "clayer") oldcecolor (getvar "cecolor") ) (command "_clayer" "0") (command "_cecolor" "20") (command "plinewid" 100) (command "_pline") (while (= (getvar "cmdactive") 1) (command pause)) (setq en (entlast) (if (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) ) ) ) ) (command "_erase" en "") (setvar "clayer" oldclayer) (setvar "cecolor" oldcecolor) (command "plinewid" 0) ) (princ "\nType OCD")
Stephen
Last edited by rkmcswain; 2019-05-10 at 02:42 PM.
Here's one I came across a few years ago.
Hope this helps
John
Sorry, just realised it only does rectangles.............
Not much help then.
>stephen.coff
Your error here: (setq en (entlast)Code:;Required Express tools ;Erases Everything OutSide Contour Delete with Extrim (defun C:OCD (/ en ss lst ssall bbox *error* oldclayer oldcecolor opw) (defun *error* (msg)(princ msg) (setvar "clayer" oldclayer) (setvar "plinewid" opw)(setvar "cecolor" oldcecolor) (vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object)))) (vl-load-com) (setq oldclayer (getvar "clayer") opw (getvar "plinewid") oldcecolor (getvar "cecolor") ) (vla-StartUndoMark (vla-get-activedocument (vlax-get-acad-object))) (setvar "clayer" "0") (setvar "cecolor" "20") (setvar "plinewid" 100)(setvar "cmdecho" 1) (command "_pline") (while (> (getvar "CMDACTIVE") 0)(command pause)) (setq en (entlast)) (if (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) ) ) ) ) (command "_erase" en "") (setvar "clayer" oldclayer) (setvar "plinewid" opw)(setvar "cecolor" oldcecolor) (vla-EndUndoMark (vla-get-activedocument (vlax-get-acad-object))) (princ) ) (princ "\nType OCD")
It is necessary: (setq en (entlast))