# Learning Using a DXF File

This code snippet shows how to perform pattern learning and finding operations using a DXF file.

## C++

```cpp
#include <eVision/EasyFind/EPatternFinder.h>
```

```cpp
using namespace eVision;

// 1. Create an EPatternFinder instance for the model.
EPatternFinder finder;

// 2. Create your vector model.
EVectorModel myModel;

// 3. Load the model from the dxf file.
myModel.LoadDXF("myModel.dxf");

// 4. The scale and polarity attributes are not part of the dxf file. If necessary, add them to the EVectorModel.

// 5. Learn the model.
finder.Learn(myModel);

// 6. If you want to reuse it later, save the new model (.fnd file).
// finder.Save("myModel.fnd");

// 7. Find the pattern in an image
EImageBW8 srcImage;
std::vector<EFoundPattern> foundPattern;
foundPattern = finder.Find(&srcImage);
```

#### SEE ALSO
[`EVectorModel::LoadDXF`](../../../../doxygen_cpp/classeVision_1_1EVectorModel.html#a951f53fc53926139acf8bdd0605f45a2) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EVectorModel.html#a51bcbbc943448255e2c12c3c398d7255) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EVectorModel.html#a6fc581eb5bfd812590ec52124dd0cb58), [`EPatternFinder::Find`](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771)

## C#

```cs
using eVision;
```

```cs
// 1. Create an EPatternFinder instance for the model.
EPatternFinder finder = new EPatternFinder();

// 2. Create your vector model.
EVectorModel myModel = new EVectorModel();

// 3. Load the model from the dxf file.
myModel.LoadDXF("myModel.dxf");

// 4. The scale and polarity attributes are not part of the dxf file. If necessary, add them to the EVectorModel.

// 5. Learn the model.
finder.Learn(myModel);

// 6. If you want to reuse it later, save the new model (.fnd file).
// finder.Save("myModel.fnd");

// 7. Find the pattern in an image
EImageBW8 srcImage = new EImageBW8();
EFoundPattern[] foundPattern = null;
foundPattern = finder.Find(srcImage);
```

#### SEE ALSO
[`EVectorModel.LoadDXF`](../../../../doxygen_cs/classeVision_1_1EVectorModel.html#a51bcbbc943448255e2c12c3c398d7255) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EVectorModel.html#a951f53fc53926139acf8bdd0605f45a2) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EVectorModel.html#a6fc581eb5bfd812590ec52124dd0cb58), [`EPatternFinder.Find`](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>Python</sub>](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771)

## Python

```py
import eVision

# 1. Create an EPatternFinder instance for the model.
finder = eVision.EPatternFinder()

# 2. Create your vector model.
my_model = eVision.EVectorModel()

# 3. Load the model from the dxf file.
my_model.LoadDXF("myModel.dxf")

# 4. The scale and polarity attributes are not part of the dxf file. If necessary, add them to the EVectorModel.

# 5. Learn the model.
finder.Learn(my_model)

# 6. If you want to reuse it later, save the new model (.fnd file).
# finder.Save("myModel.fnd")

# 7. Find the pattern in an image
src_image = eVision.EImageBW8()
found_pattern = finder.Find(src_image)
```

#### SEE ALSO
[`EVectorModel.LoadDXF`](../../../../doxygen_python/classeVision_1_1EVectorModel.html#a6fc581eb5bfd812590ec52124dd0cb58) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EVectorModel.html#a951f53fc53926139acf8bdd0605f45a2) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EVectorModel.html#a51bcbbc943448255e2c12c3c398d7255), [`EPatternFinder.Find`](../../../../doxygen_python/classeVision_1_1EPatternFinder.html#a44780e599d160cbb5f8e405042ace771) [<sub>C++</sub>](../../../../doxygen_cpp/classeVision_1_1EPatternFinder.html#aeeb160cde9343ffc0d8583ac1d330e4d) [<sub>.NET</sub>](../../../../doxygen_cs/classeVision_1_1EPatternFinder.html#a9c35c544243729d9907eb708f7d2a0e2)
