Editing Overlapping Objects

Editing Overlapping Objects

Anonymous
Not applicable
4,198 Views
19 Replies
Message 1 of 20

Editing Overlapping Objects

Anonymous
Not applicable

Hello all,

I am getting drawings from clients that have hundreds of closed polylines (typically rectangles) that are supposed to be snapped together in a grid pattern.  When I grab one rectangle by the end poitn and snap it to the next rectangles corner autocad says they are exact.  My problem is that this is not always the case.  

 

Sometimes I zoom in and the two rectangles are overlapping by 0.0001".  This distance may seem insignificant but it breaks down my import process into another program.  I can't use the overkill command because that will delete one of the duplicates and I need these polylines whole and intact.  I can move the rectangles manually but when I am looking at 500+ booths most of which are fine, that isn't a great option.  I am wondering if there is any other tools that I am missing that would fix this issue.  

 

Any ideas are welcome.

 

Thank you,

Alex

0 Likes
4,199 Views
19 Replies
Replies (19)
Message 2 of 20

imadHabash
Mentor
Mentor

Hi and Welcome to AutoDesk Forum,

 

>> Sometimes I zoom in and the two rectangles are overlapping by 0.0001"<< 

If your issue is related to non exact overlapping rectangles then you have to do it manually.and there is no tool exist that make these shapes exactly overlapped.

 

Regards,

Imad Habash

EESignature

0 Likes
Message 3 of 20

dgorsman
Consultant
Consultant

Could you supply a small sample drawing, so we can see exactly where the problem lies?

 

Unfortunately if things are effectively randomly placed there is only one tool I can think of: submit an NCR (non-conformance report) to those supplying the drawing.  If they were supposed to give you something with specific criteria and failed to do so, then it's on them to fix it.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 4 of 20

steven-g
Mentor
Mentor

As accurate as Autocad is I often used to find these little errors, usually with drawings from other people, lines would be 123.0002, rectangles would have one corner being not quite perpendicular, no idea what the cause would have been, but with so many different programs using the dwg format it's no real surprise that errors creep in. But I would just point out that you should keep an eye on your snap settings, turn off object snap tracking unless you need it, turn off the snaps to intersection, apparent intersection, nearest, extension, nodes etc, only use the barest minimum for what you need, and learn the command modifiers so you can choose an odd snap whilst running a command. Since I started doing this I seldom notice getting into problems.

Message 5 of 20

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... 

Sometimes I zoom in and the two rectangles are overlapping by 0.0001".  ....  I can move the rectangles manually but when I am looking at 500+ booths most of which are fine, that isn't a great option.  I am wondering if there is any other tools that I am missing that would fix this issue.  

 

....

Welcome to these Forums!

 

There are tools for this, i.e. routines on these Forums and elsewhere to force all defining points of objects to lie on positional-snap locations of whatever precision you desire.  You could have all rectangle corners forced to the nearest whole unit, or to the nearest 0.01-unit-multiple position, or....  Search for terms like force, snap, grid, etc.  If I find some I'll come back, but you may beat me to it.

 

EDIT: Here's one.

Kent Cooper, AIA
Message 6 of 20

Anonymous
Not applicable

@Kent1Cooper wrote:

Welcome to these Forums!

 

There are tools for this, i.e. routines on these Forums and elsewhere to force all defining points of objects to lie on positional-snap locations of whatever precision you desire.  You could have all rectangle corners forced to the nearest whole unit, or to the nearest 0.01-unit-multiple position, or....  Search for terms like force, snap, grid, etc.  If I find some I'll come back, but you may beat me to it.


Exactly, this is what I am looking for.  I have been through several different iterations of search terms.  I haven't been able to find anything useful which is why I have resorted to posting myself.  

 

Since I have you here--Is there a way for me to alter autocad's tolerance levels?  both drawing tolerances and/ or snap tolerances?

0 Likes
Message 7 of 20

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

 

Exactly, this is what I am looking for.  I have been through several different iterations of search terms.  I haven't been able to find anything useful which is why I have resorted to posting myself.  

Since I have you here--Is there a way for me to alter autocad's tolerance levels?  both drawing tolerances and/ or snap tolerances?


In case you didn't catch my later Edit of my Reply, there's now a link there to one such routine.

 

