Hatch boundary tracing

SaddamShaikh77
Advocate
Advocate

Hatch boundary tracing

SaddamShaikh77
Advocate
Advocate

Hello forum,

I am trying to read hatches from the drawing and want to trace the boundary of each hatch.

This is my code.
foreach (SelectedObject acSSObj in acsSet)
{
Entity acEnt = (Entity)acTrans.GetObject(acSSObj.ObjectId, OpenMode.ForWrite);
if (acEnt != null)
{
string entLayer = acEnt.Layer;
string entType = acEnt.GetType().Name;
if (entType.Contains("Hatch"))
{
Hatch acHatch = acEnt as Hatch;
Extents3d? ext = acHatch.Bounds;
Point3d pt= ext.Value.MaxPoint;
Point3d pt1 = new Point3d( pt.X - 0.5,pt.Y - 0.5,pt.Z);
hatchPoints.Add(pt1);
}

}

}

foreach (Point3d internalPoint in hatchPoints)
{
DBObjectCollection objs = ed.TraceBoundary(internalPoint, true);
objCollection.Add(objs);
}

Here, while tracing boundary I am getting DBObjectCollection as null for most of the hatches. I am not getting why this is happening.

SaddamShaikh77_0-1619440946152.png

Here is my output. Yellow lines are the ones I am getting after tracing boundary and the rest are not getting traced properly.

Please guide me how can I get hatch boundary for each hatch independently.

I am attaching dwg for reference.

Thank you.

0 Likes
Reply
393 Views
0 Replies
Replies (0)