My goal is to run my custom dll through AcCoreConsole and make various analysis on DWGs, such as expose Layer names and XY-coordinates on objects. I have managed to get all object in a selection set, and I can loop through the entities. When googling around a lot on this subject, I can't find any examples on how to extract coordinates from entities. I do understand that "coordinates" means different things whether it's a Circle or a Polyline for example.
Asked
Active
Viewed 771 times
1 Answers
2
After some more hours of googling, I found the answer. Simple use GeometricExtents to get a boundingbox fo each entity, then calculate the midpoint with some simple math.
try
{
var entExtent = ent.GeometricExtents;
var midpointX = (entExtent.MaxPoint.X+entExtent.MinPoint.X)/2;
var midpointY = (entExtent.MaxPoint.Y+entExtent.MinPoint.Y)/2;
}
catch
{
//edt.WriteMessage("\nGeometricExtents didn“t work on this entity");
}

SvantePanter
- 41
- 4