Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Erasing everything outside a boundary

  1. #1
    Member
    Join Date
    2016-01
    Posts
    43
    Login to Give a bone
    0

    Default Erasing everything outside a boundary

    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?

  2. #2
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    383
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    Simple way
    use "erase" "all" "remove" and then window the objects you do not want erased

  3. #3
    Member
    Join Date
    2016-01
    Posts
    43
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    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

  4. #4
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    383
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    have you tried using
    "erase" "All" "remove" "f"

    ?

  5. #5
    Woo! Hoo! my 1st post
    Join Date
    2006-02
    Posts
    1
    Login to Give a bone
    0

    Red face Re: Erasing everything outside a boundary

    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.



    Quote Originally Posted by Stephen.Walz
    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?

  6. #6
    Active Member
    Join Date
    2007-03
    Posts
    57
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    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")

  7. #7
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Re: Erasing everything outside a boundary

    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:

    ;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")


    Thank you
    Stephen

  8. #8
    100 Club
    Join Date
    2003-11
    Location
    Dublin, Ireland.
    Posts
    151
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    Here's one I came across a few years ago.

    Hope this helps

    John
    Attached Files Attached Files

  9. #9
    100 Club
    Join Date
    2003-11
    Location
    Dublin, Ireland.
    Posts
    151
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    Sorry, just realised it only does rectangles.............

    Not much help then.

  10. #10
    Active Member
    Join Date
    2007-03
    Posts
    57
    Login to Give a bone
    0

    Default Re: Erasing everything outside a boundary

    >stephen.coff
    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")
    Your error here: (setq en (entlast)
    It is necessary: (setq en (entlast))

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2012-03-29, 05:35 AM
  2. When erasing hatch boundary goes also.
    By jsnow in forum AutoCAD General
    Replies: 5
    Last Post: 2007-01-10, 08:17 AM
  3. erasing titles
    By tect75 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2006-03-20, 03:28 PM
  4. Erasing a selection set name
    By Coolmo in forum VBA/COM Interop
    Replies: 10
    Last Post: 2004-08-26, 09:17 PM
  5. Phase Erasing?
    By gregcashen in forum Revit Architecture - General
    Replies: 5
    Last Post: 2003-09-18, 07:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •