Can any one tell how to delete overlap enities in drawing?
plz provide sample code if you have.
here i attached the dwg file
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 -
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..
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)); }