Coding


Console App


A simple console application that  will show the number and the total lenght of all lines in a drawing. Namespace System.Windows.Forms must be referenced.

C#

using System;
using DXFReaderNET;
using DXFReaderNET.Entities;

namespace DXFReaderNETConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            DXFReaderNETControl myDXF = new DXFReaderNETControl();
            myDXF.ReadDXF(@"../../drawing.dxf");
            double total_lines_lenght = 0;
            foreach (Line line in myDXF.DXF.Lines)
            {
                total_lines_lenght += line.Lenght;
            }
            Console.WriteLine("# of lines: " + myDXF.DXF.Lines.Count.ToString());
            Console.WriteLine("total lenght of lines: " + total_lines_lenght.ToString());
            Console.ReadKey();

        }
    }
}

VB

Imports DXFReaderNET
Imports DXFReaderNET.Entities

Module Module1

    Sub Main()

        Dim myDXF As New DXFReaderNETControl
        myDXF.ReadDXF("../../drawing.dxf")

        Dim total_lines_lenght As Double = 0

        For Each line As Line In myDXF.DXF.Lines
            total_lines_lenght += line.Lenght
        Next

        Console.WriteLine("# of lines: " + myDXF.DXF.Lines.Count.ToString())
        Console.WriteLine("total lenght of lines: " + total_lines_lenght.ToString())
        Console.ReadKey()

    End Sub

End Module

 


Download C# code

Download Visual Basic code

 


Warning!
All samples, data, places and images in this section are only for tutorial scope. They are fictitious and may not correspond to real cases.

Any similarities to actual persons or places is merely coincidental.

To evaluate all code samples you need to download and install the DXFReader.NET Compoonent first.