Cleaning up the A.poly file

SetDirectory["/home/campus03/struther/Desktop/Link to Courses/4620/Scewchuk"];
Data=Import["A.poly","TABLE"];
VertexCount=Data[[1,1]];
Vertices=Data[[2;;VertexCount+1,{1,2,3}]];
SegmentCount=Data[[VertexCount+2,1]];
Segments=Data[[VertexCount+3;;VertexCount+2+SegmentCount,{2,3}]];
HoleCount=Data[[VertexCount+3+SegmentCount,1]];
Holes=Data[[VertexCount+4+SegmentCount;;VertexCount+3+SegmentCount+HoleCount,{1,2,3}]];

CleanData=Join[
{Data[[1]]},
Vertices,
{Data[[VertexCount+2]]},
Elements,
{Data[[VertexCount+ElementCount+3]]},
Holes
];
Export["AClean.poly",CleanData, "TSV"]

Viewing the A.poly file

ListPlot[
Vertices[[All,{2,3}]],
Joined->True
]

Show[
Graphics[{
Table[
Line[Vertices[[Segments[[i]],{2,3}]]],
{i, Length[Segments]}],
Red,
Table[Point[Vertices[[i,{2,3}]]],{i,1, Length[Vertices]}]
}
],
Frame->True
]

Viewing the element and node files

Reading the node file.  The first line says how many nodes there are. the last line says it was made by triangle.  The first number on each row is just the node number, the second and third are the coordinates and the last ones are "attributes".

Nodes=Take[Import["AClean.1.node","Table"],{2,-2}];
Nodes=Nodes[[All,{2,3}]];

Reading the element file.  The first line says how many elements there are. the last line says it was made by triangle.  The first number on each row is just the element number.

Elements=Take[Import["AClean.1.ele","Table"],{2,-2}];
Elements=Elements[[All,{2,3,4}]];

Lets check I am not crazy.

Show[
Graphics[{
EdgeForm[{Thick,Black}],PointSize[0.02],
Table[ 
{Hue[i/Length[Elements]],Polygon[Nodes[[Elements[[i]]]]]},
{i, 1, Length[Elements]}
],
Table[ 
{Black,Point[Nodes[[i]]]},
{i, 1, Length[Nodes]}
]
}
],
Frame->True
]