I want to fetch the boundary points(coordinates) of the hatch in dwg file using Aspose.Cad for dot net.
@Asheesh32,
Hello,
please find the basic example below to get coordinates (HATCH is a rich entity that stores data inside in various objects):
foreach (var entity in cadImage.Entities)
{
if (entity is CadHatch hatch)
{
foreach (CadHatchBoundaryPathContainer boundaryPath in hatch.BoundaryPaths)
{
foreach (ICadBoundaryPath path in boundaryPath.BoundaryPath)
{
if (path is CadPolylineBoundaryPath)
{
var polylineBoundary = (CadPolylineBoundaryPath)path;
foreach (Point2D point2d in polylineBoundary.Vertices)
{
System.Console.WriteLine("({0},{1})", point2d.X, point2d.Y);
}
}
else if (path is CadEdgeBoundaryPath)
{
var edgeBoundaryPath = (CadEdgeBoundaryPath)path;
foreach (CadBoundaryPathLine line in edgeBoundaryPath.Objects)
{
System.Console.WriteLine("({0},{1}),({2},{3})", line.FirstPoint.X, line.FirstPoint.Y, line.SecondPoint.X, line.SecondPoint.Y);
}
}
}
}
}
}