Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find Overlapping Text

12 REPLIES 12
Reply
Message 1 of 13
NewUser1
4954 Views, 12 Replies

Find Overlapping Text

Hi All,
What would be the ideal way to find out the overlapping text. Thanks in Advance....

Thanks & Regards
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: NewUser1

Hi NewUser1,
test this code maybe can help you.
[code]
; cdt is stand for Check Duplicate Text
; Design by : Adesu
; Email : mteybid@yuasabattery.co.id
; Homepage : http://www.yuasa-battery.co.id
; Create : 02 May 2007
; Program no.: 0571/05/2007
; Edit by :

(defun c:cdt (/ ep sp ss sse2 ssl ssn1 ssn2 th)
(princ "\nUse window to catch an object")
(if
(setq ss (ssget (list (cons 0 "TEXT"))))
(progn
(setq ssl (sslength ss))
(if
(= ssl 2)
(progn
(setq ssn1 (ssname ss 0))
(command "change" ssn1 "" "p" "c" 1 "")
(setq ssn2 (ssname ss 1))
(setq sse2 (entget ssn2))
(setq sp (cdr (assoc 10 sse2)))
(setq th (cdr (assoc 40 sse2)))
(setq ep (polar sp (* pi 1.5) th))
(command "change" ssn2 "" "p" "c" 2 "")
(command "_move" ssn2 "" sp ep "")
) ; progn
(alert "\nThat string over 2 entities")
) ; if
) ; progn
) ; if
(princ)
) ; defun


[/code]
wrote in message news:5606156@discussion.autodesk.com...
Hi All,
What would be the ideal way to find out the overlapping text.
Thanks in Advance....

Thanks & Regards
Message 3 of 13
bireshwar.mallick
in reply to: Anonymous

Can somebody suggest identifying overlapping text with objects in a different layer

Bireshwar
Message 4 of 13

What about the OVERKILL command , did you try it ?

Message 5 of 13
pbejse
in reply to: bireshwar.mallick


@bireshwar.mallick wrote:

Can somebody suggest identifying overlapping text with objects in a different layer


That is a strange code. Select on screen, then only if theres two object selected it will change the color and move the other one down . but in your case , all you wwant to is change the layer of the "overlap text".

 

What constitue an overlap?  Exact duplicate of the TEXT entity? i.e string/insertion point/ layer......

Message 6 of 13
bireshwar.mallick
in reply to: pbejse

