The command line support within Optimumcut-1D allows other programs to programatically benefit from its optimisation capabilities. Several customers have been unsure how best to use this so we’ve taken the opportunity to create some sample C# code. To automate Optimumcut-1D, there are several tasks that need to be accomplished.
- Create a suitable project file to send to Optimumcut-1D.
- Find where Optimumcut-1D is installed..
- Launch Optimumcut-1D and wait for it to finish the optimisation.
- Load and parse the output file.
To achieve this, we have created a C# code file that encapsulates functionality to solve these challenges. This file contains simple classes to represent projects, materials, stock, cuts and results. It also contains a high-level automation class specifically designed to solve the above list of challenges. We’ve tried to keep this class as simple as possible so it could easily be translated to VB.NET, Java, Delphi or any other high-level language.
Using this code is as simple as this example below. Add the attached OptimumcutAutomation file to your project and optionally include a using statement for the OptimumcutAutomation namespace. The code then needs to create a Project and add one or more materials to it. Each material then needs one or more pieces of stock and one or more cuts. The project can then be optimised which returns a collection of results. Each result corresponds to a single cut and includes references back to the original cut description defined in the project.
A full sample application using the above code produces the following output.
Attached below is the OptimumcutAutomation code file and a full example Visual Studio 2010 solution.
Any programmer can utilize the sample code to Generate the existing Optimumcut Cutting Lists, Labels Reports, CNC Saw links and pusher / automated stop links.