You can set Snap to any value you want, but whether that helps keep your drawings precise depends on whether you remember to have it turned on as you draw.  You can set the display-rounding precision in the UNITS command to whatever you want [within the choices offered -- in decimal units, it won't go down further than 8 decimal places in display, though it actually knows where things are down to something like 16 significant figures].

Kent Cooper, AIA
0 Likes
Message 8 of 20

Anonymous
Not applicable

@Kent1Cooper wrote:

 

In case you didn't catch my later Edit of my Reply, there's now a link there to one such routine.

You can set Snap to any value you want, but whether that helps keep your drawings precise depends on whether you remember to have it turned on as you draw.  You can set the display-rounding precision in the UNITS command to whatever you want [within the choices offered -- in decimal units, it won't go down further than 8 decimal places in display, though it actually knows where things are down to something like 16 significant figures].


Ok cool.  I am still relatively new to the world of LISP writing so it's hard for me to see what is going on in that code.  The problem that thread was addressing though was rotational angle of lines though, right?  I need the angle of all of my polylines to remain constant I just need to move any overlapping polylines to be exactly overlapping (drawn on top of each other) rather than overlapping by fractions....i've attached some pictures of what i mean.

0 Likes
Message 9 of 20

Kent1Cooper
Consultant
Consultant

If they're not always orthogonally oriented, then that routine is probably not what you want.  [Even though Lines were the original topic of that thread, the routine is built to work with more than that, although I haven't actually loaded it and tried it.]

 

If it's possible to make a routine that would do what you want, the question that comes to mind for me is how it should determine which Polyline to adjust in places where they don't meet exactly.

Kent Cooper, AIA
0 Likes
Message 10 of 20

Anonymous
Not applicable

@Kent1Cooper wrote:

If they're not always orthogonally oriented, then that routine is probably not what you want.  [Even though Lines were the original topic of that thread, the routine is built to work with more than that, although I haven't actually loaded it and tried it.]

 

If it's possible to make a routine that would do what you want, the question that comes to mind for me is how it should determine which Polyline to adjust in places where they don't meet exactly.


And that is the question i've been asking myself for a while as well... there are a few solutions i've toyed with.  one of my ideas is that the lisp program could run from right to left (or left to right) and select the first polyline it comes across as the basis for the function and adjust every other poly line to not overlap.  then it would use the second poly line, repeat.  then the third, ect....as long as it is continuously moving the polylines in the same direction it would take care of the overlap (though it may be moving the booths where i don't want them, but that's a separate issue, if i can remove the overlap that would be a huge step forward)....

 

another idea was to just run the lisp and have it identify every coplanar polyline overlap in the drawing and then add some sort of identifier on a unique layer....so i run the command it searches out any overlap and then throws up a red circle over the offended elements....then i would just have to fix them manually but i would be able to find them.  autocad already has the tspaceinvaders tool that does something similar to this but it only works for text objects and not for polylines...

 

no matter how the tool works, in order to be useful it would need to be able to see down to four or five decimal places...otherwise it would say that nothing is overlapping or everything is overlapping which puts me back to square one.

0 Likes
Message 11 of 20

dgorsman
Consultant
Consultant

There is a difference between code and display when dealing with coordinates and values.  In the display, the display precision determines what you see.  In code, it is always precise down to the system precision.  So a line with a length of 1.00000001 may display a length of 1.0 when set to a single decimal place, but in code will always be treated as the actual value.

 

Now since you are dealing with non-orthogonal lines compared to the WCS, and all coordinates are stored in WCS coordinates, you may find some small-precision errors creep in with calculations due to the math involved.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 12 of 20

Anonymous
Not applicable

@dgorsman wrote:

There is a difference between code and display when dealing with coordinates and values.  In the display, the display precision determines what you see.  In code, it is always precise down to the system precision.  So a line with a length of 1.00000001 may display a length of 1.0 when set to a single decimal place, but in code will always be treated as the actual value.

 

Now since you are dealing with non-orthogonal lines compared to the WCS, and all coordinates are stored in WCS coordinates, you may find some small-precision errors creep in with calculations due to the math involved.


and autocad doesn't have a tool or a lisp or any way of killing these rounding errors after they are created other than manually moving every individual point?

 