Is there a tool or a lisp to identify the following overlaps in a different layer color for identification purpose (Not deleting the duplicates' by an  Overkill command) in a shop drawing using an entire window slection :-

1. Text with  text overlap

2. Text and object overlap

 

 

Bireshwar
Message 7 of 13


@bireshwar.mallick wrote:

Is there a tool or a lisp to identify the following overlaps in a different layer color for identification purpose (Not deleting the duplicates' by an  Overkill command) in a shop drawing using an entire window slection :-

1. Text with  text overlap

2. Text and object overlap


Wow....  That could be daunting.  The first thing that comes to mind is to find the bounding boxes of things and check whether any of their corners fall within the bounding boxes of other things.  That probably isn't too hard as an individual comparison, but you would have to check every single object against every other single object.  That could add up to a whole lot of comparisons.  And iffy possibilities come to mind -- for instance, in the attached image, would you consider the red Text object to "overlap" the yellow Line?  Their bounding boxes [blue] do overlap, but not their "content".  I guess there must be a way to determine whether the Line itself goes through the bounding box of the Text, but would the basis of comparison need to be something entirely different for different entity types?  What would you check for an Arc?  Etc., etc....

Kent Cooper, AIA
Message 8 of 13

Hi Kent Smiley Happy.. lets go for a particular case where we can identify text and object overlap.Is there a tool or a lisp.I am new to this issue.

Thanks and regards

Bireshwar

Bireshwar
Message 9 of 13


@bireshwar.mallick wrote:

....lets go for a particular case where we can identify text and object overlap.Is there a tool or a lisp....


Try putting overlap into the Search window.  A bunch of threads come up, some of which may have what you're after.  If they don't, I think the first order of business is to define exactly what constitutes "overlap" for your purposes [e.g. in my earlier image, do the Text and Line overlap?].

Kent Cooper, AIA
Message 10 of 13

Morning Kent!! yes in your attached image the line box and the text box do overlap.But what I am seeking is a tool that can resolve  the cases that I have attached showing basic cases of overlaps in CAD shopdrawings.

 

Thanks and good wishes

Bireshwar
Message 11 of 13


@bireshwar.mallick wrote:

....what I am seeking is a tool that can resolve  the cases that I have attached showing basic cases of overlaps in CAD shopdrawings.

....


As a starting point [requiring User selection of two objects, but the principle can be applied to any two, determined by whatever means], the following seems to identify the overlap in all the situations in your example:

 

(defun C:Overlap (/ o1 o2)
  (vl-load-com)
  (setq
    o1 (vlax-ename->vla-object (car (entsel "\nSelect first object: ")))
    o2 (vlax-ename->vla-object (car (entsel "\nSelect second object: ")))
  ); setq
  (prompt
    (strcat
      "\nThose two objects "
      (if
        (safearray-value (variant-value (vla-intersectwith o1 o2 acExtendNone)))
        "DO"
        "do NOT"
      ); if
      " overlap."
    ); strcat
  ); prompt
  (princ)
); defun

 

HOWEVER, it does not catch everything you might want to catch, and it might identify some things you wouldn't consider overlaps.

 

In the attached image, if we look only at bounding-box overlap as was my first thought, all of the white objects would be considered to overlap all of the other white objects.

 

The above code doesn't consider any of them to overlap except that it claims the Dimension overlaps the Line and the Circle, so in terms of the IntersectWith method, apparently Dimensions are considered in terms of their bounding boxes.  But only their bounding boxes' edges -- it doesn't consider the Dimension to overlap the white Text or the Leader, even though [or, because] they're fully inside its bounding box perimeter.  But if you move that Text or Leader down so that its bottom reaches the level of the left definition point of the Dimension, it does say they overlap, even though they're farther from what I would consider overlapping than they were before.

 

Similarly, it doesn't consider the green Text to overlap either the red Text or the yellow Line, because the edges of their bounding boxes don't cross each other, even though one is fully inside the other, which I would consider overlapping.  [It does say the yellow Line overlaps the red Text.]  Likewise, a Line fully inside a Circle is not considered to overlap, etc.

 

Another quirk is that with a Leader, IntersectWith seems to consider only the linear path, but not the arrowhead.  If I move the Text so that part of it extends into the arrowhead but not as far as the "line" part within that, the code doesn't consider them to overlap.

 

So I think to be conclusive, it will require something like this:

A)  Compare with the IntersectWith method above.  If that says they overlap, it seems they really do, except sometimes in the case of Dimensions that to some degree "wrap around" the extent of other objects.

B)  If that doesn't say they overlap, get their bounding boxes, determine which is smaller, and check whether all four of its corners lies inside the larger bounding box.  [You don't want to check whether just any corner lies within, or a lot of the white objects in the attached would be considered to overlap.]  Again, that could sometimes give a false reading with a Dimension [it would consider the Dimension and the white Text or Leader to overlap in the attached].

C)  If one of them is a Dimension or a Leader, some other kind of analysis could be required, but I'm having a hard time figuring out what that would be....

 

Anyway, do you think this is headed in the right direction?

Kent Cooper, AIA
Message 12 of 13
greg_battin
in reply to: NewUser1

don't forget the command TSPACEINVADERS...

http://autocadtips.wordpress.com/2010/12/03/tspaceinvaders/

 

~Greg

Message 13 of 13

Yea greg thanks a lot!! I had already used this command and made a tool bar corresponding to it.This command does gives a selection set  of all overlapped objects that we can put it in a separate layer as well we can zoom into particular entity for each overlap.

Thanks and regards,

Bireshwar

Bireshwar

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost