.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to delete overlap entity in drawing ?

3 REPLIES 3
Reply
Message 1 of 4
varadan01
501 Views, 3 Replies

how to delete overlap entity in drawing ?

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
3 REPLIES 3
Message 2 of 4
Alfred.NESWADBA
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 😉

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 4
varadan01
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
Message 4 of 4
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost