- Refer to the MTK Converter Example
MTKConverter_PartProcessor.hxx
#ifndef _MTKConverter_PartProcessor_HeaderFile
#define _MTKConverter_PartProcessor_HeaderFile
#include <cadex/Base/Uuid.hxx>
#include <cadex/Drawing/Sheet.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/Part.hxx>
#include <vector>
class Body;
class IndexedTriangleSet;
class MeshBody;
class Shell;
class Solid;
}
class MTKConverter_ProcessData
{
protected:
myPart (thePart)
{}
MTKConverter_ProcessData (const std::vector<cadex::Drawing::Sheet>& theSheets) :
mySourceSheets (theSheets)
{}
public:
virtual ~MTKConverter_ProcessData()
{}
std::vector<cadex::Drawing::Sheet> mySourceSheets;
};
{
public:
typedef std::shared_ptr<MTKConverter_ProcessData> DataType;
virtual ~MTKConverter_PartProcessor()
{}
std::vector<DataType> myData;
protected:
};
class MTKConverter_VoidPartProcessor : public MTKConverter_PartProcessor
{
protected:
{}
{}
{}
{}
};
#endif
Provides a base body class.
Definition Body.cs:19
Defines a polygonal shape consisting of triangles.
Definition IndexedTriangleSet.cs:81
Defines a body that represents a polygonal mesh (faceted or tessellated).
Definition MeshBody.cs:19
Element visitor with empty implementation.
Definition ModelElementVoidVisitor.cs:20
Defines a leaf node in the scene graph hierarchy.
Definition Part.cs:23
Defines a connected set of faces.
Definition Shell.cs:29
Defines a topological solid.
Definition Solid.cs:25
Defines classes, types, enums, and functions related to topological entities and scene graph elements...
Definition AngleUnit.cs:12
MTKConverter_PartProcessor.cxx
#include <cadex/ModelData/Body.hxx>
#include <cadex/ModelData/IndexedTriangleSet.hxx>
#include <cadex/ModelData/MeshBody.hxx>
#include <cadex/ModelData/Shell.hxx>
#include <cadex/ModelData/Solid.hxx>
#include <MTKConverter_PartProcessor.hxx>
void MTKConverter_PartProcessor::operator() (
const ModelData::Part& thePart)
{
bool aPartWasProcessed = false;
auto aProcessData = CreateProcessData (thePart);
const auto& aBodies = thePart.
Bodies();
for (const auto& aBody : aBodies) {
if (ProcessMeshBody (aProcessData, aMeshBody)) {
aPartWasProcessed = true;
}
} else if (ProcessBRepBody (aProcessData, aBody)) {
aPartWasProcessed = true;
}
}
if (aPartWasProcessed) {
PostProcessPart (thePart);
myData.push_back (aProcessData);
}
}
bool MTKConverter_PartProcessor::ProcessBRepBody (DataType& theProcessData,
const ModelData::Body& theBody)
{
bool aBodyWasProcessed = false;
while (aShapeIt.HasNext()) {
const auto& aShape = aShapeIt.Next();
if (aShape.Type() == ModelData::ShapeType::Solid) {
ProcessSolid (theProcessData, ModelData::Solid::Cast (aShape));
aBodyWasProcessed = true;
} else if (aShape.Type() == ModelData::ShapeType::Shell) {
ProcessShell (theProcessData, ModelData::Shell::Cast (aShape));
aBodyWasProcessed = true;
}
}
return aBodyWasProcessed;
}
bool MTKConverter_PartProcessor::ProcessMeshBody (DataType& theProcessData,
const ModelData::MeshBody& theBody)
{
bool aBodyWasProcessed = false;
for (const auto& aMeshShape : theBody.Shapes()) {
aBodyWasProcessed = true;
}
}
return aBodyWasProcessed;
}
Iterates over subshapes in a shape.
Definition ShapeIterator.cs:58
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12
MTKConverter_MachiningProcessor.hxx
#ifndef _MTKConverter_MachiningProcessor_HeaderFile
#define _MTKConverter_MachiningProcessor_HeaderFile
#include <cadex/Machining_OperationType.hxx>
#include <cadex/MTKBase_FeatureList.hxx>
#include <MTKConverter_PartProcessor.hxx>
class Part;
class Solid;
}
class MTKConverter_MachiningData : public MTKConverter_ProcessData
{
public:
MTKConverter_ProcessData (thePart)
{}
};
class MTKConverter_MachiningProcessor : public MTKConverter_VoidPartProcessor
{
public:
myOperation (theOperation)
{}
protected:
};
#endif
Defines a list of features.
Definition MTKBase_FeatureList.cs:20
Machining_OperationType
Defines an operation type in machining.
Definition Machining_OperationType.cs:19
MTKConverter_MachiningProcessor.cxx
#include <cadex/DFMMachining_Analyzer.hxx>
#include <cadex/DFMMachining_DeepPocketIssue.hxx>
#include <cadex/DFMMachining_DrillingAnalyzerParameters.hxx>
#include <cadex/DFMMachining_MillingAnalyzerParameters.hxx>
#include <cadex/DFMMachining_TurningAnalyzerParameters.hxx>
#include <cadex/Machining_Analyzer.hxx>
#include <cadex/Machining_Data.hxx>
#include <cadex/Machining_FeatureRecognizer.hxx>
#include <cadex/Machining_FeatureRecognizerParameters.hxx>
#include <cadex/ModelData/Solid.hxx>
#include <cadex/MTKBase_FeatureList.hxx>
#include <MTKConverter_MachiningProcessor.hxx>
MTKConverter_MachiningProcessor::DataType MTKConverter_MachiningProcessor::CreateProcessData (
{
return std::make_shared<MTKConverter_MachiningData> (thePart);
}
void MTKConverter_MachiningProcessor::ProcessSolid (DataType& theProcessData,
const ModelData::Solid& theSolid)
{
auto aMachiningData = std::static_pointer_cast<MTKConverter_MachiningData> (theProcessData);
aMachiningData->myOperation = myOperation;
anAnalyzer.
AddTool (aFeatureRecognizer);
auto aData = anAnalyzer.
Perform (theSolid);
if (aData.IsEmpty()) {
return;
}
aMachiningData->myFeatureList.Append (aData.FeatureList());
aMachiningData->myIssueList.Append (aDrillingAnalyzer.Perform (theSolid, aData));
for (
size_t i = 0; i < aMillingIssueList.
Size(); ++i) {
const auto& anIssue = aMillingIssueList[i];
continue;
}
aMachiningData->myIssueList.
Append (anIssue);
}
if (myOperation == Machining_OT_LatheMilling) {
for (
size_t i = 0; i < aTurningIssueList.
Size(); ++i) {
const auto& anIssue = aTurningIssueList[i];
aMachiningData->myIssueList.Append (anIssue);
}
}
}
Provides an interface to run DFM Machining analysis.
Definition DFMMachining_Analyzer.cs:44
Describes deep pocket issue found during cnc machining milling design analysis.
Definition DFMMachining_DeepPocketIssue.cs:39
Defines parameters used in cnc machining drilling design analysis.
Definition DFMMachining_DrillingAnalyzerParameters.cs:19
Defines parameters used in cnc machining milling design analysis.
Definition DFMMachining_MillingAnalyzerParameters.cs:19
Defines parameters used in cnc machining turning design analysis.
Definition DFMMachining_TurningAnalyzerParameters.cs:19
uint Size()
Returns the number of elements in the list.
Definition MTKBase_FeatureList.cs:110
Provides an interface to run several analyzer tools for different types of machining processing.
Definition Machining_Analyzer.cs:21
cadex.Machining_Data Perform(cadex.ModelData.Solid theSolid, cadex.ProgressStatus theProgressStatus)
Runs the analyzing process.
Definition Machining_Analyzer.cs:79
void AddTool(cadex.Machining_AnalyzerTool theTool)
Adds additional tool to run during analyzing process.
Definition Machining_Analyzer.cs:102
Provides an interface to recognizing machining features tool.
Definition Machining_FeatureRecognizer.cs:25
cadex.Machining_FeatureRecognizerParameters Parameters()
Returns reference to parameters.
Definition Machining_FeatureRecognizer.cs:116
void SetOperation(cadex.Machining_OperationType theOperation)
Sets machining operation type.
Definition Machining_FeatureRecognizerParameters.cs:208
MTKConverter_SheetMetalProcessor.hxx
#ifndef _MTKConverter_SheetMetalProcessor_HeaderFile
#define _MTKConverter_SheetMetalProcessor_HeaderFile
#include <cadex/ModelData/SheetBody.hxx>
#include <cadex/ModelData/Shell.hxx>
#include <cadex/MTKBase_FeatureList.hxx>
#include <cadex/SheetMetal_Analyzer.hxx>
#include <cadex/SheetMetal_Data.hxx>
#include <cadex/SheetMetal_FlatPattern.hxx>
#include <MTKConverter_PartProcessor.hxx>
#include <deque>
class MTKConverter_UnfoldedPartData
{
public:
MTKConverter_UnfoldedPartData()
{}
bool IsInit() const
{
return !myFlatPatterns.empty();
}
std::deque<cadex::SheetMetal_FlatPattern> myFlatPatterns;
};
class MTKConverter_SheetMetalData : public MTKConverter_ProcessData
{
public:
bool myIsSheetMetalPart = false;
MTKConverter_UnfoldedPartData myUnfoldedPartData;
};
class MTKConverter_SheetMetalProcessor : public MTKConverter_VoidPartProcessor
{
public:
protected:
};
#endif
Provides MTK data model.
Definition Model.cs:31
Provides a sheet body composed of faces and shells.
Definition SheetBody.cs:19
MTKConverter_SheetMetalProcessor.cxx
#include <cadex/DFMSheetMetal_Analyzer.hxx>
#include <cadex/DFMSheetMetal_FlatPatternInterferenceIssue.hxx>
#include <cadex/DFMSheetMetal_NonStandardSheetSizeIssue.hxx>
#include <cadex/DFMSheetMetal_NonStandardSheetThicknessIssue.hxx>
#include <cadex/Geom/Transformation.hxx>
#include <cadex/Measurements/BoundingBox.hxx>
#include <cadex/Measurements/ValidationProperties.hxx>
#include <cadex/Measurements/ValidationPropertyData.hxx>
#include <cadex/ModelData/Box.hxx>
#include <cadex/ModelData/Shell.hxx>
#include <cadex/ModelData/SheetBody.hxx>
#include <cadex/ModelData/Solid.hxx>
#include <cadex/SheetMetal_Analyzer.hxx>
#include <cadex/SheetMetal_Data.hxx>
#include <cadex/SheetMetal_FeatureRecognizer.hxx>
#include <cadex/SheetMetal_FlatPattern.hxx>
#include <cadex/SheetMetal_Unfolder.hxx>
#include <cadex/Drawing/Drawing.hxx>
#include <MTKConverter_DrawingProcessor.hxx>
#include <MTKConverter_SheetMetalProcessor.hxx>
#include <vector>
MTKConverter_ProcessData (thePart)
{}
myUnfoldedModel (theUnfoldedModel)
{
}
MTKConverter_SheetMetalProcessor::DataType MTKConverter_SheetMetalProcessor::CreateProcessData (
{
return std::make_shared<MTKConverter_SheetMetalData> (thePart);
}
void MTKConverter_SheetMetalProcessor::ProcessSolid (DataType& theProcessData,
const ModelData::Solid& theSolid)
{
auto anSMData = myAnalyzer.Perform (theSolid);
Process (theProcessData, anSMData);
}
void MTKConverter_SheetMetalProcessor::ProcessShell (DataType& theProcessData,
const ModelData::Shell& theShell)
{
auto anSMData = myAnalyzer.Perform (theShell);
Process (theProcessData, anSMData);
}
void MTKConverter_SheetMetalProcessor::PostProcessPart (
const ModelData::Part& thePart)
{
if (myCurrentUnfoldedBody.Shapes().empty()) {
return;
}
anUnfoldedPart.SetUuid (thePart.
Uuid());
anUnfoldedPart.AddBody (myCurrentUnfoldedBody);
myUnfoldedModel.AddRoot (anUnfoldedPart);
}
void MTKConverter_SheetMetalProcessor::Process (DataType& theProcessData,
const SheetMetal_Data& theData)
{
return;
}
auto anSMData = std::static_pointer_cast<MTKConverter_SheetMetalData> (theProcessData);
anSMData->myIsSheetMetalPart = true;
anSMData->myFeatureList.Append (theData.
FeatureList());
auto& anUnfoldedData = anSMData->myUnfoldedPartData;
if (anUnfoldedShell) {
myCurrentUnfoldedBody.Append (anUnfoldedShell);
anUnfoldedData.myFlatPatterns.push_back (aFlatPattern);
SheetMetal_FlatPattern::DrawingParameters aDrawingParams;
aDrawingParams.SetIsIgnoreBendingLines (true);
if (aFlatPatternDrawing) {
auto aSheet = aSheetIt.Next();
aSheet.SetUuid (anSMData->myPart.Uuid());
}
if (!aDrawing) {
myUnfoldedModel.SetDrawing (aFlatPatternDrawing);
} else {
MTKConverter_DrawingProcessor::AddSheets (aFlatPatternDrawing, aDrawing);
myUnfoldedModel.SetDrawing (aDrawing);
}
}
}
auto anIssueList = aDFMAnalyzer.
Perform (theData);
for (size_t i = 0; i < anIssueList.Size(); ++i) {
const auto& anIssue = anIssueList[i];
if (anUnfoldedData.IsInit() &&
anUnfoldedData.myIssueList.Append (anIssue);
} else {
anSMData->myIssueList.Append (anIssue);
}
}
}
Iterator over sheets of a drawing.
Definition Drawing.cs:108
bool HasNext()
Returns true if the iterator can be advanced with Next().
Definition Drawing.cs:161
Represents a single 2D drawing of a model.
Definition Drawing.cs:33
cadex.UTF16String Name()
Returns empty string if the model element has no name (by default).
Definition ModelElement.cs:67
System.Guid Uuid()
Returns an object uuid.
Definition ModelElement.cs:86
MTKConverter_Report.hxx
#ifndef _MTKConverter_Report_HeaderFile
#define _MTKConverter_Report_HeaderFile
#include <memory>
#include <vector>
class UTF16String;
}
class MTKConverter_ProcessData;
class MTKConverter_Report
{
public:
typedef std::shared_ptr<MTKConverter_ProcessData> DataType;
void AddData (const DataType& theData)
{
myData.push_back (theData);
}
private:
std::vector<DataType> myData;
};
#endif
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition UTF16String.cs:17
MTKConverter_Report.cxx
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/ModelData/Part.hxx>
#include <cadex/Utilities/JSONSerializer.hxx>
#include <MTKConverter_Report.hxx>
#include <MTKConverter_MachiningProcessor.hxx>
#include <MTKConverter_MoldingProcessor.hxx>
#include <MTKConverter_NestingProcessor.hxx>
#include <MTKConverter_SheetMetalProcessor.hxx>
#include <MTKConverter_WallThicknessProcessor.hxx>
#include <../../helpers/JSONWriter.hxx>
#include <fstream>
#include <iomanip>
#include <sstream>
inline std::ostream& operator<< (std::ostream& theStream, const Point& thePoint)
{
return theStream << "(" << thePoint.X() << ", " << thePoint.Y() << ", " << thePoint.Z() << ")";
}
}
namespace {
template<typename T>
void WriteParameter (JSONWriter& theWriter, const char* theParamName, const char* theParamUnits, const T& theParamValue)
{
theWriter.OpenSection();
theWriter.WriteData ("name", theParamName);
theWriter.WriteData ("units", theParamUnits);
theWriter.WriteData ("value", theParamValue);
theWriter.CloseSection();
}
bool WriteFeatures (
JSONWriter& theWriter,
const char* theGroupName,
const char* theSubgroupName,
const char* theMessageForEmptyList)
{
theWriter.OpenSection (theSubgroupName);
theWriter.WriteData ("name", theGroupName);
if (theFeatures.
IsEmpty()) {
theWriter.WriteData ("message", theMessageForEmptyList);
} else {
aParams.
SetStartIndentLevel (theWriter.NestingLevel());
auto aFeaturesJSON = aJSONSerializer.Serialize (theFeatures);
theWriter.WriteRawData (aFeaturesJSON);
}
theWriter.CloseSection();
return true;
}
{
switch (theOperation) {
default: break;
}
return "CNC Machining";
}
{
for (const auto& aBody : theBodies) {
if (aShapeIt.HasNext()) {
return true;
}
}
return false;
}
void WriteThicknessNode (
JSONWriter& theWriter,
const char* theParamName,
double theParamValue,
const PointPairType& thePoints,
const char* theNodeName)
{
std::stringstream aStream;
aStream << std::fixed << std::setprecision (2);
JSONWriter aWriter (aStream, 3);
aWriter.OpenSection (theNodeName);
aWriter.WriteData ("name", theParamName);
aWriter.WriteData ("units", "mm");
aWriter.WriteData ("value", theParamValue);
aWriter.WriteData ("firstPoint", thePoints.first);
aWriter.WriteData ("secondPoint", thePoints.second);
aWriter.CloseSection();
theWriter.WriteRawData (aStream.str());
}
void WriteWallThicknessData (JSONWriter& theWriter, const std::shared_ptr<MTKConverter_WallThicknessData>& theWTData)
{
WriteThicknessNode (
theWriter,
"Minimum Thickness",
theWTData->myMinThickness,
theWTData->myMinThicknessPoints,
"minThickness");
WriteThicknessNode (
theWriter,
"Maximum Thickness",
theWTData->myMaxThickness,
theWTData->myMaxThicknessPoints,
"maxThickness");
theWriter.OpenArraySection ("parameters");
WriteParameter (theWriter, "Minimum Thickness", "mm", theWTData->myMinThickness);
WriteParameter (theWriter, "Maximum Thickness", "mm", theWTData->myMaxThickness);
WriteParameter (theWriter, "Average Thickness", "mm", theWTData->myAvgThickness);
theWriter.CloseArraySection();
}
void WriteUnfoldedPartFeatures (JSONWriter& theWriter, const MTKConverter_UnfoldedPartData& theData)
{
theWriter.OpenSection ("featureRecognitionUnfolded");
theWriter.WriteData ("name", "Feature Recognition");
if (theData.IsInit()) {
aParams.SetStartIndentLevel (4);
auto aFeaturesJSON = aJSONSerializer.Serialize (theData.myFlatPatterns[0]);
theWriter.WriteRawData (aFeaturesJSON);
} else {
theWriter.WriteData ("message", "Unfolded part wasn't generated.");
}
theWriter.CloseSection();
}
void WriteNestingData (
JSONWriter& theWriter,
const std::vector<Drawing::Sheet>& theResultSheets,
const std::vector<double>& theFreeSpaces,
size_t thePatternCountTotal,
const std::vector<size_t>& theNestedPatternCounts)
{
theWriter.OpenSection ("nesting");
theWriter.OpenArraySection ("sheets");
for (size_t i = 0; i < theResultSheets.size(); ++i) {
const auto& aResultSheet = theResultSheets[i];
const double aFreeSpace = (i < theFreeSpaces.size()) ? theFreeSpaces[i] : 0.0;
const size_t aNestedPatternCount = (i < theNestedPatternCounts.size()) ? theNestedPatternCounts[i] : 0;
theWriter.OpenSection();
theWriter.WriteData ("sheetId", aResultSheet.Uuid());
theWriter.OpenArraySection ("parameters");
WriteParameter (theWriter, "Sheet Length", "mm", aResultSheet.Height());
WriteParameter (theWriter, "Sheet Width", "mm", aResultSheet.Width());
WriteParameter (theWriter, "Free Space", "mm^2", aFreeSpace);
WriteParameter (theWriter, "Requested Pattern Count", "pcs", thePatternCountTotal);
WriteParameter (theWriter, "Nested Pattern Count", "pcs", aNestedPatternCount);
theWriter.CloseArraySection();
theWriter.CloseSection();
}
theWriter.CloseArraySection();
theWriter.CloseSection();
}
void WriteUuidArray (JSONWriter& theWriter, const char* theName, const std::vector<Uuid>& theUuids)
{
std::ostringstream aStream;
const std::string aCurrentIndent (theWriter.NestingLevel() * 4, ' ');
const std::string aArrayValueIndent ((theWriter.NestingLevel() + 1) * 4, ' ');
aStream << aCurrentIndent << "\"" << theName << "\": [";
if (!theUuids.empty()) {
aStream << "\n";
for (size_t i = 0; i < theUuids.size(); ++i) {
aStream << aArrayValueIndent << "\"" << theUuids[i] << "\"";
if (i + 1 < theUuids.size()) {
aStream << ",";
}
aStream << "\n";
}
aStream << aCurrentIndent;
}
aStream << "]";
theWriter.WriteRawData (aStream.str());
}
typedef std::shared_ptr<MTKConverter_ProcessData> DataType;
bool IsSheetProcessData (const DataType& theProcessData)
{
return static_cast<bool> (std::dynamic_pointer_cast<MTKConverter_NestingData> (theProcessData));
}
void WritePartProcessData (JSONWriter& theWriter, const DataType& theProcessData)
{
bool aRes = false;
theWriter.WriteData ("partId", theProcessData->myPart.Uuid());
std::string anErrorMsg = "An error occurred while processing the part.";
if (theProcessData) {
if (auto aMD = std::dynamic_pointer_cast<MTKConverter_MachiningData> (theProcessData)) {
theWriter.WriteData ("process", MachiningProcessName (aMD->myOperation));
const auto& aBodies = aMD->myPart.Bodies();
if (!aMD->myFeatureList.IsEmpty()) {
WriteFeatures (theWriter, "Feature Recognition", "featureRecognition", aMD->myFeatureList, "");
WriteFeatures (
theWriter,
"Design for Manufacturing",
"dfm",
aMD->myIssueList,
"Part contains no DFM improvement suggestions.");
aRes = true;
} else if (aBodies.empty() || !HasShapes (aBodies, ModelData::ShapeType::Solid)) {
anErrorMsg =
"The part can't be analyzed due to lack of: "
"BRep representation or solids in BRep representation.";
}
} else if (auto aWTD = std::dynamic_pointer_cast<MTKConverter_WallThicknessData> (theProcessData)) {
theWriter.WriteData ("process", "Wall Thickness Analysis");
const auto& aBodies = aWTD->myPart.Bodies();
if (aWTD->myIsInit) {
WriteWallThicknessData (theWriter, aWTD);
aRes = true;
} else if ((aBodies.empty() || !HasShapes (aBodies, ModelData::ShapeType::Solid))) {
anErrorMsg =
"The part can't be analyzed due to lack of: "
"BRep representation, solids in BRep representation.";
}
} else if (auto aMoldingData = std::dynamic_pointer_cast<MTKConverter_MoldingData> (theProcessData)) {
const auto& aBodies = aMoldingData->myPart.Bodies();
if (!aMoldingData->myFeatureList.IsEmpty()) {
theWriter.WriteData ("process", "Molding Analysis");
WriteFeatures (theWriter, "Feature Recognition", "featureRecognition", aMoldingData->myFeatureList, "");
WriteFeatures (
theWriter,
"Design for Manufacturing",
"dfm",
aMoldingData->myIssueList,
"Part contains no DFM improvement suggestions.");
aRes = true;
} else if (aBodies.empty() || !HasShapes (aBodies, ModelData::ShapeType::Solid)) {
anErrorMsg =
"The part can't be analyzed due to lack of: "
"BRep representation or solids in BRep representation.";
}
} else if (auto aSMD = std::dynamic_pointer_cast<MTKConverter_SheetMetalData> (theProcessData)) {
theWriter.WriteData ("process", "Sheet Metal");
const auto& aBodies = aSMD->myPart.Bodies();
if (aSMD->myIsSheetMetalPart) {
WriteFeatures (
theWriter,
"Feature Recognition",
"featureRecognition",
aSMD->myFeatureList,
"Part contains no features.");
WriteFeatures (
theWriter,
"Design for Manufacturing",
"dfm",
aSMD->myIssueList,
"Part contains no DFM improvement suggestions.");
const auto& anUnfoldedPartData = aSMD->myUnfoldedPartData;
WriteUnfoldedPartFeatures (theWriter, anUnfoldedPartData);
if (anUnfoldedPartData.IsInit()) {
WriteFeatures (
theWriter,
"Design for Manufacturing",
"dfmUnfolded",
anUnfoldedPartData.myIssueList,
"Unfolded part contains no DFM improvement suggestions.");
}
aRes = true;
} else if (
aBodies.empty() ||
(!HasShapes (aBodies, ModelData::ShapeType::Solid) &&
!HasShapes (aBodies, ModelData::ShapeType::Shell))) {
anErrorMsg =
"The part can't be analyzed due to lack of: "
"BRep representation, solids and shells in BRep representation.";
} else {
anErrorMsg = "The part wasn't recognized as a sheet metal part.";
}
} else {
anErrorMsg = "Unrecognized process";
}
}
if (!aRes) {
theWriter.WriteData ("error", anErrorMsg);
}
}
void WriteSheetProcessData (JSONWriter& theWriter, const DataType& theProcessData)
{
bool aRes = false;
if (const auto aND = std::dynamic_pointer_cast<MTKConverter_NestingData> (theProcessData)) {
std::vector<Uuid> aSourceSheetUuids;
for (const auto& aSheet : aND->mySourceSheets) {
aSourceSheetUuids.push_back (aSheet.Uuid());
}
WriteUuidArray (theWriter, "sourceIds", aSourceSheetUuids);
const auto aResultSheets = MTKConverter_DrawingProcessor::ExtractDrawingSheets (aND->myResultDrawing);
std::vector<double> aSheetFreeSpaces;
std::vector<size_t> aNestedPatternCounts;
for (const auto& aSheet : aND->myNestingResult.Sheets()) {
aSheetFreeSpaces.push_back (aSheet.Scrap() * aSheet.SheetArea());
aNestedPatternCounts.push_back (aSheet.NestedParts());
}
if (!aResultSheets.empty()) {
theWriter.WriteData ("process", "Nesting");
WriteNestingData (
theWriter,
aResultSheets,
aSheetFreeSpaces,
aND->myPatternCountTotal,
aNestedPatternCounts);
aRes = true;
}
}
if (!aRes) {
theWriter.WriteData ("error", "An error occurred while processing the sheet.");
}
}
}
bool MTKConverter_Report::WriteToJSON (
const UTF16String& thePath)
const
{
std::ofstream aFile (thePath.
ToString());
if (!aFile) {
return false;
}
JSONWriter aWriter (aFile);
aWriter.OpenSection();
aWriter.WriteData ("version", "1");
if (myData.empty()) {
aWriter.WriteData ("error", "The model doesn't contain any parts.");
} else {
aWriter.OpenArraySection ("parts");
for (const auto& aProcessData : myData) {
if (IsSheetProcessData (aProcessData)) {
continue;
}
aWriter.OpenSection();
WritePartProcessData (aWriter, aProcessData);
aWriter.CloseSection();
}
aWriter.CloseArraySection();
bool aHasSheetProcessData = false;
for (const auto& aProcessData : myData) {
if (IsSheetProcessData (aProcessData)) {
aHasSheetProcessData = true;
break;
}
}
if (aHasSheetProcessData) {
aWriter.OpenArraySection ("sheets");
for (const auto& aProcessData : myData) {
if (!IsSheetProcessData (aProcessData)) {
continue;
}
aWriter.OpenSection();
WriteSheetProcessData (aWriter, aProcessData);
aWriter.CloseSection();
}
aWriter.CloseArraySection();
}
}
aWriter.CloseSection();
return true;
}
Serializes MTK entities into a JSON report.
Definition JSONSerializer.cs:17
Configuration for JSON serialization.
Definition JSONSerializerParameters.cs:21
Contains classes, types, enums, and functions related to geometric entities.
Definition Axis1d.cs:12
ShapeType
Defines shape type.
Definition ShapeType.cs:17
Contains utility classes that can be useful for debugging or configuring global settings.
Definition JSONSerializer.cs:12
@ Machining_OT_LatheMilling
Lathe + Milling operation type.
@ Machining_OT_Milling
Milling operation type.
MTKConverter_Application.hxx
#ifndef _MTKConverter_Application_HeaderFile
#define _MTKConverter_Application_HeaderFile
#include <cadex/ModelData/ModelReaderParameters.hxx>
#include <cadex/Nesting_ComputerParameters.hxx>
#include <cstddef>
enum class MTKConverter_ReturnCode
{
Ok = 0,
UnknownError = 1,
GeneralException = 2,
NoValidLicense = 3,
InvalidArgumentsNumber = 4,
InvalidArgument = 5,
UnsupportedVersion = 100,
UnexpectedFormat = 101,
UnsupportedFileVariant = 102,
ImportError = 103,
ProcessError = 200,
ExportError = 300,
};
class MTKConverter_ImportParameters
{
public:
MTKConverter_ImportParameters()
{
myReaderParameters.SetReadPMI (false);
myReaderParameters.SetReadDrawing (false);
myReaderParameters.SetEnableAnalyticalRecognition (true);
}
};
class MTKConverter_NestingParameters
{
public:
enum class NestingMode
{
PerSheet = 0,
AllSheets = 1
};
class MaterialParameters
{
public:
double myLength = 500.0;
double myWidth = 500.0;
size_t myCount = 1;
};
MTKConverter_NestingParameters()
{
myComputerParameters.SetIterationCount (20);
myComputerParameters.SetGenerationSize (3);
myComputerParameters.SetMutationRate (2.0);
myComputerParameters.SetCurveTolerance (100.0);
myComputerParameters.SetPartToPartDistance (0);
myComputerParameters.SetPartToSheetBoundaryDistance (0);
myComputerParameters.SetRotationCount (4);
myComputerParameters.SetMirrorControl (false);
myComputerParameters.SetNestingInHoles (false);
}
MaterialParameters myMaterialParameters;
size_t myPatternRepeatCount = 4;
NestingMode myMode = NestingMode::PerSheet;
cadex::Nesting_ComputerParameters myComputerParameters;
};
class MTKConverter_WallThicknessParameters
{
public:
size_t myResolution = 800;
double mySmoothness = 0.75;
};
class MTKConverter_ExportParameters
{
public:
bool myIsScreenshotGenerationEnabled = true;
bool myIsExportMTKEnabled = false;
};
class MTKConverter_Parameters
{
public:
MTKConverter_ImportParameters myImportParameters;
MTKConverter_NestingParameters myNestingParameters;
MTKConverter_WallThicknessParameters myWallThicknessParameters;
MTKConverter_ExportParameters myExportParameters;
};
class MTKConverter_Application
{
public:
MTKConverter_ReturnCode Run (int argc, char* argv[]) const;
void PrintUsage() const;
};
#endif
Defines parameters of the ModelReader.
Definition ModelReaderParameters.cs:19
MTKConverter_Application.cxx
#include <cadex/Materials/Color.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/ModelData/ModelReaderParameters.hxx>
#include <cadex/View/ImageWriter.hxx>
#include <cadex/View/ImageWriterParameters.hxx>
#include <MTKConverter_Application.hxx>
#include <MTKConverter_MachiningProcessor.hxx>
#include <MTKConverter_MoldingProcessor.hxx>
#include <MTKConverter_NestingProcessor.hxx>
#include <MTKConverter_Report.hxx>
#include <MTKConverter_SheetMetalProcessor.hxx>
#include <MTKConverter_WallThicknessProcessor.hxx>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#if defined(__GNUC__)
#include <sys/stat.h>
#elif !defined(_MSC_VER) || _MSC_VER > 1900
#include <filesystem>
#endif
namespace {
enum class MTKConverter_ProcessType
{
Undefined = -1,
WallThickness = 0,
MachiningMilling,
MachiningTurning,
Molding,
SheetMetal,
Nesting
};
enum class MTKConverter_ArgumentType
{
Neutral,
Import,
Process,
Export
};
class MTKConverter_Argument
{
public:
MTKConverter_ArgumentType myArgumentType;
};
MTKConverter_ProcessType FindProcessType (
const UTF16String& theProcessName)
{
static std::unordered_map<UTF16String, MTKConverter_ProcessType, UTF16StringHash> theProcessMap {
{ "wall_thickness", MTKConverter_ProcessType::WallThickness },
{ "machining_milling", MTKConverter_ProcessType::MachiningMilling },
{ "machining_turning", MTKConverter_ProcessType::MachiningTurning },
{ "molding", MTKConverter_ProcessType::Molding },
{ "sheet_metal", MTKConverter_ProcessType::SheetMetal },
{ "nesting", MTKConverter_ProcessType::Nesting }
};
auto aRes = theProcessMap.find (theProcessName);
if (aRes != theProcessMap.end()) {
return aRes->second;
}
return MTKConverter_ProcessType::Undefined;
}
MTKConverter_ReturnCode Import (
const MTKConverter_ImportParameters& theImportParameters)
{
std::cout << "Importing " << theFilePath << "..." << std::flush;
aReader.
SetParameters (theImportParameters.myReaderParameters);
if (!aReader.
Read (theFilePath, theModel)) {
std::cerr << std::endl << "ERROR: Failed to import " << theFilePath << ". Exiting" << std::endl;
return MTKConverter_ReturnCode::ImportError;
}
return MTKConverter_ReturnCode::Ok;
}
MTKConverter_ReturnCode Process (
MTKConverter_Report& theReport,
const MTKConverter_Parameters& theParameters = MTKConverter_Parameters())
{
std::cout << "Processing " << theProcess << "..." << std::flush;
auto anApplyPartProcessorToModel = [&theModel, &theReport] (MTKConverter_PartProcessor& theProcessor)
{
for (const auto& i : theProcessor.myData) {
theReport.AddData (i);
}
return MTKConverter_ReturnCode::Ok;
};
auto anApplyDrawingProcessorToModel =
[&theModel, &theProcessModel, &theReport] (MTKConverter_DrawingProcessor& theProcessor)
{
if (!aDrawing) {
aDrawing = theModel.
Drawing();
}
if (!aDrawing) {
std::cerr << std::endl
<< "ERROR: Drawing is required, but none was found in the process/source model." << std::endl;
return MTKConverter_ReturnCode::ProcessError;
}
if (!theProcessor.Apply (aDrawing)) {
return MTKConverter_ReturnCode::ProcessError;
}
for (const auto& i : theProcessor.myData) {
theReport.AddData (i);
}
return MTKConverter_ReturnCode::Ok;
};
switch (FindProcessType (theProcess)) {
case MTKConverter_ProcessType::WallThickness: {
theProcessModel.SetName ("extra");
MTKConverter_WallThicknessProcessor
aProcessor (theProcessModel, theParameters.myWallThicknessParameters);
return anApplyPartProcessorToModel (aProcessor);
}
case MTKConverter_ProcessType::MachiningMilling: {
MTKConverter_MachiningProcessor aProcessor (Machining_OT_Milling);
return anApplyPartProcessorToModel (aProcessor);
}
case MTKConverter_ProcessType::MachiningTurning: {
MTKConverter_MachiningProcessor aProcessor (Machining_OT_LatheMilling);
return anApplyPartProcessorToModel (aProcessor);
}
case MTKConverter_ProcessType::Molding: {
theProcessModel.SetName (theModel.
Name() +
"_extra");
MTKConverter_MoldingProcessor aProcessor (theProcessModel);
return anApplyPartProcessorToModel (aProcessor);
}
case MTKConverter_ProcessType::SheetMetal: {
theProcessModel.SetName (theModel.
Name() +
"_unfolded");
MTKConverter_SheetMetalProcessor aProcessor (theProcessModel);
return anApplyPartProcessorToModel (aProcessor);
}
case MTKConverter_ProcessType::Nesting: {
theProcessModel.SetName (theModel.
Name() +
"_nested");
MTKConverter_NestingProcessor aProcessor (theProcessModel, theParameters.myNestingParameters);
return anApplyDrawingProcessorToModel (aProcessor);
}
default: return MTKConverter_ReturnCode::InvalidArgument;
}
}
{
auto aParameters = aWriter.
Parameters();
aParameters.
SetImageHeight (800);
aParameters.SetImageWidth (600);
aParameters.SetViewCameraProjection (View::CameraProjectionType::Perspective);
aParameters.SetViewCameraPosition (View::CameraPositionType::Default);
aParameters.SetViewIsFitAll (true);
aParameters.SetViewAntialiasing (View::AntialiasingMode::High);
aWriter.
SetParameters (aParameters);
bool aRes = aWriter.
WriteFile (theModel, theFilePath);
return aRes;
}
MTKConverter_ReturnCode Export (
const MTKConverter_ExportParameters& theExportParameters,
const MTKConverter_Report& theReport,
{
std::cout << "Exporting " << theFolderPath << "..." << std::flush;
#if defined(_MSC_VER) && _MSC_VER < 1910
(void)theReport;
(void)theModel;
(void)theProcessModel;
std::cout << "Use the Microsoft Visual C++ 2019 (VC14.2) compiler or newer." << std::flush;
return MTKConverter_ReturnCode::Ok;
#else
#if defined(__GNUC__)
mkdir (theFolderPath.ToString().c_str(), 0755);
#else
std::filesystem::create_directory (theFolderPath.ToString());
#endif
{
UTF16String aPath = theFolderPath +
"/" + theBaseName +
".mtkweb" +
"/scenegraph.mtkweb";
if (!theModelToExport.
Save (aPath, ModelData::Model::FileFormatType::MTKWEB)) {
std::cerr << std::endl << "ERROR: Failed to export " << aPath << ". Exiting" << std::endl;
return false;
}
return true;
};
{
std::string aSanitizedBaseName = theBaseName.ToString();
std::replace (aSanitizedBaseName.begin(), aSanitizedBaseName.end(), '.', '_');
aPath += "_processed.mtk";
if (!theModelToExport.Save (aPath, ModelData::Model::FileFormatType::MTK)) {
std::cerr << std::endl << "ERROR: Failed to save MTK model " << aPath << ". Exiting" << std::endl;
return false;
}
return true;
};
if (!anExportMTKWEB (theModel, aModelBaseName)) {
return MTKConverter_ReturnCode::ExportError;
}
UTF16String aThumbnailPath = theFolderPath +
"/thumbnail.png";
if (theExportParameters.myIsScreenshotGenerationEnabled && !CreateOriginModelThumbnail (aThumbnailPath, theModel)) {
std::cerr << std::endl << "ERROR: Failed to create thumbnail " << aThumbnailPath << ". Exiting" << std::endl;
return MTKConverter_ReturnCode::ExportError;
}
if (!theProcessModel.
IsEmpty() || theProcessModel.Drawing()) {
if (!anExportMTKWEB (theProcessModel, aProcessedBaseName)) {
return MTKConverter_ReturnCode::ExportError;
}
if (theExportParameters.myIsExportMTKEnabled) {
if (!anExportMTK (theProcessModel, aProcessedBaseName)) {
return MTKConverter_ReturnCode::ExportError;
}
}
}
UTF16String aJsonPath = theFolderPath +
"/process_data.json";
if (!theReport.WriteToJSON (aJsonPath)) {
std::cerr << std::endl << "ERROR: Failed to create JSON file " << aJsonPath << ". Exiting" << std::endl;
return MTKConverter_ReturnCode::ExportError;
}
return MTKConverter_ReturnCode::Ok;
#endif
}
MTKConverter_ReturnCode ParseArguments (
int argc,
char* argv[],
MTKConverter_Parameters& theParameters,
std::vector<MTKConverter_Argument>& theArguments)
{
auto anAgrumentType = MTKConverter_ArgumentType::Neutral;
for (int i = 1; i < argc; ++i) {
if (anArgument == "--no-screenshot") {
theParameters.myExportParameters.myIsScreenshotGenerationEnabled = false;
} else if (anArgument == "--export_mtk") {
theParameters.myExportParameters.myIsExportMTKEnabled = true;
} else if (anArgument == "--sheet_size") {
if (i + 2 >= argc) {
std::cerr << "ERROR: Missing values for --sheet_size. "
<< "Use --sheet_size <L> <W> with values > 0." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
const double aSheetLength = std::atof (argv[++i]);
const double aSheetWidth = std::atof (argv[++i]);
if (aSheetLength <= 0.0 || aSheetWidth <= 0.0) {
std::cerr << "ERROR: Invalid sheet size. "
<< "Use --sheet_size <L> <W> with values > 0." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
theParameters.myNestingParameters.myMaterialParameters.myLength = aSheetLength;
theParameters.myNestingParameters.myMaterialParameters.myWidth = aSheetWidth;
} else if (anArgument == "--pattern_count") {
if (i + 1 >= argc) {
std::cerr << "ERROR: Missing value for --pattern_count. "
<< "Use --pattern_count <N> with value > 0." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
const int aPatternRepeatCount = std::atoi (argv[++i]);
if (aPatternRepeatCount <= 0) {
std::cerr << "ERROR: Invalid pattern count. "
<< "Use --pattern_count <N> with value > 0." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
theParameters.myNestingParameters.myPatternRepeatCount = static_cast<size_t> (aPatternRepeatCount);
} else if (anArgument == "--nesting_mode") {
if (i + 1 >= argc) {
std::cerr << "ERROR: Missing value for --nesting_mode. "
<< "Use --nesting_mode per_sheet|all_sheets." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
if (aNestingModeArg == "per_sheet") {
theParameters.myNestingParameters.myMode = MTKConverter_NestingParameters::NestingMode::PerSheet;
} else if (aNestingModeArg == "all_sheets") {
theParameters.myNestingParameters.myMode =
MTKConverter_NestingParameters::NestingMode::AllSheets;
} else {
std::cerr << "ERROR: Invalid nesting mode \"" << aNestingModeArg
<< "\". Use --nesting_mode per_sheet|all_sheets." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
} else if (anArgument == "-i") {
anAgrumentType = MTKConverter_ArgumentType::Import;
} else if (anArgument == "-p") {
anAgrumentType = MTKConverter_ArgumentType::Process;
} else if (anArgument == "-e") {
anAgrumentType = MTKConverter_ArgumentType::Export;
} else {
switch (anAgrumentType) {
case MTKConverter_ArgumentType::Import:
theArguments.push_back (MTKConverter_Argument { MTKConverter_ArgumentType::Import, anArgument });
break;
case MTKConverter_ArgumentType::Process: {
const auto aProcessType = FindProcessType (anArgument);
if (aProcessType == MTKConverter_ProcessType::Undefined) {
std::cerr << "ERROR: Unknown process \"" << anArgument << "\"." << std::endl;
std::cerr << "Type " << argv[0] << " -h for recognized processes." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
if (aProcessType == MTKConverter_ProcessType::Nesting) {
theParameters.myImportParameters.myReaderParameters.SetReadDrawing (true);
}
theArguments.push_back (MTKConverter_Argument { MTKConverter_ArgumentType::Process, anArgument });
break;
}
case MTKConverter_ArgumentType::Export:
theArguments.push_back (MTKConverter_Argument { MTKConverter_ArgumentType::Export, anArgument });
break;
case MTKConverter_ArgumentType::Neutral:
default:
std::cerr << "ERROR!: Invalid argument " << anArgument << ". Exiting" << std::endl;
std::cerr << "Type " << argv[0] << " -h for help." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
}
}
if (theArguments.empty()) {
std::cerr << "ERROR: No commands specified. Use -i/-p/-e." << std::endl;
return MTKConverter_ReturnCode::InvalidArgument;
}
return MTKConverter_ReturnCode::Ok;
}
MTKConverter_ReturnCode Execute (
const std::vector<MTKConverter_Argument>& theArguments,
const MTKConverter_Parameters& theParameters)
{
MTKConverter_Report aReport;
auto aResultCode = MTKConverter_ReturnCode::Ok;
for (const auto& anArgument : theArguments) {
if (aResultCode != MTKConverter_ReturnCode::Ok) {
break;
}
try {
switch (anArgument.myArgumentType) {
case MTKConverter_ArgumentType::Import:
aResultCode = Import (anArgument.myValue, aModel, theParameters.myImportParameters);
if (aResultCode == MTKConverter_ReturnCode::Ok) {
}
break;
case MTKConverter_ArgumentType::Process:
aResultCode = Process (anArgument.myValue, aModel, aReport, aProcessModel, theParameters);
break;
case MTKConverter_ArgumentType::Export:
aResultCode = Export (
anArgument.myValue,
theParameters.myExportParameters,
aModel,
aReport,
aProcessModel);
break;
default: aResultCode = MTKConverter_ReturnCode::InvalidArgument; break;
}
if (aResultCode == MTKConverter_ReturnCode::Ok) {
std::cout << "Done." << std::endl;
}
} catch (...) {
std::cerr << "Failed.\nERROR: Unhandled exception caught." << std::endl;
return MTKConverter_ReturnCode::GeneralException;
}
}
return aResultCode;
}
}
MTKConverter_ReturnCode MTKConverter_Application::Run (int argc, char* argv[]) const
{
if (argc == 1 ||
(!strcmp (argv[1], "-?") || !strcmp (argv[1], "/?") || !strcmp (argv[1], "-h") ||
!strcmp (argv[1], "--help"))) {
PrintUsage();
return MTKConverter_ReturnCode::Ok;
}
if (argc < 6) {
std::cerr << "Invalid number of arguments. Please use \"-h\" or \"--help\" for usage information." << std::endl;
return MTKConverter_ReturnCode::InvalidArgumentsNumber;
}
MTKConverter_Parameters aProcessParameters;
std::vector<MTKConverter_Argument> anArguments;
auto aParseRes = ParseArguments (argc, argv, aProcessParameters, anArguments);
if (aParseRes != MTKConverter_ReturnCode::Ok) {
return aParseRes;
}
return Execute (anArguments, aProcessParameters);
}
void MTKConverter_Application::PrintUsage() const
{
std::cout << "Usage:" << std::endl;
std::cout << "MTKConverter -i <import_file> -p <process> ... -e <export_target> [options]" << std::endl;
std::cout << std::endl << "Arguments:" << std::endl;
std::cout << " <import_file> - import file name" << std::endl;
std::cout << " <process> - manufacturing process or algorithm name" << std::endl;
std::cout << " <export_target> - export folder name" << std::endl;
std::cout << std::endl << "Export Options:" << std::endl;
std::cout << " --no-screenshot - disable screenshot generation (optional)" << std::endl;
std::cout << " --export_mtk - additionally save process model as *.mtk in <export_target>"
<< std::endl;
std::cout << std::endl << "Example:" << std::endl;
std::cout << "MTKConverter -i C:\\models\\test.step -p machining_milling -e C:\\models\\out" << std::endl;
std::cout << "MTKConverter -i C:\\models\\test.step -p nesting -e C:\\models\\out --export_mtk" << std::endl;
std::cout
<< "MTKConverter -i C:\\models\\test.step -p sheet_metal -e C:\\models\\out -p nesting --nesting_mode all_sheets --sheet_size 500 500 --pattern_count 4 -e C:\\models\\out --export_mtk"
<< std::endl;
std::cout << std::endl << "Recognized processes:" << std::endl;
std::cout << " wall_thickness :\t Wall Thickness analysis" << std::endl;
std::cout << " machining_milling:\t CNC Machining Milling feature recognition and DFM analysis" << std::endl;
std::cout << " machining_turning:\t CNC Machining Lathe+Milling feature recognition and DFM analysis" << std::endl;
std::cout << " molding :\t Molding feature recognition and DFM analysis" << std::endl;
std::cout << " sheet_metal :\t Sheet Metal feature recognition, unfolding and DFM analysis" << std::endl;
std::cout << " nesting :\t Nesting using source drawing or sheet metal unfolding drawing" << std::endl;
std::cout << " parameters :\t --sheet_size <L> <W> (default: 500 500)" << std::endl;
std::cout << " :\t --pattern_count <N> (default: 4)" << std::endl;
std::cout << " :\t --nesting_mode per_sheet|all_sheets (default: per_sheet)" << std::endl;
}
Defines an RGBA color (with alpha channel).
Definition Color.cs:19
Defines a visitor that visits each unique element only once.
Definition ModelElementUniqueVisitor.cs:25
void Accept(cadex.ModelData.ModelElementVisitor theVisitor)
Accepts a visitor.
Definition Model.cs:176
void AssignUuids()
Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned ye...
Definition Model.cs:171
bool IsEmpty()
Returns true if the model has no roots, i.e.
Definition Model.cs:100
cadex.UTF16String Name()
Returns empty string if the model has no name (by default).
Definition Model.cs:90
Reads supported formats, see Import section.
Definition ModelReader.cs:17
bool Read(cadex.UTF16String theFilePath, cadex.ModelData.Model theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cs:82
Defines color background style.
Definition ColorBackgroundStyle.cs:17
Writes an image file with graphical content of a model.
Definition ImageWriter.cs:17
main.cxx
#include <cadex/LicenseManager_Activate.h>
#include <MTKConverter_Application.hxx>
#include <iostream>
#include "../../mtk_license.cxx"
using namespace std;
int main (int argc, char* argv[])
{
auto aKey = MTKLicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate Manufacturing Toolkit license." << endl;
return 1;
}
MTKConverter_Application anApp;
return static_cast<int> (anApp.Run (argc, argv));
}