.NET

.NET

Reply
Active Contributor
47 Posts
0 Kudos
Registered: ‎03-16-2012
Post 1 of 4

how to delete overlap entity in drawing ?

201 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*
9,819 Posts
1,213 Kudos
Registered: ‎06-29-2007
Post 2 of 4

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
47 Posts
0 Kudos
Registered: ‎03-16-2012
Post 3 of 4

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*
2,141 Posts
254 Kudos
Registered: ‎04-29-2006
Post 4 of 4

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 interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!