all of my lines are in exact increments of 10'.  i don't need the lines to be any fraction more or less than that and if they are it isn't that big of a deal but if they overlap it kills me...

0 Likes
Message 13 of 20

dgorsman
Consultant
Consultant

That's a combination of grid-snap settings, osnap settings, and use of the program.  If the user enters a line length of 10 units it will be 10 units, not 10.000001.  If the user uses END osnap to place the ends precisely on points that are 10.000001 units apart, then that's what the length will be.  A lot of that comes down to use of the program - use it right and you get the desired results.  Hence the suggestion to NCR the originator if they didn't meet the specified criteria.

 

This is also why those with specific design criteria use things like blocks (dynamic or otherwise) and automation.  If you have standard 10 foot, 15 foot, and 23 foot booths then you create a block for each, so every one is EXACTLY the size it should be regardless of rotation.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 14 of 20

Anonymous
Not applicable

To be blunt, the problem isn't rounding errors but drafting errors.  The application is accurate, but garbage in is garbage out.  Those overlaps were caused by poorly placing elements, most probably due to a running OSNAP that included NEAREST or snapping perpendicular to something that wasn't quite perpendicular.  All it takes is one bogus placement and any copy/move/array/rotate/etc. that uses one of the bogus points will propagate the error over the entire file.

 

I rarely use running OSNAPs unless I know I'm going to be using a lot a one particular OSNAP.  Drawing in feet-inches I set my units to ENGINEERING (3) and the precision (LPREC) to 8, and I've redefined the ID function to return 16 decimal places without scientific notation (several in fact). 

 

 

0 Likes
Message 15 of 20

Anonymous
Not applicable

@Anonymous wrote:

To be blunt, the problem isn't rounding errors but drafting errors.  The application is accurate, but garbage in is garbage out.  Those overlaps were caused by poorly placing elements, most probably due to a running OSNAP that included NEAREST or snapping perpendicular to something that wasn't quite perpendicular.  All it takes is one bogus placement and any copy/move/array/rotate/etc. that uses one of the bogus points will propagate the error over the entire file.

 

I rarely use running OSNAPs unless I know I'm going to be using a lot a one particular OSNAP.  Drawing in feet-inches I set my units to ENGINEERING (3) and the precision (LPREC) to 8, and I've redefined the ID function to return 16 decimal places without scientific notation (several in fact). 

 

 


I don't dispute any of that...the question is what is the easiest way to go about fixing it.  I don't know how my clients created it, though you're probably right, nearest snap probably had somethign to do with it.

 

I feel like autocad should have some way to clean this up with a few clicks as opposed to the old scrap-it-and-redo-it method

0 Likes
Message 16 of 20

Anonymous
Not applicable

Here's a LISP routine that checks for overlapping polylines.

It does not correct them, but shows you where they overlap.

 

Be SURE you create a layer with a vey distinctive color and have that layer active before you start the routine.

 

The routine will create a region on this layer showing you where the overlap is.

You would then correct the overlap and then delete the region.

 

I use this on a daily basis.....Worth a try !!!

 

 

;| PolylineOverlap.lsp
Determines whether two polylines in the same plane overlap
by turning copies of both into regions and subtracting one
from the other to see if its area changes.

If so, creates a region showing the overlap and zooms in on it.

Works with either heavy or LW polylines, and checks that they are closed
and co-planar. Aborts if either polyline is self-intersecting.

by Bill Gilliss
bill at realerthanreal dot com
Comments and suggestions always welcome.

No warranty, either expressed or implied, is made as to the fitness of
this information for any particular purpose.   All materials are to be
considered 'as-is' and use thereof should be considered as at your own
risk.

v 1.0  2010-03-01 - initial release in response to newsgroup request
======================================================================
|;

