how to show dimensions of line,arc or any radius in eyeshot

89 Views Asked by At

i have a .dxf file if i import that file in my vs code drafting demo wpf sample and if i press a button-1 it should show dimensions of everline present in the viewport. if i press button-2 it should show dimensions of the radius of a every circle present in the viewport.

how can i acheive that

1

There are 1 best solutions below

0
Node defender On

The .dxf file is a DXF (Drawing Interchange Format or Drawing Exchange Format) drawing exchange file.

Here is a simple example of reading a .dxf file:

Read using netDXF:

OpenFileDialog of = new OpenFileDialog();
of.Filter = "(*.dxf)|*.dxf|(*.*)|*.*";
if (of.ShowDialog() == true)
{
    string FileName = of.FileName;
    string SafeFileName = of.SafeFileName;
    DxfDocument dxfDocument = DxfDocument.Load(FileName);
    var Polylines2D_List = dxfDocument.Entities.Polylines2D;
    List<PolylinesModel> list = new List<PolylinesModel>();
    foreach (var item in Polylines2D_List)
    {
        for (int i = 0; i < item.Vertexes.Count; i++)
        {
            PolylinesModel PolylinItem = new PolylinesModel();
            double PositionX = Math.Round(item.Vertexes[i].Position.X, 4);
            double PositionY = Math.Round(item.Vertexes[i].Position.Y, 4);
            PolylinItem.SafeFileName = SafeFileName;
            PolylinItem.Index = i.ToString();
            PolylinItem.PositionX = PositionX.ToString();
            PolylinItem.PositionY = PositionY.ToString();
            PolylinItem.PositionZ = "0.0000";
            list.Add(PolylinItem);
        }
    }
    Polylines2DList = list;

}

Write using netDXF:

List<Polyline2DVertex> polyline2DVertices = new List<Polyline2DVertex>();
foreach (var item in Polylines2DList)
{
    Polyline2DVertex polyline2DVertex = new Polyline2DVertex(Convert.ToDouble(item.PositionX), Convert.ToDouble(item.PositionY));
    polyline2DVertices.Add(polyline2DVertex);
}
Polyline2D line = new Polyline2D(polyline2DVertices);
DxfDocument dxf = new DxfDocument();
dxf.Entities.Add(line);
dxf.Save("test.dxf");