.NET

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

how to delete overlap entity in drawing ?

179 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: 8,982
Registered: ‎06-29-2007
Message 2 of 4 (169 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 (166 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,084
Registered: ‎04-29-2006
Message 4 of 4 (158 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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.