Installation


Adding a DXFReader.NET component to a project


There are two ways to add a component to your project:

1) Adding the component from the Toolbox

With a project's form open in design mode drag the DXFReaderNETControl icon from the toolbox onto the form.



The instance of the component will be given a default name (eg dxfReaderNETControl1) which appears in the properties panel when the component is selected. A single Form may contain any number of DXFReader.NET Components. The first to be added will be called dxfReaderNETControl1, the second dxfReaderNETControl2, and so on; the names may be changed by the user by modifying the Name property within the Properties box.

The properties panel also displays all other settable properties for the component, and these values will be used as defaults unless properties are changed programmatically within your project.

 



This method is used if the component is associated with a form.

2) Adding the component directly to the project files

In the Solution Explorer add a reference to the DXFReaderNET.dll and to the System.Windows.Forms.dll. Then in source file that uses the component declare an instance of the component. For example, in a Console App project you can use the following code:

C#

using System;
using DXFReaderNET;
using DXFReaderNET.Entities;
namespace DXFReader.NET_ConsoleApp
{    class Program
    {
        static void Main(string[] args)
        {
            DXFReaderNETControl myDXF = new DXFReaderNETControl();
            myDXF.ReadDXF(@"..\..\..\..\drawing.dxf");
            int n = 0;
            foreach (Line line in myDXF.DXF.Lines)
            {
                n++;
                Console.WriteLine("Line #: " + n.ToString() + " lenght: " + line.Lenght.ToString());
            }
            Console.ReadKey();
        }
    }
}

VB

Imports DXFReaderNET
Imports DXFReaderNET.Entities
Module Module1
    Sub Main()
        Dim myDXF As New DXFReaderNETControl
        myDXF.ReadDXF("..\..\..\..\drawing.dxf")
        Dim n As Integer = 0
        For Each line As Line In myDXF.DXF.Lines
            n += 1
            Console.WriteLine("Line #: " + n.ToString() + " lenght: " + line.Lenght.ToString())
        Next
        Console.ReadKey()
    End Sub
End Module



This method is suitable if you do not need to have the component associated with a form.


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

Any similarities to actual persons or places is merely coincidental.