#include <cadex/Base/UTF16String.hxx>
#include <cadex/Drawing/Drawing.hxx>
#include <cadex/Drawing/Geometry.hxx>
#include <cadex/Drawing/View.hxx>
#include <cadex/Geom/Line2d.hxx>
#include <cadex/Geom/Point2d.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/Nesting_Computer.hxx>
#include <cadex/Nesting_ComputerParameters.hxx>
#include <cadex/Nesting_Data.hxx>
#include <iostream>
#include <vector>
#include "../../mtk_license.cxx"
using namespace std;
class Pattern
{
public:
myName (theName),
myNumber (theNumber)
{
myDrawingView.Add (theShape);
}
size_t myNumber;
};
using PatternVector = vector<Pattern>;
{
aL1.SetTrim (0, theWidth);
aL2.SetTrim (0, theHeight);
aL3.SetTrim (0, theWidth);
aL4.SetTrim (0, theHeight);
return aRectangle;
}
void PrintPatternsInfo (const PatternVector& thePatterns)
{
cout << "------- Patterns Info -------" << endl;
for (const auto& aPattern : thePatterns) {
cout << aPattern.myName << ": " << aPattern.myNumber << endl;
}
}
{
cout << endl;
cout << "------- Nesting Info -------" << endl;
double aTotalEfficiency = 0.0;
double aTotalScrap = 0.0;
const auto& aSheets = theData.
Sheets();
for (size_t i = 0; i < aSheets.size(); ++i) {
cout << "#" << i << " Sheet" << endl;
cout << " Nested Parts: " << aSheets[i].NestedParts() << endl;
aTotalScrap += aSheets[i].Scrap();
cout << " Scrap: " << aSheets[i].Scrap() * 100 << "%" << endl;
aTotalEfficiency += aSheets[i].PlacementEfficiency();
cout << " Placement Efficiency: " << aSheets[i].PlacementEfficiency() * 100 << "%" << endl;
cout << endl;
}
cout << "Average Scrap: " << aTotalScrap / aSheets.size() * 100 << "%" << endl;
cout << "Average Placement Efficiency: " << aTotalEfficiency / aSheets.size() * 100 << "%" << endl;
}
int main()
{
auto aKey = MTKLicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate Manufacturing Toolkit license." << endl;
return 1;
}
aParams.
SetMirrorControl (
false);
aComputer.
SetParameters (aParams);
auto aPatterns = PatternVector{Pattern (CreateRectangle (50.0, 50.0), "Rectangle 50x50", 1),
Pattern (CreateRectangle (20.0, 10.0), "Rectangle 20x10", 10)};
PrintPatternsInfo (aPatterns);
for (const auto& aPattern : aPatterns) {
aComputer.
AddPattern (aPattern.myDrawingView, aPattern.myNumber);
}
PrintNestingInfo (aData);
return 0;
}
Describes drawing elements composed of 2D curves.
Definition CurveSet.cs:20
void AddCurve(cadex.Geom.Curve2d theCurve)
Adds a curve to the element.
Definition CurveSet.cs:62
Represents a view on a drawing sheet.
Definition View.cs:24
Defines a 2D Direction.
Definition Direction2d.cs:17
Defines 2D line.
Definition Line2d.cs:19
Defines a 3D point.
Definition Point2d.cs:17
The nesting analyzing tool.
Definition Nesting_Computer.cs:24
void AddMaterial(double theLength, double theWidth, uint theQuantity)
Definition Nesting_Computer.cs:95
cadex.Nesting_Data Perform(cadex.ProgressStatus theProgressStatus)
Definition Nesting_Computer.cs:132
void AddPattern(cadex.Drawing.View theDrawing, uint theQuantity)
Definition Nesting_Computer.cs:85
Defines parameters used in nesting process.
Definition Nesting_ComputerParameters.cs:17
void SetCurveTolerance(double theCurveTolerance)
Definition Nesting_ComputerParameters.cs:141
void SetGenerationSize(uint theGenerationSize)
Definition Nesting_ComputerParameters.cs:103
void SetRotationCount(uint theRotationCount)
Definition Nesting_ComputerParameters.cs:233
void SetPartToSheetBoundaryDistance(double thePartToSheetBoundaryDistance)
Definition Nesting_ComputerParameters.cs:179
void SetMutationRate(double theMutationRate)
Definition Nesting_ComputerParameters.cs:122
void SetIterationCount(uint theIterationCount)
Definition Nesting_ComputerParameters.cs:84
void SetPartToPartDistance(double thePartToPartDistance)
Definition Nesting_ComputerParameters.cs:160
Contains information about nesting sheets.
Definition Nesting_Data.cs:20
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition UTF16String.cs:17
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12