.NET

Reply
Active Contributor
varadan01
Posts: 47
Registered: ‎03-16-2012
Message 1 of 4 (189 Views)

how to delete overlap entity in drawing ?

189 Views, 3 Replies
12-02-2012 10:53 PM

Can any one tell how to delete overlap enities in drawing?

plz provide sample code if you have.

 

here i attached the dwg file

With Regards,
GVaradarajan
*Expert Elite*
Alfred.NESWADBA
Posts: 9,399
Registered: ‎06-29-2007
Message 2 of 4 (179 Views)

Re: how to delete overlap entity in drawing ?

12-03-2012 01:49 AM in reply to: varadan01

Hi,

 

if that often happens: Map3D (and so Civil3D) has the function _MAPCLEAN (>>>details<<<) that does data preparation for GIS. So if that is your daily work, multiple times a day, think about it (or if you already have it ==> use it).

 

If you have to develop it for yourself it's first important to know what type of geometry you may receive in the drawings. Just straight lines or straight polyline-segments will by done with getting endpoints/vertices for one entitiy and look what other objects are there (and then verify if they are parallel). split this other object at this point, if it's no endpoint.

If you have polyline with curve-fit/splined or splines or arcs and circles it's more geometric calculation then and not as easy :smileywink:

 

Good luck, - alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Active Contributor
varadan01
Posts: 47
Registered: ‎03-16-2012
Message 3 of 4 (176 Views)

Re: how to delete overlap entity in drawing ?

12-03-2012 01:57 AM in reply to: Alfred.NESWADBA

if i tried to take each and every geomentry entities in drawing..tht became TDS..i got OVERKILL command in AUTOCAD..i dont how they done programaticaly..Overkilll command not working for blockreference and hatch edits etc..

With Regards,
GVaradarajan
*Expert Elite*
_gile
Posts: 2,114
Registered: ‎04-29-2006
Message 4 of 4 (168 Views)

Re: how to delete overlap entity in drawing ?

12-03-2012 02:54 AM in reply to: varadan01

Hi,

 

To compare BlockReference, you can compare the block name, the block geometry using the BlockTransform matrix and if needed the attribute collection.

For dynamic blocks, you'd have to compare the blocks 'effective names" and the dynamic properties values too.

 

Here's a little example of methods which can be used to compare non-dynamic attributed blocks.

These methods have to be called from a transaction.

a Tolerance can be used with the Matrix3d.IsEqualTo() method.

 

        private Dictionary<string, string> GetAttributesValues(BlockReference br)
        {
            Dictionary<string, string> retVal = new Dictionary<string, string>();
            foreach (ObjectId id in br.AttributeCollection)
            {
                AttributeReference attRef = (AttributeReference)id.GetObject(OpenMode.ForRead);
                retVal.Add(attRef.Tag, attRef.TextString);
            }
            return retVal;
        }

        private bool Overlap(BlockReference br1, BlockReference br2)
        {
            return 
                br1.Name == br2.Name &&
                br1.BlockTransform.IsEqualTo(br2.BlockTransform) &&
                GetAttributesValues(br1).SequenceEqual(GetAttributesValues(br2));
        }

 

Gilles Chanteau
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!