Run Advanced Sample with HALCON
You can build and run the provided sample by the following instructions if you have completed all operations required in the Prerequisites section.
Install HALCON
-
Download and install HALCON (C# version). Please note down the directory of HALCON.
-
Find the
MechDLCShapeWithHalconSamples.sln
file under xxx\mechdlk_sdk\samples\csharp and double-click the file to open the solution in Visual Studio. -
In the Solution Explorer panel, select
. Then, right-click References and select Add Reference. -
In the pop-up Reference Manager dialog box, click Browse in the lower-right corner.
-
In the directory of HALCON, find and select the
halcondotnet.dll
file from the path xxx\bin\dotnet35 and click Add. -
In the Reference Manager dialog box, click OK to finish reference adding.
The provided sample was tested with HALCON 20.11.1.2. The directory of the DLL file may differ for different HALCON versions. Please follow the above steps according to the actual situation. |
![csharp add halcon](_images/csharp_add-halcon.png)
Build the Sample
-
In the Visual Studio menu bar, select
. An executable file is generated and saved to the bin folder (xxx\mechdlk_sdk\samples\csharp). -
Copy and paste the resources folder under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
-
Copy and paste all files in the 3rd_dll folder under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
-
Copy and paste all files in the mechdlk_sdk\dll directory under the project folder to the path xxx\mechdlk_sdk\samples\csharp\bin.
To run any C# sample in Mech-DLK SDK, you only need to perform Steps 2, 3, and 4 once. |