(defun c:polyOverlap ( / e1 en1 ed1 obj1 area1 elev1 extr1
                         e2 en2 ed2 obj2 area2 elev2 extr2
                         area3 olderror *delobj obj
                         reg1 reg1b reg1c reg1d reg1created
                         reg2 reg2b reg2c reg2d reg2created
                         getPoly1 getPoly2 makeReg1 makeReg2 findOverlap
                         )

;;============== SUBROUTINES =========================
(defun myerror (msg)
  (princ msg)
  (if reg1created (command "._erase" reg1 ""))
  (setvar 'delobj *delobj)
  (setvar 'cmdecho *cmdecho)
  (setq *error* olderror)
  )

;;====================================
(defun getPoly1 ()
  (setq en1 nil)
  (while
    (not en1)
    (prompt "Select first polyline: ")
    (setq ss (ssget ":S" '(( 0 . "POLYLINE,LWPOLYLINE"))))
    (if ss (setq en1 (ssname ss 0)))
    )
  (setq ed1 (entget en1))
  (if (/= 1 (logand (cdr (assoc 70 ed1)) 1))
    (progn
      (vlr-beep-reaction)
      (princ "Polyline is not closed.")
      (quit)
      )
    )
    (if (= (cdr (assoc 0 ed1)) "POLYLINE")
      (setq elev1 (caddr (cdr (assoc 10 ed1))))     ;; heavy polyline
      (setq elev1 (cdr (assoc 38 ed1)))             ;; LWPolyline
      )
  (setq extr1 (cdr (assoc 210 ed1)))
)

;;====================================
(defun makeReg1 ()
  (setq prevEnt (entlast))
  (command "region" en1 "")
  (setq newEnt (entlast))
  (if (not (equal prevEnt newEnt))  ;;verify region created successfuly
      (progn
        (setq reg1 (entlast))
        (setq reg1Created T)
        )
      (progn
        (princ "Problem with polyline - self-intersecting?\n")
        (vlr-beep-reaction)
        (quit)
        )
      )
  (setq ed1 (entget reg1))
  (setq area1 (vlax-get-property (vlax-ename->vla-object reg1) "Area"))
)

;;====================================
(defun getPoly2 ()
  (setq en2 nil)
  (while
    (not en2)
    (prompt "Select second polyline: ")
    (setq ss (ssget ":S" '(( 0 . "POLYLINE,LWPOLYLINE"))))
    (if ss (setq en2 (ssname ss 0)))
    )
  (setq ed2 (entget en2))
  (if (/= 1 (logand (cdr (assoc 70 ed2)) 1))
    (progn
      (vlr-beep-reaction)
      (princ "Polyline is not closed.")
      (quit)
      )
    )
  (if (= (cdr (assoc 0 ed2)) "POLYLINE")
    (setq elev2 (caddr (cdr (assoc 10 ed2))))     ;; heavy polyline
    (setq elev2 (cdr (assoc 38 ed2)))             ;; LWPolyline
    )
  (setq extr2 (cdr (assoc 210 ed2)))
)

;;====================================
(defun makeReg2 ()
  (setq prevEnt (entlast))
  (command "region" en2 "")
  (setq newEnt (entlast))
  (if (not (equal prevEnt newEnt))
      (progn
        (setq reg2 (entlast))
        )
      (progn
        (princ "Problem with polyline - self-intersecting?\n")
        (vlr-beep-reaction)
        (quit)
        )
      )
  (setq ed2 (entget reg2))
  (setq area2 (vlax-get-property (vlax-ename->vla-object reg2) "Area"))
  )


;;====================================
(defun findOverlap ()
  (entmake ed1)
  (setq reg1b  (entlast))
  (entmake ed2)
  (setq reg2b (entlast))
  (command "._subtract" reg2b "" reg1b "")

  (entmake ed1)
  (setq reg1c (entlast))
  (entmake ed2)
  (setq reg2c (entlast))
  (command "._subtract" reg1c "" reg2c "")

  (entmake ed1)
  (setq reg1d (entlast))
  (entmake ed2)
  (setq reg2d (entlast))
  (command "._union" reg1d reg2d "")
  (command "._union" reg2b reg1c "")

  (command "._subtract" reg1d "" reg2b "") ;;region of intersection
  (command "._change" reg1d "" "_prop" "_color" 6 "")
  (princ "\nPolylines DO overlap.")
  (setq overlapRegion (vlax-ename->vla-object reg1d))
  (vlax-invoke-method overlapRegion "getboundingbox" 'minA 'maxA)
  (setq LL (trans (vlax-safearray->list minA) 0 1) UR (trans (vlax-safearray->list maxA) 0 1))
  (command "._zoom" "_Window" LL UR)
  (command "._zoom" "0.25x")
  )


;;============= MAIN PROGRAM ===========================
  (setq olderror *error*)
  (setq *error* myerror)
  (setq *delobj (getvar 'delobj)) (setvar 'delobj 0)
  (setq *cmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0)
  (vl-load-com)

  (getPoly1)
  (makeReg1)
  (getPoly2)
  (makeReg2)

  (if (and (equal elev1 elev2) (equal extr1 extr2)) ;;co-planar
    (progn
      (command "._subtract" reg1 "" reg2 "")
      (setq area3 (vlax-get-property (vlax-ename->vla-object reg1) "Area"))
      (if (= area1 area3)
          (progn
            (princ "\n ----Polylines do NOT overlap -----")
            (vlr-beep-reaction)
            )
          (findOverlap)        ;; show overlap with new region
        )
    )
    (progn
      (vlr-beep-reaction)
      (princ "Polylines are not at same elevation or in same UCS.")
      (quit)
      )
     )

  (if reg1created (command "erase" reg1 ""))
  (setvar 'delobj *delobj)
  (setvar 'cmdecho *cmdecho)
  (setq *error* olderror)

(princ)
);; end polyOverlap

(princ "POLYOVERLAP loaded.")
(princ)
Message 17 of 20

Anonymous
Not applicable

There's no magic bullet to fix sloppy drafting, there's no real way to know which way is the fix, move the left one or the right?? move the entire pline or just stretch a vertex?? stretch one vertex on one pline and a different one on the next??  The best way to fix sloppy drafting is don't do it to start with.  

 

If the client is sending you sloppy drafting then he'll get the same sloppy drafting returned and you need to make sure he knows where the fault lies. "Hey, Mr. Client, you know the corners on your file are congruent, I could fix it for a fee if you like?" 

0 Likes
Message 18 of 20

Anonymous
Not applicable

@Anonymous wrote:

Here's a LISP routine that checks for overlapping polylines.

It does not correct them, but shows you where they overlap.

 

Be SURE you create a layer with a vey distinctive color and have that layer active before you start the routine.

 

The routine will create a region on this layer showing you where the overlap is.

You would then correct the overlap and then delete the region.

 

I use this on a daily basis.....Worth a try !!!

 

 

;| PolylineOverlap.lsp
Determines whether two polylines in the same plane overlap
by turning copies of both into regions and subtracting one
from the other to see if its area changes.

If so, creates a region showing the overlap and zooms in on it.

Works with either heavy or LW polylines, and checks that they are closed
and co-planar. Aborts if either polyline is self-intersecting.

by Bill Gilliss
bill at realerthanreal dot com
Comments and suggestions always welcome.

No warranty, either expressed or implied, is made as to the fitness of
this information for any particular purpose.   All materials are to be
considered 'as-is' and use thereof should be considered as at your own
risk.

This is almost exactly what I am looking for!!  I've loaded it, and it works exactly as advertised.  Is there any way to run this en-masse?  This lisp currently checks 2 polylines against each other to see if there is any overlap.  is there any way it could do the same process but check every polyline that is currently turned on?  the reason i ask is that there are approximately 800 booths in any given drawing.  this lisp is great but it would only allow me to check them one at a time.

 

Thank you for this lisp regardless though!! 🙂 

0 Likes
Message 19 of 20

Anonymous
Not applicable

Hello I'm new to this forum, student Civil engineering at Hanze Hogeschool Groningen. I found this LISP useful but I looking for an extra function.

 

My issue:

When there are multiple overlapping polylines and you want check in one go where these polylines overlap. Does anyone know how to adjust the LISP file or add the correct command lines to make it work ?

 

I hope someone can help me out.

 

Regards

Jeroen select autocad.pngresultaat.png

0 Likes
Message 20 of 20

Mistress0fTheDorkness
Collaborator
Collaborator

Lee Mac has a routine on his site that will do that. 

 

http://www.lee-mac.com/intersectionfunctions.html#intersectionsinset

 

The only downside is that if you have, as the example above gave, a bunch of polylines that are adjacent, it will flag not just the areas where they overlap, but, also the endpoints where there is a common snap location. 



Melanie Stone
Facilities Data Management
IWMS / CAFM / CMMS / AutoCAD / Archibus / Tririga / Planon / MRI Manhattan CenterStone / Revit / data normalization, data mapping, reporting and process documentation
mistressofthedorkness.blogspot.com/
0 Likes