Jump to content

Erase objects outside of boundary ( polyline )


kasra

Recommended Posts

the last you posted was excelent. it works perfect in outside operation. but in inside operation, it looks that need some modification.

the clock in Here is 4:06 am .

I'm so tired and need sleeping. I 'll be back tomorrow.

good luck and have a nice day.

 

 

Dear Alan

I tested your last code on my example.dwg drawing.

It's operation for "outside" option is great and perfect.

 

this is reason that i think it needs some modification in option "inside":

- when user types "i" for "inside" option, the routine will trim all outside the closed polyline such as:lines,polylines,arc,... and erase all objects inside the closed polyline.

But i think the function for "inside" option should be such as following:

- when user types "i" for "inside" option, the routine should trim all inside the closed polyline such as:lines,polylines,arc,... and erase all objects inside the closed polyline.

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

  • kasra

    19

  • alanjt

    15

  • JamalNUMAN

    10

  • marko_ribar

    7

Top Posters In This Topic

Posted Images

It's still not perfect. It will ignore lines that are within, but touching PLine.

 

(defun c:EIO (/ *error* _p2ss _ext _Pnt cmd ucs o ent u ssIn ssOut)
 ;; Erase Inside/Outside of selected LWPolyline
 ;; If Express Tools' EXTrim is found/loaded, crossing object(s) will be trimmed
 ;; Alan J. Thompson, 04.02.10

 (vl-load-com)

 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
 (or *EIO:Opt* (setq *EIO:Opt* "Inside"))

 (defun *error* (#Message)
   (and ucs (vl-cmdf "_.ucs" "_p"))
   (and cmd (setvar 'cmdecho cmd))
   (and *AcadDoc* u (vla-endundomark *AcadDoc*))
   (and #Message
        (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " #Message))
   ) ;_ and
 ) ;_ defun

 (setq _p2ss (lambda (ename meth)
               (ssget meth
                      ((lambda (e / l)
                         (foreach x e (and (eq 10 (car x)) (setq l (cons (cdr x) l))))
                         l
                       ) ;_ lambda
                        (entget ename)
                      )
               ) ;_ ssget
             ) ;_ lambda
       _ext  (lambda (e p)
               (and (load "extrim.lsp" nil)
                    etrim
                    (not (etrim o (trans p 1 0)))
               ) ;_ and
             ) ;_ lambda

       _Pnt  (lambda (e s / e o l p)
               (setq e (vlax-ename->vla-object e))
               (setq p (vlax-curve-getendpoint
                         (caar (vl-sort
                                 (cons
                                   (cons e (vla-get-area e))
                                   (setq l (mapcar
                                             (function
                                               (lambda (# / o)
                                                 (if (setq
                                                       o
                                                        (car
                                                          (vlax-safearray->list
                                                            (vlax-variant-value (vla-offset e (* # 0.000001)))
                                                          ) ;_ vlax-safearray->list
                                                        ) ;_ car
                                                     ) ;_ setq
                                                   (cons o (vla-get-area o))
                                                 ) ;_ if
                                               ) ;_ lambda
                                             ) ;_ function
                                             '(-1. 1.)
                                           ) ;_ mapcar
                                   ) ;_ setq
                                 ) ;_ cons
                                 (function (lambda (a b) (s (cdr a) (cdr b))))
                               ) ;_ vl-sort
                         ) ;_ caar
                       ) ;_ vlax-curve-getendpoint
               ) ;_ setq
               (mapcar
                 (function (lambda (x) (vl-catch-all-apply (function vla-delete) (list (car x)))))
                 l
               ) ;_ mapcar
               p
             ) ;_ lambda
 ) ;_ setq



 (and (setq o (car (entsel "\nSelect LWPolyline: ")))
      (or (eq "LWPOLYLINE" (cdr (assoc 0 (setq ent (entget o)))))
          (alert "Invalid object!")
      ) ;_ or
      (not (initget 0 "Inside Outside"))
      (setq *EIO:Opt*
             (cond
               ((getkword (strcat "\nSpecify erase option [inside/Outside] <" *EIO:Opt* ">: ")))
               (*EIO:Opt*)
             ) ;_ cond
      ) ;_ setq
      (setq u (not (vla-startundomark *AcadDoc*)))

      (setq cmd (getvar 'cmdecho))
      (setvar 'cmdecho 0)
      (or (not (zerop (getvar 'worlducs)))
          (setq ucs (vl-cmdf "_.ucs" ""))
      ) ;_ or

      (cond
        ((eq *EIO:Opt* "Inside")
         (_ext o (_pnt o <))
         (and (setq ssIn (_p2ss o "_WP"))
              ((lambda (i)
                 (while (setq e (ssname ssIn (setq i (1+ i))))
                   (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )

        ((eq *EIO:Opt* "Outside")
         (_ext o (_pnt o >))
         (and (setq ssIn  (_p2ss o "_CP")
                    ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
              ) ;_ setq
              ((lambda (i)
                 (while (setq e (ssname ssOut (setq i (1+ i))))
                   (if ssIn
                     (or (ssmemb e ssIn) (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                     (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                   ) ;_ if
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )
      ) ;_ cond
 ) ;_ and
 (*error* nil)
 (princ)
) ;_ defun

Link to comment
Share on other sites

  • 3 years later...
It's still not perfect. It will ignore lines that are within, but touching PLine.

 

(defun c:EIO (/ *error* _p2ss _ext _Pnt cmd ucs o ent u ssIn ssOut)
 ;; Erase Inside/Outside of selected LWPolyline
 ;; If Express Tools' EXTrim is found/loaded, crossing object(s) will be trimmed
 ;; Alan J. Thompson, 04.02.10

 (vl-load-com)

 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
 (or *EIO:Opt* (setq *EIO:Opt* "Inside"))

 (defun *error* (#Message)
   (and ucs (vl-cmdf "_.ucs" "_p"))
   (and cmd (setvar 'cmdecho cmd))
   (and *AcadDoc* u (vla-endundomark *AcadDoc*))
   (and #Message
        (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " #Message))
   ) ;_ and
 ) ;_ defun

 (setq _p2ss (lambda (ename meth)
               (ssget meth
                      ((lambda (e / l)
                         (foreach x e (and (eq 10 (car x)) (setq l (cons (cdr x) l))))
                         l
                       ) ;_ lambda
                        (entget ename)
                      )
               ) ;_ ssget
             ) ;_ lambda
       _ext  (lambda (e p)
               (and (load "extrim.lsp" nil)
                    etrim
                    (not (etrim o (trans p 1 0)))
               ) ;_ and
             ) ;_ lambda

       _Pnt  (lambda (e s / e o l p)
               (setq e (vlax-ename->vla-object e))
               (setq p (vlax-curve-getendpoint
                         (caar (vl-sort
                                 (cons
                                   (cons e (vla-get-area e))
                                   (setq l (mapcar
                                             (function
                                               (lambda (# / o)
                                                 (if (setq
                                                       o
                                                        (car
                                                          (vlax-safearray->list
                                                            (vlax-variant-value (vla-offset e (* # 0.000001)))
                                                          ) ;_ vlax-safearray->list
                                                        ) ;_ car
                                                     ) ;_ setq
                                                   (cons o (vla-get-area o))
                                                 ) ;_ if
                                               ) ;_ lambda
                                             ) ;_ function
                                             '(-1. 1.)
                                           ) ;_ mapcar
                                   ) ;_ setq
                                 ) ;_ cons
                                 (function (lambda (a b) (s (cdr a) (cdr b))))
                               ) ;_ vl-sort
                         ) ;_ caar
                       ) ;_ vlax-curve-getendpoint
               ) ;_ setq
               (mapcar
                 (function (lambda (x) (vl-catch-all-apply (function vla-delete) (list (car x)))))
                 l
               ) ;_ mapcar
               p
             ) ;_ lambda
 ) ;_ setq



 (and (setq o (car (entsel "\nSelect LWPolyline: ")))
      (or (eq "LWPOLYLINE" (cdr (assoc 0 (setq ent (entget o)))))
          (alert "Invalid object!")
      ) ;_ or
      (not (initget 0 "Inside Outside"))
      (setq *EIO:Opt*
             (cond
               ((getkword (strcat "\nSpecify erase option [inside/Outside] <" *EIO:Opt* ">: ")))
               (*EIO:Opt*)
             ) ;_ cond
      ) ;_ setq
      (setq u (not (vla-startundomark *AcadDoc*)))

      (setq cmd (getvar 'cmdecho))
      (setvar 'cmdecho 0)
      (or (not (zerop (getvar 'worlducs)))
          (setq ucs (vl-cmdf "_.ucs" ""))
      ) ;_ or

      (cond
        ((eq *EIO:Opt* "Inside")
         (_ext o (_pnt o <))
         (and (setq ssIn (_p2ss o "_WP"))
              ((lambda (i)
                 (while (setq e (ssname ssIn (setq i (1+ i))))
                   (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )

        ((eq *EIO:Opt* "Outside")
         (_ext o (_pnt o >))
         (and (setq ssIn  (_p2ss o "_CP")
                    ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
              ) ;_ setq
              ((lambda (i)
                 (while (setq e (ssname ssOut (setq i (1+ i))))
                   (if ssIn
                     (or (ssmemb e ssIn) (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                     (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                   ) ;_ if
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )
      ) ;_ cond
 ) ;_ and
 (*error* nil)
 (princ)
) ;_ defun

 

 

 

Hi Luminous,

 

Please, have a look on the attached screenshots.

 

The lisp file erase incorrectly!

 

It should first break all objects intersecting with the polyline

Then to erase all objects inside/outside the polyline

 

 

What might be wrong with the lisp file code?

 

 

 

Clip_778.jpg

 

Thank you

 

Best

 

Jamal

 

pencil.png

Clip_776.jpg

Clip_778.jpg

Clip_777.jpg

Link to comment
Share on other sites

For the sake of beauty of code, change this letter "o" to "e" - its only mistake I've found...

 _ext  (lambda (e p)                 
             (and (load "extrim.lsp" nil)                      
                  etrim                      
                  (not (etrim [color=red]e[/color] (trans p 1 0)))
             ) ;_ and
        ) ;_ lambda 

Also, I suggest that you change "_CP" filter to "_WP" filter in condition for "Outside" option...

        ((eq *EIO:Opt* "Outside")
          (_ext o (_pnt o >))
          (and (setq ssIn  (_p2ss o [color=red]"_WP"[/color])
                     ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
               ) ;_ setq 

As I don't get wrong results with and original and my modified version of Alan's code, you may want to check extrim.lsp in your Express subfolder, as I modified it just a little with line :

(while (> (getvar 'cmdactive) 0) (command ""))

after line where command COPY is used incorrectly without ending "" syntax inside (command) function...

 

You can compare extrim.lsp here, and I don't think your showed error has to do something with it... It may be that your LWPOLYLINE isn't properly closed, or something similar...

 

M.R.

Link to comment
Share on other sites

For the sake of beauty of code, change this letter "o" to "e" - its only mistake I've found...

 _ext  (lambda (e p)                 
             (and (load "extrim.lsp" nil)                      
                  etrim                      
                  (not (etrim [color=red]e[/color] (trans p 1 0)))
             ) ;_ and
        ) ;_ lambda 

Also, I suggest that you change "_CP" filter to "_WP" filter in condition for "Outside" option...

        ((eq *EIO:Opt* "Outside")
          (_ext o (_pnt o >))
          (and (setq ssIn  (_p2ss o [color=red]"_WP"[/color])
                     ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
               ) ;_ setq 

As I don't get wrong results with and original and my modified version of Alan's code, you may want to check extrim.lsp in your Express subfolder, as I modified it just a little with line :

(while (> (getvar 'cmdactive) 0) (command ""))

after line where command COPY is used incorrectly without ending "" syntax inside (command) function...

 

You can compare extrim.lsp here, and I don't think your showed error has to do something with it... It may be that your LWPOLYLINE isn't properly closed, or something similar...

 

M.R.

 

Thank you very much marko_ribar for the answer,

 

Could you please drop me an integrated lisp file that does trim and erase objects inside/outside.

 

I replaced “O” by “e” but sounds that the lisp has still incorrect behavior!

 

Have you any idea where can I find a lisp that breaks objects at the intersecting points with a particular polygon and then erase objects inside/outside this polygon?

 

Best

 

Jamal

Link to comment
Share on other sites

Sorry, my mistake, Alan was right... It should be "_CP"...

 

        ((eq *EIO:Opt* "Outside")
           (_ext o (_pnt o >))
           (and (setq ssIn  (_p2ss o [color=red]"_CP"[/color])
                      ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
                ) ;_ setq

But, sometimes, it won't erase all the lines that are touching pline, after firstly used "Inside" option, and then "Outside"...

I don't know how to overcome this...

 

M.R.

Link to comment
Share on other sites

Here, I've modified it and it works just fine... Only limitation is that LWPOLYLINE must be polygonal, must not contain arcs...

 

So here is it :

 

(defun c:EIO (/ *error* _p2ss _ext _Pnt cmd ucs o o- ent u ssIn ssOut)
 ;; Erase Inside/Outside of selected LWPolyline
 ;; If Express Tools' EXTrim is found/loaded, crossing object(s) will be trimmed
 ;; Alan J. Thompson, 04.02.10

 (vl-load-com)

 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
 (or *EIO:Opt* (setq *EIO:Opt* "Inside"))

 (defun *error* (#Message)
   (and ucs (vl-cmdf "_.ucs" "_p"))
   (and cmd (setvar 'cmdecho cmd))
   (and *AcadDoc* u (vla-endundomark *AcadDoc*))
   (and #Message
        (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " #Message))
   ) ;_ and
 ) ;_ defun

 (setq _p2ss (lambda (ename meth)
               (ssget meth
                      ((lambda (e / l)
                         (foreach x e (and (eq 10 (car x)) (setq l (cons (cdr x) l))))
                         l
                       ) ;_ lambda
                        (entget ename)
                      )
               ) ;_ ssget
             ) ;_ lambda
       _ext  (lambda (e p)
               (and (load "extrim.lsp" nil)
                    etrim
                    (not (etrim e (trans p 1 0)))
               ) ;_ and
             ) ;_ lambda

       _Pnt  (lambda (e s / e o l p)
               (setq e (vlax-ename->vla-object e))
               (setq p (vlax-curve-getendpoint
                         (caar (vl-sort
                                 (cons
                                   (cons e (vla-get-area e))
                                   (setq l (mapcar
                                             (function
                                               (lambda (# / o)
                                                 (if (setq
                                                       o
                                                        (car
                                                          (vlax-safearray->list
                                                            (vlax-variant-value (vla-offset e (* # 0.001)))
                                                          ) ;_ vlax-safearray->list
                                                        ) ;_ car
                                                     ) ;_ setq
                                                   (cons o (vla-get-area o))
                                                 ) ;_ if
                                               ) ;_ lambda
                                             ) ;_ function
                                             '(-1. 1.)
                                           ) ;_ mapcar
                                   ) ;_ setq
                                 ) ;_ cons
                                 (function (lambda (a b) (s (cdr a) (cdr b))))
                               ) ;_ vl-sort
                         ) ;_ caar
                       ) ;_ vlax-curve-getendpoint
               ) ;_ setq
               (mapcar
                 (function (lambda (x) (vl-catch-all-apply (function vla-delete) (list (car x)))))
                 l
               ) ;_ mapcar
               p
             ) ;_ lambda
 ) ;_ setq



 (and (setq o (car (entsel "\nSelect LWPolyline: ")))
      (or (eq "LWPOLYLINE" (cdr (assoc 0 (setq ent (entget o)))))
          (alert "Invalid object!")
      ) ;_ or
      (not (initget 0 "Inside Outside"))
      (setq *EIO:Opt*
             (cond
               ((getkword (strcat "\nSpecify erase option [inside/Outside] <" *EIO:Opt* ">: ")))
               (*EIO:Opt*)
             ) ;_ cond
      ) ;_ setq
      (setq u (not (vla-startundomark *AcadDoc*)))

      (setq cmd (getvar 'cmdecho))
      (setvar 'cmdecho 0)
      (or (not (zerop (getvar 'worlducs)))
          (setq ucs (vl-cmdf "_.ucs" ""))
      ) ;_ or

      (cond
        ((eq *EIO:Opt* "Inside")
         (_ext o (_pnt o <))
         (command "_.offset" "_T" o "_non" (_pnt o <) "")
         (setq o- (entlast))
         (and (setq ssIn (_p2ss o- "_CP"))
              (ssadd o- ssIn)
              ((lambda (i)
                 (while (setq e (ssname ssIn (setq i (1+ i))))
                   (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                 ) ;_ while
               ) ;_ lambda
               -1
              )
         ) ;_ and
        )

        ((eq *EIO:Opt* "Outside")
         (_ext o (_pnt o >))
         (command "_.offset" "_T" o "_non" (_pnt o <) "")
         (setq o- (entlast))
         (and (setq ssIn  (_p2ss o- "_CP")
                    ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
              ) ;_ setq
              (if ssIn (setq ssOut (acet-ss-remove ssIn ssOut)))
              ((lambda (i)
                 (while (setq e (ssname ssOut (setq i (1+ i))))
                   (or (eq e o) (vl-catch-all-apply (function entdel) (list e)))
                 ) ;_ while
               ) ;_ lambda
               -1
              )
              (entdel o-)
         ) ;_ and
        )
      ) ;_ cond
 ) ;_ and
 (*error* nil)
 (princ)
) ;_ defun

Hope, you'll be satisfied now...

M.R.8)

Edited by marko_ribar
Link to comment
Share on other sites

It's still not perfect. It will ignore lines that are within, but touching PLine.

 

(defun c:EIO (/ *error* _p2ss _ext _Pnt cmd ucs o ent u ssIn ssOut)
 ;; Erase Inside/Outside of selected LWPolyline
 ;; If Express Tools' EXTrim is found/loaded, crossing object(s) will be trimmed
 ;; Alan J. Thompson, 04.02.10

 (vl-load-com)

 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
 (or *EIO:Opt* (setq *EIO:Opt* "Inside"))

 (defun *error* (#Message)
   (and ucs (vl-cmdf "_.ucs" "_p"))
   (and cmd (setvar 'cmdecho cmd))
   (and *AcadDoc* u (vla-endundomark *AcadDoc*))
   (and #Message
        (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*"))
        (princ (strcat "\nError: " #Message))
   ) ;_ and
 ) ;_ defun

 (setq _p2ss (lambda (ename meth)
               (ssget meth
                      ((lambda (e / l)
                         (foreach x e (and (eq 10 (car x)) (setq l (cons (cdr x) l))))
                         l
                       ) ;_ lambda
                        (entget ename)
                      )
               ) ;_ ssget
             ) ;_ lambda
       _ext  (lambda (e p)
               (and (load "extrim.lsp" nil)
                    etrim
                    (not (etrim o (trans p 1 0)))
               ) ;_ and
             ) ;_ lambda

       _Pnt  (lambda (e s / e o l p)
               (setq e (vlax-ename->vla-object e))
               (setq p (vlax-curve-getendpoint
                         (caar (vl-sort
                                 (cons
                                   (cons e (vla-get-area e))
                                   (setq l (mapcar
                                             (function
                                               (lambda (# / o)
                                                 (if (setq
                                                       o
                                                        (car
                                                          (vlax-safearray->list
                                                            (vlax-variant-value (vla-offset e (* # 0.000001)))
                                                          ) ;_ vlax-safearray->list
                                                        ) ;_ car
                                                     ) ;_ setq
                                                   (cons o (vla-get-area o))
                                                 ) ;_ if
                                               ) ;_ lambda
                                             ) ;_ function
                                             '(-1. 1.)
                                           ) ;_ mapcar
                                   ) ;_ setq
                                 ) ;_ cons
                                 (function (lambda (a b) (s (cdr a) (cdr b))))
                               ) ;_ vl-sort
                         ) ;_ caar
                       ) ;_ vlax-curve-getendpoint
               ) ;_ setq
               (mapcar
                 (function (lambda (x) (vl-catch-all-apply (function vla-delete) (list (car x)))))
                 l
               ) ;_ mapcar
               p
             ) ;_ lambda
 ) ;_ setq



 (and (setq o (car (entsel "\nSelect LWPolyline: ")))
      (or (eq "LWPOLYLINE" (cdr (assoc 0 (setq ent (entget o)))))
          (alert "Invalid object!")
      ) ;_ or
      (not (initget 0 "Inside Outside"))
      (setq *EIO:Opt*
             (cond
               ((getkword (strcat "\nSpecify erase option [inside/Outside] <" *EIO:Opt* ">: ")))
               (*EIO:Opt*)
             ) ;_ cond
      ) ;_ setq
      (setq u (not (vla-startundomark *AcadDoc*)))

      (setq cmd (getvar 'cmdecho))
      (setvar 'cmdecho 0)
      (or (not (zerop (getvar 'worlducs)))
          (setq ucs (vl-cmdf "_.ucs" ""))
      ) ;_ or

      (cond
        ((eq *EIO:Opt* "Inside")
         (_ext o (_pnt o <))
         (and (setq ssIn (_p2ss o "_WP"))
              ((lambda (i)
                 (while (setq e (ssname ssIn (setq i (1+ i))))
                   (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )

        ((eq *EIO:Opt* "Outside")
         (_ext o (_pnt o >))
         (and (setq ssIn  (_p2ss o "_CP")
                    ssOut (ssget "_X" (list (cons 410 (getvar 'ctab))))
              ) ;_ setq
              ((lambda (i)
                 (while (setq e (ssname ssOut (setq i (1+ i))))
                   (if ssIn
                     (or (ssmemb e ssIn) (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                     (or (eq o e) (vl-catch-all-apply (function entdel) (list e)))
                   ) ;_ if
                 ) ;_ while
               ) ;_ lambda
                -1
              )
         ) ;_ and
        )
      ) ;_ cond
 ) ;_ and
 (*error* nil)
 (princ)
) ;_ defun

 

 

Many thanks alanjt,

 

Absolutely, it behaves unexpectedly!

 

Clip_790.jpg

 

May be it needs to be developed to break first all objects at the points of intersections with the polyline then to delete all objects inside the polygon

 

Best

 

Jamal

 

 

pencil.png

Clip_788.jpg

Clip_789.jpg

Clip_790.jpg

Link to comment
Share on other sites

I don't get it... It is using EXTRIM... I've changed Alanjt's code - look here...

 

I don't believe Alanjt is going to reply, because he didn't post here for long time...

 

Please, revise my version... I think it's working fine now...

 

Regards, M.R.

Link to comment
Share on other sites

I don't get it... It is using EXTRIM... I've changed Alanjt's code - look here...

 

I don't believe Alanjt is going to reply, because he didn't post here for long time...

 

Please, revise my version... I think it's working fine now...

 

Regards, M.R.

 

I was asking JumalNUMAN why not just use EXTRIM, since the example is trimming lines, which is NOT what the OP was asking "Erase Objects outside of boundary (Polyline)".

Link to comment
Share on other sites

I was asking JumalNUMAN why not just use EXTRIM, since the example is trimming lines, which is NOT what the OP was asking "Erase Objects outside of boundary (Polyline)".

 

 

Many thanks SLW210 for the answer,

 

The issue here is not to trim! It is to trim + erase

 

 

 

 

Extrim fails to do so!

 

 

 

Clip_793.jpg

 

 

Lisp file to

 

Trim (at polyline boundary) + Erase (inside/outside)

 

Or

 

Beak (at polyline boundary) + Erase (inside/outside)

 

Best

 

Jamal

Clip_792.jpg

Link to comment
Share on other sites

YOUR original examples do not indicate this.

 

The LISP by Alanjt is working on my computer, perhaps you can post YOUR file.

Link to comment
Share on other sites

YOUR original examples do not indicate this.

 

The LISP by Alanjt is working on my computer, perhaps you can post YOUR file.

 

Thanks SLW210,

 

The lisp file I’m using and the dwg are attached

 

The lisp file fails to erase objects inside the polygon in one hit

 

Best

 

Jamal

Clip_795.jpg

Clip_796.jpg

EIO.lsp

s.dwg

Link to comment
Share on other sites

I've tested your dwg and it is OK... EIO does just what it should do - I used my modified version - post #47... Modified it little more - it had some subfunction to erase 0 lines that were dummy objects left during my testing of earlier code... This is sufficient and I removed it... So check it now... It seems that your CAD isn't working correctly while using EXTRIM.LSP... If you still get this strange behavior, I just can't help... Check, your installation, or download EXTRIM.LSP that I've posted here...

 

Sincerely, M.R.

Link to comment
Share on other sites

I've tested your dwg and it is OK... EIO does just what it should do - I used my modified version - post #47... Modified it little more - it had some subfunction to erase 0 lines that were dummy objects left during my testing of earlier code... This is sufficient and I removed it... So check it now... It seems that your CAD isn't working correctly while using EXTRIM.LSP... If you still get this strange behavior, I just can't help... Check, your installation, or download EXTRIM.LSP that I've posted here...

 

Sincerely, M.R.

 

Sorry but sounds not to work! I tested it in AutoCAD 2014 that I have installed but with no luck

 

Clip_797.jpg

Link to comment
Share on other sites

You are right!

 

All what I needed to do is to replace the extrim.lsp that comes with the AutoCAD with the one you have provided. Then the EIO.lsp should work fine

 

Many thanks for the massive efforts

 

Best

 

Jamal

Link to comment
Share on other sites

I've tested your dwg and it is OK... EIO does just what it should do - I used my modified version - post #47... Modified it little more - it had some subfunction to erase 0 lines that were dummy objects left during my testing of earlier code... This is sufficient and I removed it... So check it now... It seems that your CAD isn't working correctly while using EXTRIM.LSP... If you still get this strange behavior, I just can't help... Check, your installation, or download EXTRIM.LSP that I've posted here...

 

Sincerely, M.R.

 

Sorry, I’m again in trouble!

The lisp file doesn’t erase automatically what is inside a polygon

Please, have a look on the attached dwg and screenshot

Best

Jamal

T14.dwg

Clip_882.jpg

Link to comment
Share on other sites

I overkilled some of your duplicate objects with fuzz 0.001, and changed line in EIO.lsp :

(vlax-variant-value (vla-offset e (* # 0.001)))

to

(vlax-variant-value (vla-offset e (* # [color=red]0.01[/color])))

And it worked fine - both options (Inside/Outside)... I'll attach your modified T14.dwg

 

Regards, M.R.

T14.dwg

Link to comment
Share on other sites

I overkilled some of your duplicate objects with fuzz 0.001, and changed line in EIO.lsp :

(vlax-variant-value (vla-offset e (* # 0.001)))

to

(vlax-variant-value (vla-offset e (* # [color=red]0.01[/color])))

And it worked fine - both options (Inside/Outside)... I'll attach your modified T14.dwg

 

Regards, M.R.

 

Many thanks Marko for the prompt help,

 

I replaced the 0.001 by 0.01, nevertheless, the lisp file doesn’t automatically delete what is inside the slected polygon.

 

Clip_890.jpg

 

 

The screenshot is attached

 

What might be the issue then?

 

Best

 

Jamal

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...