Hide menu
Loading...
Searching...
No Matches
MTKConverter/main.cxx

Refer to the MTK Converter Example

MTKConverter_PartProcessor.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#ifndef _MTKConverter_PartProcessor_HeaderFile
#define _MTKConverter_PartProcessor_HeaderFile
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/Part.hxx>
#include <deque>
namespace cadex {
namespace ModelData {
class Shell;
class Solid;
}
}
class MTKConverter_ProcessData
{
protected:
MTKConverter_ProcessData (const cadex::ModelData::Part& thePart) : myPart (thePart)
{}
public:
virtual ~MTKConverter_ProcessData() {}
};
class MTKConverter_PartProcessor : public cadex::ModelData::ModelElementVoidVisitor
{
public:
typedef std::shared_ptr<MTKConverter_ProcessData> DataType;
void operator() (const cadex::ModelData::Part& thePart) override;
virtual ~MTKConverter_PartProcessor() {}
std::deque<DataType> myData;
protected:
virtual void ProcessSolid (const cadex::ModelData::Part& thePart, const cadex::ModelData::Solid& theSolid) = 0;
virtual void ProcessShell (const cadex::ModelData::Part& thePart, const cadex::ModelData::Shell& theShell) = 0;
virtual void PostPartProcess (const cadex::ModelData::Part& thePart) = 0;
};
class MTKConverter_VoidPartProcessor : public MTKConverter_PartProcessor
{
protected:
void ProcessSolid (const cadex::ModelData::Part&, const cadex::ModelData::Solid&) override {}
void ProcessShell (const cadex::ModelData::Part&, const cadex::ModelData::Shell&) override {}
void PostPartProcess (const cadex::ModelData::Part&) override {}
};
#endif
Element visitor with empty implementation.
Definition ModelElementVisitor.hxx:64
Defines a leaf node in the scene graph hiearchy.
Definition Part.hxx:34
Defines a connected set of faces.
Definition Shell.hxx:32
Defines a topological solid.
Definition Solid.hxx:32
Defines classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30

MTKConverter_PartProcessor.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#include <cadex/ModelData/Body.hxx>
#include <cadex/ModelData/Shell.hxx>
#include <cadex/ModelData/Solid.hxx>
#include <MTKConverter_PartProcessor.hxx>
using namespace cadex;
void MTKConverter_PartProcessor::operator() (const ModelData::Part& thePart)
{
const auto& aBodies = thePart.Bodies();
for (const auto& aBody : aBodies) {
ModelData::ShapeIterator aShapeIt (aBody);
while (aShapeIt.HasNext()) {
const auto& aShape = aShapeIt.Next();
if (aShape.Type() == ModelData::ShapeType::Solid) {
ProcessSolid (thePart, ModelData::Solid::Cast (aShape));
} else if (aShape.Type() == ModelData::ShapeType::Shell) {
ProcessShell (thePart, ModelData::Shell::Cast (aShape));
}
}
}
PostPartProcess (thePart);
}
Iterates over subshapes in a shape.
Definition ShapeIterator.hxx:32

MTKConverter_MachiningProcessor.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#ifndef _MTKConverter_MachiningProcessor_HeaderFile
#define _MTKConverter_MachiningProcessor_HeaderFile
#include <cadex/Machining_OperationType.hxx>
#include <cadex/MTKBase_FeatureList.hxx>
#include <MTKConverter_PartProcessor.hxx>
namespace cadex {
namespace ModelData {
class Part;
class Solid;
}
}
class MTKConverter_MachiningData : public MTKConverter_ProcessData
{
public:
MTKConverter_MachiningData (const cadex::ModelData::Part& thePart) : MTKConverter_ProcessData (thePart)
{}
};
class MTKConverter_MachiningProcessor : public MTKConverter_VoidPartProcessor
{
public:
MTKConverter_MachiningProcessor (cadex::Machining_OperationType theOperation) : myOperation (theOperation)
{}
protected:
void ProcessSolid (const cadex::ModelData::Part& thePart, const cadex::ModelData::Solid& theSolid) override;
};
#endif
Defines a list of features.
Definition MTKBase_FeatureList.hxx:36
Machining_OperationType
Defines an operation type in machining.
Definition Machining_OperationType.hxx:28

MTKConverter_MachiningProcessor.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#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>
using namespace cadex;
void MTKConverter_MachiningProcessor::ProcessSolid (const ModelData::Part& thePart, const ModelData::Solid& theSolid)
{
auto aMachiningData = std::make_shared<MTKConverter_MachiningData> (thePart);
myData.push_back (aMachiningData);
aMachiningData->myOperation = myOperation;
Machining_FeatureRecognizer aFeatureRecognizer;
aFeatureRecognizer.Parameters().SetOperation (myOperation);
Machining_Analyzer anAnalyzer;
anAnalyzer.AddTool (aFeatureRecognizer);
auto aData = anAnalyzer.Perform (theSolid);
if (aData.IsEmpty()) {
return;
}
//features
aMachiningData->myFeatureList = aData.FeatureList();
//issues
DFMMachining_Analyzer aDrillingAnalyzer (aDrillingParameters);
aMachiningData->myIssueList = aDrillingAnalyzer.Perform (theSolid, aData);
DFMMachining_Analyzer aMillingAnalyzer (aMillingParameters);
MTKBase_FeatureList aMillingIssueList = aMillingAnalyzer.Perform (theSolid, aData);
for (size_t i = 0; i < aMillingIssueList.Size(); ++i) {
const auto& anIssue = aMillingIssueList[i];
if (myOperation == Machining_OT_LatheMilling
&& !anIssue.IsOfType<DFMMachining_DeepPocketIssue>()) {
continue;
}
aMachiningData->myIssueList.Append (anIssue);
}
if (myOperation == Machining_OT_LatheMilling) {
DFMMachining_Analyzer aTurningAnalyzer (aTurninigParameters);
MTKBase_FeatureList aTurningIssueList = aTurningAnalyzer.Perform (theSolid, aData);
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.hxx:43
MTKBase_FeatureList Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Runs analyzing process.
Definition DFMMachining_Analyzer.cxx:112
Describes deep pocket issue found during cnc machining milling design analysis.
Definition DFMMachining_DeepPocketIssue.hxx:30
Defines parameters used in cnc machining drilling design analysis.
Definition DFMMachining_DrillingAnalyzerParameters.hxx:31
Defines parameters used in cnc machining milling design analysis.
Definition DFMMachining_MillingAnalyzerParameters.hxx:36
Defines parameters used in cnc machining turning design analysis.
Definition DFMMachining_TurningAnalyzerParameters.hxx:35
size_t Size() const
Returns the number of elements in the list.
Definition MTKBase_FeatureList.cxx:88
void Append(const MTKBase_Feature &theFeature)
Adds a feature to the list.
Definition MTKBase_FeatureList.cxx:56
Provides an interface to run several analyzer tools for different types of machining processing.
Definition Machining_Analyzer.hxx:42
Machining_Data Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Runs the analyzing process.
Definition Machining_Analyzer.cxx:81
void AddTool(const Machining_AnalyzerTool &theTool)
Adds additional tool to run during analyzing process.
Definition Machining_Analyzer.cxx:101
const MTKBase_FeatureList & FeatureList() const
Definition Machining_Data.cxx:48
Provides an interface to recognizing machining features tool.
Definition Machining_FeatureRecognizer.hxx:45
const Machining_FeatureRecognizerParameters & Parameters() const
Returns parameters.
Definition Machining_FeatureRecognizer.cxx:304
void SetOperation(Machining_OperationType theOperation)
Definition Machining_FeatureRecognizerParameters.cxx:205

MTKConverter_SheetMetalProcessor.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#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>
class MTKConverter_UnfoldedPartData
{
public:
MTKConverter_UnfoldedPartData()
{}
bool IsInit() const { return !!myFlatPattern; }
};
class MTKConverter_SheetMetalData : public MTKConverter_ProcessData
{
public:
MTKConverter_SheetMetalData (const cadex::ModelData::Part& thePart);
bool myIsSheetMetalPart = true;
MTKConverter_UnfoldedPartData myUnfoldedPartData;
};
class MTKConverter_SheetMetalProcessor : public MTKConverter_VoidPartProcessor
{
public:
MTKConverter_SheetMetalProcessor (cadex::ModelData::Model& theUnfoldedModel);
protected:
void ProcessSolid (const cadex::ModelData::Part& thePart, const cadex::ModelData::Solid& theSolid) override;
void ProcessShell (const cadex::ModelData::Part& thePart, const cadex::ModelData::Shell& theShell) override;
void PostPartProcess (const cadex::ModelData::Part& thePart) override;
void UpdateProcessData (const cadex::SheetMetal_Data& theData, const cadex::ModelData::Part& thePart);
cadex::ModelData::Model& myUnfoldedModel;
cadex::ModelData::SheetBody myCurrentUnfoldedBody;
};
#endif
Provides MTK data model.
Definition Model.hxx:40
Provides a sheet body composed of faces and shells.
Definition SheetBody.hxx:34
Provides an interface to run several analyzer tools.
Definition SheetMetal_Analyzer.hxx:42
Contains specific information for sheet metal tools.
Definition SheetMetal_Data.hxx:36
Describes a flat pattern for sheet metal models.
Definition SheetMetal_FlatPattern.hxx:42

MTKConverter_SheetMetalProcessor.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#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 <MTKConverter_SheetMetalProcessor.hxx>
#include <vector>
using namespace cadex;
MTKConverter_SheetMetalData::MTKConverter_SheetMetalData (const cadex::ModelData::Part& thePart) :
MTKConverter_ProcessData (thePart)
{}
MTKConverter_SheetMetalProcessor::MTKConverter_SheetMetalProcessor (cadex::ModelData::Model& theUnfoldedModel) :
myUnfoldedModel (theUnfoldedModel)
{
myAnalyzer.AddTool (SheetMetal_FeatureRecognizer());
myAnalyzer.AddTool (SheetMetal_Unfolder());
}
void MTKConverter_SheetMetalProcessor::ProcessSolid (
const cadex::ModelData::Part& thePart, const cadex::ModelData::Solid& theSolid)
{
auto anSMData = myAnalyzer.Perform (theSolid);
UpdateProcessData (anSMData, thePart);
}
void MTKConverter_SheetMetalProcessor::ProcessShell (
const cadex::ModelData::Part& thePart, const cadex::ModelData::Shell& theShell)
{
auto anSMData = myAnalyzer.Perform (theShell);
UpdateProcessData (anSMData, thePart);
}
void MTKConverter_SheetMetalProcessor::PostPartProcess (const ModelData::Part& thePart)
{
if (myCurrentUnfoldedBody.Shapes().empty()) {
return;
}
ModelData::Part anUnfoldedPart (thePart.Name());
anUnfoldedPart.SetUuid (thePart.Uuid());
anUnfoldedPart.AddBody (myCurrentUnfoldedBody);
myUnfoldedModel.AddRoot (anUnfoldedPart);
myCurrentUnfoldedBody = ModelData::SheetBody();
}
void MTKConverter_SheetMetalProcessor::UpdateProcessData (
const cadex::SheetMetal_Data& theData, const cadex::ModelData::Part& thePart)
{
auto anSMData = std::make_shared<MTKConverter_SheetMetalData> (thePart);
myData.push_back (anSMData);
if (theData.IsEmpty()) {
anSMData->myIsSheetMetalPart = false;
return;
}
anSMData->myFeatureList = theData.FeatureList();
const auto& aFlatPattern = theData.FlatPattern();
const auto& anUnfoldedShell = aFlatPattern ? aFlatPattern.UnfoldedShell() : ModelData::Shell();
auto& anUnfoldedData = anSMData->myUnfoldedPartData;
if (anUnfoldedShell) {
myCurrentUnfoldedBody.Append (anUnfoldedShell);
anUnfoldedData.myFlatPattern = aFlatPattern;
}
DFMSheetMetal_Analyzer aDFMAnalyzer;
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);
}
}
}
Provides an interface to run DFM Sheet Metal analysis.
Definition DFMSheetMetal_Analyzer.hxx:44
MTKBase_FeatureList Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Definition DFMSheetMetal_Analyzer.cxx:1565
Describes interference issue for flat pattern found during sheet metal design analysis.
Definition DFMSheetMetal_FlatPatternInterferenceIssue.hxx:32
Describes non standard sheet size issue found during sheet metal design analysis.
Definition DFMSheetMetal_NonStandardSheetSizeIssue.hxx:30
Describes non standard sheet thickness issue found during sheet metal design analysis.
Definition DFMSheetMetal_NonStandardSheetThicknessIssue.hxx:28
UTF16String Name() const
Returns a name.
Definition ModelElement.cxx:55
cadex::Uuid Uuid() const
Returns an object uuid.
Definition ModelElement.cxx:76
bool IsEmpty() const
Returns true if the data is empty.
Definition SheetMetal_Data.cxx:83
const SheetMetal_FlatPattern & FlatPattern() const
Definition SheetMetal_Data.cxx:77
const MTKBase_FeatureList & FeatureList() const
Definition SheetMetal_Data.cxx:68
Provides an interface to recognizing sheet metal features tool. Is used for recognition of features s...
Definition SheetMetal_FeatureRecognizer.hxx:38
ModelData::Shell UnfoldedShell() const
Returns the unfolded shell for flat pattern.
Definition SheetMetal_FlatPattern.cxx:200
Is used to unfold sheet metal models.
Definition SheetMetal_Unfolder.hxx:39

MTKConverter_Report.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#ifndef _MTKConverter_Report_HeaderFile
#define _MTKConverter_Report_HeaderFile
#include <deque>
#include <memory>
namespace cadex {
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); }
bool WriteToJSON (const cadex::UTF16String& thePath) const;
private:
std::deque<DataType> myData;
};
#endif
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition UTF16String.hxx:30

MTKConverter_Report.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/DFMMachining_DeepBoredHoleIssue.hxx>
#include <cadex/DFMMachining_DeepHoleIssue.hxx>
#include <cadex/DFMMachining_DeepPocketIssue.hxx>
#include <cadex/DFMMachining_FlatBottomHoleIssue.hxx>
#include <cadex/DFMMachining_HighBossIssue.hxx>
#include <cadex/DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.hxx>
#include <cadex/DFMMachining_IntersectingCavityHoleIssue.hxx>
#include <cadex/DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.hxx>
#include <cadex/DFMMachining_LargeMilledPartIssue.hxx>
#include <cadex/DFMMachining_LargeTurnedPartIssue.hxx>
#include <cadex/DFMMachining_LongSlenderTurnedPartIssue.hxx>
#include <cadex/DFMMachining_MilledPartExternalEdgeFilletIssue.hxx>
#include <cadex/DFMMachining_MilledPartSize.hxx>
#include <cadex/DFMMachining_NonPerpendicularHoleIssue.hxx>
#include <cadex/DFMMachining_NonPerpendicularMilledPartShapeIssue.hxx>
#include <cadex/DFMMachining_NonStandardDiameterHoleIssue.hxx>
#include <cadex/DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.hxx>
#include <cadex/DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.hxx>
#include <cadex/DFMMachining_NonSymmetricalAxialSlotIssue.hxx>
#include <cadex/DFMMachining_PartialHoleIssue.hxx>
#include <cadex/DFMMachining_SmallDepthBlindBoredHoleReliefIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDepthLouverIssue.hxx>
#include <cadex/DFMMachining_SmallDiameterHoleIssue.hxx>
#include <cadex/DFMMachining_SmallRadiusMilledPartInternalCornerIssue.hxx>
#include <cadex/DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.hxx>
#include <cadex/DFMMachining_SmallWallThicknessIssue.hxx>
#include <cadex/DFMMachining_SquareEndKeywayIssue.hxx>
#include <cadex/DFMMachining_TurnedPartSize.hxx>
#include <cadex/DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.hxx>
#include <cadex/DFMMachining_NarrowRegionInPocketIssue.hxx>
#include <cadex/DFMMolding_HighRibIssue.hxx>
#include <cadex/DFMMolding_HighScrewBossIssue.hxx>
#include <cadex/DFMMolding_IrregularCoreDepthScrewBossIssue.hxx>
#include <cadex/DFMMolding_IrregularCoreDiameterScrewBossIssue.hxx>
#include <cadex/DFMMolding_IrregularThicknessRibIssue.hxx>
#include <cadex/DFMMolding_IrregularWallThicknessIssue.hxx>
#include <cadex/DFMMolding_IrregularWallThicknessScrewBossIssue.hxx>
#include <cadex/DFMMolding_LargeWallThicknessIssue.hxx>
#include <cadex/DFMMolding_RibIssue.hxx>
#include <cadex/DFMMolding_ScrewBossIssue.hxx>
#include <cadex/DFMMolding_SmallBaseRadiusRibIssue.hxx>
#include <cadex/DFMMolding_SmallBaseRadiusScrewBossIssue.hxx>
#include <cadex/DFMMolding_SmallDistanceBetweenBossesIssue.hxx>
#include <cadex/DFMMolding_SmallDraftAngleRibIssue.hxx>
#include <cadex/DFMMolding_SmallDraftAngleScrewBossIssue.hxx>
#include <cadex/DFMMolding_SmallDraftAngleWallIssue.hxx>
#include <cadex/DFMMolding_SmallDistanceBetweenRibsIssue.hxx>
#include <cadex/DFMMolding_SmallHoleBaseRadiusScrewBossIssue.hxx>
#include <cadex/DFMMolding_NonChamferedScrewBossIssue.hxx>
#include <cadex/DFMSheetMetal_FlatPatternInterferenceIssue.hxx>
#include <cadex/DFMSheetMetal_InconsistentRadiusBendIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularDepthExtrudedHoleIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularRadiusOpenHemBendIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularSizeBendReliefIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularSizeNotchIssue.hxx>
#include <cadex/DFMSheetMetal_IrregularSizeTabIssue.hxx>
#include <cadex/DFMSheetMetal_LargeDepthBeadIssue.hxx>
#include <cadex/DFMSheetMetal_NonStandardSheetSizeIssue.hxx>
#include <cadex/DFMSheetMetal_NonStandardSheetThicknessIssue.hxx>
#include <cadex/DFMSheetMetal_SheetSize.hxx>
#include <cadex/DFMSheetMetal_SmallDiameterHoleIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenHolesIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenNotchesIssue.hxx>
#include <cadex/DFMSheetMetal_SmallDistanceBetweenTabsIssue.hxx>
#include <cadex/DFMSheetMetal_SmallLengthFlangeIssue.hxx>
#include <cadex/DFMSheetMetal_SmallLengthHemBendFlangeIssue.hxx>
#include <cadex/DFMSheetMetal_SmallRadiusBendIssue.hxx>
#include <cadex/DFMMolding_SmallWallThicknessIssue.hxx>
#include <cadex/Geom/Axis1d.hxx>
#include <cadex/Geom/Axis3d.hxx>
#include <cadex/Geom/Direction.hxx>
#include <cadex/Machining_Face.hxx>
#include <cadex/Machining_Hole.hxx>
#include <cadex/Machining_Countersink.hxx>
#include <cadex/Machining_Pocket.hxx>
#include <cadex/Machining_SteppedHole.hxx>
#include <cadex/Machining_TurningFace.hxx>
#include <cadex/ModelData/Body.hxx>
#include <cadex/ModelData/Edge.hxx>
#include <cadex/ModelData/Face.hxx>
#include <cadex/ModelData/Part.hxx>
#include <cadex/ModelData/Shape.hxx>
#include <cadex/ModelData/Shell.hxx>
#include <cadex/Molding_Rib.hxx>
#include <cadex/Molding_ScrewBoss.hxx>
#include <cadex/MTKBase_Boss.hxx>
#include <cadex/SheetMetal_Bead.hxx>
#include <cadex/SheetMetal_Bend.hxx>
#include <cadex/SheetMetal_BendRelief.hxx>
#include <cadex/SheetMetal_Bridge.hxx>
#include <cadex/SheetMetal_ComplexHole.hxx>
#include <cadex/SheetMetal_CompoundBend.hxx>
#include <cadex/SheetMetal_CurvedBend.hxx>
#include <cadex/SheetMetal_Cutout.hxx>
#include <cadex/SheetMetal_HemBend.hxx>
#include <cadex/SheetMetal_HemBendType.hxx>
#include <cadex/SheetMetal_Hole.hxx>
#include <cadex/SheetMetal_Louver.hxx>
#include <cadex/SheetMetal_StraightNotch.hxx>
#include <cadex/SheetMetal_Tab.hxx>
#include <cadex/SheetMetal_VNotch.hxx>
#include <cadex/MTKBase_FeatureComparator.hxx>
#include <MTKConverter_Report.hxx>
#include <MTKConverter_MachiningProcessor.hxx>
#include <MTKConverter_MoldingProcessor.hxx>
#include <MTKConverter_SheetMetalProcessor.hxx>
#include <MTKConverter_WallThicknessProcessor.hxx>
#include <algorithm>
#include <array>
#include <cmath>
#include <fstream>
#include <functional>
#include <iomanip>
#include <map>
#include <sstream>
#include <vector>
using namespace cadex;
namespace {
typedef std::pair<double, double> PairType;
typedef std::array<double, 3> ArrayType;
inline std::ostream& operator<< (std::ostream& theStream, const PairType& thePair)
{
return theStream << thePair.first << " x " << thePair.second;
}
inline std::ostream& operator<< (std::ostream& theStream, const Geom::Direction& theDir)
{
return theStream << "(" << theDir.X() << ", " << theDir.Y() << ", " << theDir.Z() << ")";
}
inline std::ostream& operator<< (std::ostream& theStream, const Geom::Point& thePoint)
{
return theStream << "(" << thePoint.X() << ", " << thePoint.Y() << ", " << thePoint.Z() << ")";
}
inline std::ostream& operator<< (std::ostream& theStream, const ArrayType& theArray)
{
return theStream << theArray[0] << " x " << theArray[1] << " x " << theArray[2];
}
class JSONWriter
{
public:
JSONWriter (std::ostream& theStream, int theStartNestingLevel = 0) : myStream (theStream),
myNestingLevel (theStartNestingLevel),
myPrevNestingLevel (theStartNestingLevel - 1)
{}
void OpenSection()
{
DoOpenSection (nullptr, '{');
}
void OpenSection (const char* theName)
{
DoOpenSection (theName, '{');
}
void OpenArraySection (const char* theName)
{
DoOpenSection (theName, '[');
}
void CloseSection()
{
DoCloseSection ('}');
}
void CloseArraySection()
{
DoCloseSection (']');
}
template<typename T>
void WriteData (const char* theParamName, const T& theValue)
{
Stream() << "\"" << theParamName << "\": \"" << theValue << "\"";
}
void WriteRawData (const std::string& theRawData)
{
PrepareStream();
myStream << theRawData;
}
void WriteEmptyArray (const char* theParamName)
{
Stream() << "\"" << theParamName << "\": []";
}
int NestingLevel() const { return myNestingLevel; }
private:
void DoOpenSection (const char* theName, char theOpenBracketSymbol)
{
auto& aStream = Stream();
if (theName) {
aStream << "\"" << theName << "\": ";
}
aStream << theOpenBracketSymbol;
++myNestingLevel;
}
void DoCloseSection (char theCloseBracketSymbol)
{
--myNestingLevel;
Stream() << theCloseBracketSymbol;
}
void PrepareStream()
{
if (myNestingLevel == myPrevNestingLevel) {
myStream << ",";
}
myPrevNestingLevel = myNestingLevel;
if (myIsInit) {
myStream << std::endl;
}
myIsInit = true;
}
std::ostream& Stream()
{
PrepareStream();
for (int i = 0; i < myNestingLevel; ++i) {
myStream << " ";
}
return myStream;
}
std::ostream& myStream;
bool myIsInit = false;
int myNestingLevel;
int myPrevNestingLevel;
};
typedef std::vector<size_t> ShapeIDVectorType;
typedef std::vector<ShapeIDVectorType> ShapeIDVectorVectorType;
typedef std::shared_ptr<MTKConverter_ProcessData> DataType;
typedef std::map<MTKBase_Feature,
std::pair<size_t, ShapeIDVectorVectorType>,
MTKBase_FeatureComparator> FeatureMapType;
typedef std::vector<FeatureMapType::value_type> TypedFeatureVecType;
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();
}
void WriteShapeIDs (JSONWriter& theWriter, const ShapeIDVectorVectorType& theVector)
{
if (theVector.empty()) {
return;
}
theWriter.WriteData ("featureCount", theVector.size());
theWriter.OpenArraySection ("features");
for (const auto& aShapeIDVector : theVector) {
theWriter.OpenSection();
theWriter.WriteData ("shapeIDCount", aShapeIDVector.size());
if (aShapeIDVector.empty()) {
theWriter.WriteEmptyArray ("shapeIDs");
} else {
theWriter.OpenArraySection ("shapeIDs");
for (auto aShapeID : aShapeIDVector) {
theWriter.OpenSection();
theWriter.WriteData ("id", aShapeID);
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
template <typename F>
std::string DoWriteFeatureDataToString (const F& theFunc,
int theParamCount,
const ShapeIDVectorVectorType& theVector)
{
std::stringstream aStream;
aStream << std::fixed << std::setprecision (2);
JSONWriter aWriter (aStream, 7);
aWriter.OpenSection();
aWriter.WriteData ("parametersCount", theParamCount);
aWriter.OpenArraySection ("parameters");
theFunc (aWriter);
aWriter.CloseArraySection();
WriteShapeIDs (aWriter, theVector);
aWriter.CloseSection();
return aStream.str();
}
std::string WriteFeatureDataToString (const ShapeIDVectorVectorType& theVector)
{
std::stringstream aStream;
JSONWriter aWriter (aStream, 6);
WriteShapeIDs (aWriter, theVector);
return aStream.str();
}
template <typename T>
std::string WriteFeatureDataToString (const char* theParamName,
const char* theParamUnits,
const T& theParamValue,
const ShapeIDVectorVectorType& theVector)
{
auto WriteParams = [&] (JSONWriter& theWriter) {
WriteParameter (theWriter, theParamName, theParamUnits, theParamValue);
};
return DoWriteFeatureDataToString (WriteParams, 1, theVector);
}
template <typename T1, typename T2>
std::string WriteFeatureDataToString (const char* theParamName1,
const char* theParamUnits1,
const T1& theParamValue1,
const char* theParamName2,
const char* theParamUnits2,
const T2& theParamValue2,
const ShapeIDVectorVectorType& theVector)
{
auto WriteParams = [&] (JSONWriter& theWriter) {
WriteParameter (theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter (theWriter, theParamName2, theParamUnits2, theParamValue2);
};
return DoWriteFeatureDataToString (WriteParams, 2, theVector);
}
template <typename T1, typename T2, typename T3>
std::string WriteFeatureDataToString (const char* theParamName1,
const char* theParamUnits1,
const T1& theParamValue1,
const char* theParamName2,
const char* theParamUnits2,
const T2& theParamValue2,
const char* theParamName3,
const char* theParamUnits3,
const T3& theParamValue3,
const ShapeIDVectorVectorType& theVector)
{
auto WriteParams = [&] (JSONWriter& theWriter) {
WriteParameter (theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter (theWriter, theParamName2, theParamUnits2, theParamValue2);
WriteParameter (theWriter, theParamName3, theParamUnits3, theParamValue3);
};
return DoWriteFeatureDataToString (WriteParams, 3, theVector);
}
template <typename T1, typename T2, typename T3, typename T4>
std::string WriteFeatureDataToString (const char* theParamName1,
const char* theParamUnits1,
const T1& theParamValue1,
const char* theParamName2,
const char* theParamUnits2,
const T2& theParamValue2,
const char* theParamName3,
const char* theParamUnits3,
const T3& theParamValue3,
const char* theParamName4,
const char* theParamUnits4,
const T4& theParamValue4,
const ShapeIDVectorVectorType& theVector)
{
auto WriteParams = [&] (JSONWriter& theWriter) {
WriteParameter (theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter (theWriter, theParamName2, theParamUnits2, theParamValue2);
WriteParameter (theWriter, theParamName3, theParamUnits3, theParamValue3);
WriteParameter (theWriter, theParamName4, theParamUnits4, theParamValue4);
};
return DoWriteFeatureDataToString (WriteParams, 4, theVector);
}
class FeatureGroupManager
{
public:
void AddGroupData (const char* theGroupName,
const char* theGroupColor,
const std::string& theFeatureData,
size_t theFeatureNb)
{
//find or create
auto aRes = std::find_if (myGroups.begin(), myGroups.end(),
[&] (const FeatureGroup& theGroup) { return theGroup.myName == theGroupName; });
if (aRes == myGroups.end()) {
aRes = myGroups.insert (aRes, FeatureGroup (theGroupName, theGroupColor));
}
//update
auto& aGroup = *aRes;
aGroup.myFeatureData.push_back (theFeatureData);
aGroup.myFeatureCount += theFeatureNb;
}
size_t TotalFeatureCount() const
{
size_t aTotalFeatureCount = 0;
for (const auto& aGroup : myGroups) {
aTotalFeatureCount += aGroup.myFeatureCount;
}
return aTotalFeatureCount;
}
void Write (JSONWriter& theWriter) const
{
for (const auto& aGroup : myGroups) {
theWriter.OpenSection();
theWriter.WriteData ("name", aGroup.myName);
theWriter.WriteData ("color", aGroup.myColor);
theWriter.WriteData ("totalGroupFeatureCount", aGroup.myFeatureCount);
const auto& aFeatureData = aGroup.myFeatureData;
if (!aFeatureData.empty()) {
bool aHasParams = aFeatureData.front().find ("parameters") != std::string::npos;
if (aHasParams) {
theWriter.WriteData ("subGroupCount", aFeatureData.size());
theWriter.OpenArraySection ("subGroups");
for (const auto& j : aFeatureData) {
theWriter.WriteRawData (j);
}
theWriter.CloseArraySection();
} else {
for (const auto& j : aFeatureData) {
theWriter.WriteRawData (j);
}
}
}
theWriter.CloseSection();
}
}
private:
class FeatureGroup
{
public:
FeatureGroup (const char* theName, const char* theColor) : myName (theName), myColor (theColor)
{}
std::string myName;
std::string myColor;
std::vector<std::string> myFeatureData;
size_t myFeatureCount = 0;
};
std::vector<FeatureGroup> myGroups;
};
const char* MachiningFaceTypeToString (Machining_FaceType theType)
{
switch (theType) {
case Machining_FT_FlatFaceMilled: return "Flat Face Milled Face(s)";
case Machining_FT_FlatSideMilled: return "Flat Side Milled Face(s)";
case Machining_FT_CurvedMilled: return "Curved Milled Face(s)";
case Machining_FT_CircularMilled: return "Circular Milled Face(s)";
case Machining_FT_Deburr: return "Deburr Face(s)";
case Machining_FT_ConvexProfileEdgeMilling: return "Convex Profile Edge Milling Face(s)";
case Machining_FT_ConcaveFilletEdgeMilling: return "Concave Fillet Edge Milling Face(s)";
case Machining_FT_FlatMilled: return "Flat Milled Face(s)";
case Machining_FT_TurnDiameter: return "Turn Diameter Face(s)";
case Machining_FT_TurnForm: return "Turn Form Face(s)";
case Machining_FT_TurnFace: return "Turn Face Face(s)";
case Machining_FT_Bore: return "Bore Face(s)";
default:
break;
}
return "Face(s)";
}
const char* MachiningFaceColor (Machining_FaceType theType)
{
switch (theType) {
case Machining_FT_FlatFaceMilled: return "(115, 251, 253)";
case Machining_FT_FlatSideMilled: return "(0, 35, 245)";
case Machining_FT_CurvedMilled: return "(22, 65, 124)";
case Machining_FT_CircularMilled: return "(255, 254, 145)";
case Machining_FT_Deburr: return "(0, 0, 0)";
case Machining_FT_ConvexProfileEdgeMilling: return "(240, 155, 89)";
case Machining_FT_ConcaveFilletEdgeMilling: return "(129, 127, 38)";
case Machining_FT_FlatMilled: return "(115, 43, 245)";
case Machining_FT_TurnDiameter: return "(88, 19, 94)";
case Machining_FT_TurnForm: return "(161, 251, 142)";
case Machining_FT_TurnFace: return "(239, 136, 190)";
case Machining_FT_Bore: return "(127, 130, 187)";
default:
break;
}
return "(0, 0, 0)";
}
const char* MachiningHoleTypeToString (Machining_HoleType theType)
{
switch (theType) {
case Machining_HT_Through: return "Through Hole(s)";
case Machining_HT_FlatBottom: return "Flat Bottom Hole(s)";
case Machining_HT_Blind: return "Blind Hole(s)";
case Machining_HT_Partial: return "Partial Hole(s)";
default:
break;
}
return "Hole(s)";
}
const char* MachiningHoleColor (Machining_HoleType theType)
{
switch (theType) {
case Machining_HT_Through: return "(240, 135, 132)";
case Machining_HT_FlatBottom: return "(235, 51, 36)";
case Machining_HT_Blind: return "(142, 64, 58)";
case Machining_HT_Partial: return "(58, 6, 3)";
default:
break;
}
return "(0, 0, 0)";
}
const char* MachiningPocketTypeToString (Machining_PocketType theType)
{
switch (theType) {
case Machining_PT_Closed: return "Closed Pocket(s)";
case Machining_PT_Open: return "Open Pocket(s)";
case Machining_PT_Through: return "Through Pocket(s)";
default:
break;
}
return "Pocket(s)";
}
const char* MachiningPocketColor (Machining_PocketType theType)
{
switch (theType) {
case Machining_PT_Closed: return "(81, 20, 0)";
case Machining_PT_Open: return "(189, 103, 37)";
case Machining_PT_Through: return "(255, 217, 188)";
default:
break;
}
return "(0, 0, 0)";
}
const char* HemTypeToString (SheetMetal_HemBendType theType)
{
switch (theType) {
case SheetMetal_HBT_Flattened: return "Flattened Hem Bend(s)";
case SheetMetal_HBT_Open: return "Open Hem Bend(s)";
case SheetMetal_HBT_Teardrop: return "Teardrop Hem Bend(s)";
case SheetMetal_HBT_Rope: return "Rope Hem Bend(s)";
case SheetMetal_HBT_Rolled: return "Rolled Hem Bend(s)";
default:
break;
}
return "Hem Bend(s)";
}
const char* BendName (const SheetMetal_Bend& theBend)
{
if (theBend.IsOfType<SheetMetal_HemBend>()) {
const auto& aHemBend = static_cast <const SheetMetal_HemBend&> (theBend);
return HemTypeToString (aHemBend.Type());
} else if (theBend.IsOfType<SheetMetal_CurvedBend>()) {
return "Curved Bend(s)";
}
return "Bend(s)";
}
const char* BendColor (const SheetMetal_Bend& theBend)
{
if (theBend.IsOfType<SheetMetal_HemBend>()) {
const auto& aType = static_cast <const SheetMetal_HemBend&> (theBend).Type();
switch (aType) {
case SheetMetal_HBT_Flattened: return "(22, 65, 124)";
case SheetMetal_HBT_Open: return "(42, 85, 144)";
case SheetMetal_HBT_Teardrop: return "(62, 105, 164)";
case SheetMetal_HBT_Rope: return "(82, 125, 184)";
case SheetMetal_HBT_Rolled: return "(102, 145, 204)";
default:
break;
}
return "(0, 0, 0)";
} else if (theBend.IsOfType<SheetMetal_CurvedBend>()) {
return "(255, 254, 145)";
}
return "(0, 35, 245)";
}
const char* SheetMetalHoleName (const SheetMetal_Hole& theHole)
{
if (theHole.IsOfType<SheetMetal_ComplexHole>()) {
return "Complex Hole(s)";
}
return "Hole(s)";
}
const char* SheetMetalHoleColor (const SheetMetal_Hole& theHole)
{
if (theHole.IsOfType<SheetMetal_ComplexHole>()) {
return "(115, 43, 245)";
}
return "(129, 127, 38)";
}
const char* SmallDistanceIssueName (const DFMSheetMetal_SmallDistanceBetweenFeaturesIssue& theIssue)
{
return "Small Distance Between Bend And Louver Issue(s)";
return "Small Distance Between Extruded Hole And Bend Issue(s)";
return "Small Distance Between Extruded Hole And Edge Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue>()) {
return "Small Distance Between Extruded Holes Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue>()) {
return "Small Distance Between Hole And Bend Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue>()) {
return "Small Distance Between Hole And Cutout Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue>()) {
return "Small Distance Between Hole And Edge Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue>()) {
return "Small Distance Between Hole And Louver Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue>()) {
return "Small Distance Between Hole And Notch Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHolesIssue>()) {
return "Small Distance Between Holes Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue>()) {
return "Small Distance Between Notch And Bend Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchesIssue>()) {
return "Small Distance Between Notches Issue(s)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenTabsIssue>()) {
return "Small Distance Between Tabs Issue(s)";
}
return "Small Distance Between Feature(s)";
}
const char* SmallDistanceIssueColor (const DFMSheetMetal_SmallDistanceBetweenFeaturesIssue& theIssue)
{
return "(195, 56, 19)";
return "(212, 75, 90)";
return "(198, 75, 105)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue>()) {
return "(170, 65, 120)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue>()) {
return "(239, 136, 190)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue>()) {
return "(127, 130, 187)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue>()) {
return "(240, 135, 132)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue>()) {
return "(15, 5, 129)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue>()) {
return "(235, 51, 36)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenHolesIssue>()) {
return "(142, 64, 58)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue>()) {
return "(58, 6, 3)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchesIssue>()) {
return "(0, 215, 3)";
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenTabsIssue>()) {
return "(157, 160, 207)";
}
return "(0, 0, 0)";
}
void AddShapeFeature (FeatureGroupManager& theManager,
const MTKBase_Feature& theFeature,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
const auto& aFeature = theFeature;
std::function<void (MTKBase_FeatureList)> GroupByParameters = [&] (const MTKBase_FeatureList& theFeatures) -> void {
for (size_t i = 0; i < theFeatures.Size(); ++i) {
const auto& aGroupFeature = theFeatures[i];
if (aGroupFeature.IsOfType<Machining_Countersink>()) {
const auto& aCountersink = static_cast<const Machining_Countersink&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aCountersink.Radius(),
"Depth", "mm", aCountersink.Depth(),
"Axis", "", aCountersink.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData ("Countersink(s)", "(55, 125, 34)", aFeatureData, theCount);
} else if (aGroupFeature.IsOfType<Machining_Hole>()) {
const auto& aHole = static_cast<const Machining_Hole&> (aFeature);
auto aType = aHole.Type();
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", aHole.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData (MachiningHoleTypeToString (aType), MachiningHoleColor (aType), aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Bend>()) {
const auto& aBend = static_cast<const SheetMetal_Bend&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aBend.Radius(),
"Angle", "deg", aBend.Angle() * 180 / M_PI,
"Length", "mm", aBend.Length(),
"Width", "mm", aBend.Width(),
theShapeIdVector);
theManager.AddGroupData (BendName (aBend), BendColor (aBend), aFeatureData, theCount);
}
}
};
//machining
if (aFeature.IsOfType<Machining_TurningFace>()) {
const auto& aTurningFace = static_cast<const Machining_TurningFace&> (aFeature);
auto aType = aTurningFace.Type();
auto aFeatureData = WriteFeatureDataToString ("Radius", "mm", aTurningFace.Radius(), theShapeIdVector);
theManager.AddGroupData (MachiningFaceTypeToString (aType), MachiningFaceColor (aType), aFeatureData, theCount);
} else if (aFeature.IsOfType<Machining_Face>()) {
auto& aFace = static_cast<const Machining_Face&> (aFeature);
auto aType = aFace.Type();
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData (MachiningFaceTypeToString (aType), MachiningFaceColor (aType), aFeatureData, theCount);
} else if (aFeature.IsOfType<Machining_Countersink>()) {
const auto& aCountersink = static_cast<const Machining_Countersink&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aCountersink.Radius(),
"Depth", "mm", aCountersink.Depth(),
"Axis", "", aCountersink.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData ("Countersink(s)", "(55, 125, 34)", aFeatureData, theCount);
} else if (aFeature.IsOfType<Machining_Hole>()) {
const auto& aHole = static_cast<const Machining_Hole&> (aFeature);
auto aType = aHole.Type();
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", aHole.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData (MachiningHoleTypeToString (aType), MachiningHoleColor (aType), aFeatureData, theCount);
} else if (aFeature.IsOfType<Machining_SteppedHole>()) {
const auto& aSteppedHole = static_cast<const Machining_SteppedHole&> (aFeature);
GroupByParameters(aSteppedHole.FeatureList());
} else if (aFeature.IsOfType<Machining_Pocket>()) {
const auto& aPocket = static_cast<const Machining_Pocket&> (aFeature);
auto aType = aPocket.Type();
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aPocket.Length(),
"Width", "mm", aPocket.Width(),
"Depth", "mm", aPocket.Depth(),
"Axis", "", aPocket.Axis().Direction(),
theShapeIdVector);
theManager.AddGroupData (MachiningPocketTypeToString (aType), MachiningPocketColor (aType), aFeatureData, theCount);
}
// molding
else if (aFeature.IsOfType<Molding_ScrewBoss>()) {
const auto& aScrewBoss = static_cast<const Molding_ScrewBoss&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Outer Radius", "mm", aScrewBoss.OuterRadius(),
"Inner Radius", "mm", aScrewBoss.InnerRadius(),
"Draft Angle", "deg", aScrewBoss.DraftAngle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Screw Boss(es)", "(12, 32, 63)", aFeatureData, theCount);
} else if (aFeature.IsOfType<MTKBase_Boss>()) {
const auto& aBoss = static_cast<const MTKBase_Boss&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aBoss.Length(),
"Width", "mm", aBoss.Width(),
"Height", "mm", aBoss.Height(),
theShapeIdVector);
theManager.AddGroupData ("Boss(es)", "(56, 72, 13)", aFeatureData, theCount);
} else if (aFeature.IsOfType<Molding_Rib>()) {
const auto& aRib = static_cast<const Molding_Rib&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aRib.Length(),
"Height", "mm", aRib.Height(),
"Thickness", "mm", aRib.Thickness(),
"Draft Angle", "deg", aRib.DraftAngle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Rib(s)", "(34, 51, 127)", aFeatureData, theCount);
}
//sheet metal
else if (aFeature.IsOfType<SheetMetal_Bead>()) {
const auto& aBead = static_cast<const SheetMetal_Bead&> (aFeature);
auto aFeatureData = WriteFeatureDataToString ("Depth", "mm", aBead.Depth(), theShapeIdVector);
theManager.AddGroupData ("Bead(s)", "(115, 251, 253)", aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Bend>()) {
const auto& aBend = static_cast<const SheetMetal_Bend&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aBend.Radius(),
"Angle", "deg", aBend.Angle() * 180 / M_PI,
"Length", "mm", aBend.Length(),
"Width", "mm", aBend.Width(),
theShapeIdVector);
theManager.AddGroupData (BendName (aBend), BendColor (aBend), aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_CompoundBend>()) {
const auto& aCompoundBend = static_cast<const SheetMetal_CompoundBend&> (aFeature);
GroupByParameters (aCompoundBend.FeatureList());
} else if (aFeature.IsOfType<SheetMetal_Bridge>()) {
const auto& aBridge = static_cast<const SheetMetal_Bridge&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aBridge.Length(),
"Depth", "mm", aBridge.Depth(),
theShapeIdVector);
theManager.AddGroupData ("Bridge(s)", "(240, 155, 89)", aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Hole>()) {
const auto& aHole = static_cast<const SheetMetal_Hole&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", aHole.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData (SheetMetalHoleName (aHole), SheetMetalHoleColor (aHole), aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Cutout>()) {
const auto& aCutout = static_cast<const SheetMetal_Cutout&> (aFeature);
auto aFeatureData = WriteFeatureDataToString ("Perimeter", "mm", aCutout.Perimeter(), theShapeIdVector);
theManager.AddGroupData ("Cutout(s)", "(88, 19, 94)", aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Louver>()) {
const auto& aLouver = static_cast<const SheetMetal_Louver&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Depth", "mm", aLouver.Depth(),
theShapeIdVector);
theManager.AddGroupData ("Louver(s)", "(161, 251, 142)", aFeatureData, theCount);
} else if (aFeature.IsOfType<SheetMetal_Notch>()) {
const auto& aNotch = static_cast<const SheetMetal_Notch&> (aFeature);
if (aNotch.IsOfType<SheetMetal_StraightNotch>()) {
const auto& aStraightNotch = static_cast<const SheetMetal_StraightNotch&> (aNotch);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aNotch.Length(),
"Width", "mm", aNotch.Width(),
"Corner Fillet Radius", "mm", aStraightNotch.CornerFilletRadius(),
theShapeIdVector);
theManager.AddGroupData ("Straight Notch(es)", "(240, 135, 132)", aFeatureData, theCount);
} else if (aNotch.IsOfType<SheetMetal_VNotch>()) {
const auto& aVNotch = static_cast<const SheetMetal_VNotch&> (aNotch);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aNotch.Length(),
"Width", "mm", aNotch.Width(),
"Angle", "deg", aVNotch.Angle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("V Notch(es)", "(235, 51, 36)", aFeatureData, theCount);
} else {
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aNotch.Length(),
"Width", "mm", aNotch.Width(),
theShapeIdVector);
theManager.AddGroupData ("Notch(es)", "(239, 136, 190)", aFeatureData, theCount);
}
} else if (aFeature.IsOfType<SheetMetal_Tab>()) {
const auto& aTab = static_cast<const SheetMetal_Tab&> (aFeature);
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aTab.Length(),
"Width", "mm", aTab.Width(),
theShapeIdVector);
theManager.AddGroupData ("Tab(s)", "(127, 130, 187)", aFeatureData, theCount);
}
}
void AddDrillingIssue (FeatureGroupManager& theManager,
const DFMMachining_DrillingIssue& theIssue,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
if (theIssue.IsOfType<DFMMachining_SmallDiameterHoleIssue>()) {
const auto& aSmallHoleIssue = static_cast<const DFMMachining_SmallDiameterHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Diameter", "mm", aSmallHoleIssue.ExpectedMinDiameter(),
"Actual Diameter", "mm", aSmallHoleIssue.ActualDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Small Diameter Hole(s)", "(115, 251, 253)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_DeepHoleIssue>()) {
const auto& aDeepHoleIssue = static_cast<const DFMMachining_DeepHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Depth", "mm", aDeepHoleIssue.ExpectedMaxDepth(),
"Actual Depth", "mm", aDeepHoleIssue.ActualDepth(),
theShapeIdVector);
theManager.AddGroupData ("Deep Hole(s)", "(0, 35, 245)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NonStandardDiameterHoleIssue>()) {
const auto& aNSDiameterHoleIssue = static_cast<const DFMMachining_NonStandardDiameterHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Nearest Standard Diameter", "mm", aNSDiameterHoleIssue.NearestStandardDiameter(),
"Actual Diameter", "mm", aNSDiameterHoleIssue.ActualDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Non Standard Diameter Hole(s)", "(22, 65, 124)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NonStandardDrillPointAngleBlindHoleIssue>()) {
const auto& aNSDrillPointAngleBlindHoleIssue = static_cast<const DFMMachining_NonStandardDrillPointAngleBlindHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Nearest Standard Angle", "deg", aNSDrillPointAngleBlindHoleIssue.NearestStandardAngle() * 180 / M_PI,
"Actual Angle", "deg", aNSDrillPointAngleBlindHoleIssue.ActualAngle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Non Standard Drill Point Angle Blind Hole(s)", "(88, 13, 78)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_PartialHoleIssue>()) {
const auto& aPartialHoleIssue = static_cast<const DFMMachining_PartialHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Material Percent", "%", aPartialHoleIssue.ExpectedMinMaterialPercent() * 100,
"Actual Material Percent", "%", aPartialHoleIssue.ActualMaterialPercent() * 100,
theShapeIdVector);
theManager.AddGroupData ("Partial Hole(s)", "(255, 254, 145)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_FlatBottomHoleIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Flat Bottom Hole(s)", "(240, 155, 89)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NonPerpendicularHoleIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Perpendicular Hole(s)", "(129, 127, 38)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_IntersectingCavityHoleIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Intersecting Cavity Hole(s)", "(115, 43, 245)", aFeatureData, theCount);
}
}
void AddMillingIssue (FeatureGroupManager& theManager,
const DFMMachining_MillingIssue& theIssue,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
const auto& aFloorRadiusIssue = static_cast<const DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Nearest Standard Radius", "mm", aFloorRadiusIssue.NearestStandardRadius(),
"Actual Radius", "mm", aFloorRadiusIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Non Standard Radius Milled Part Floor Fillet Issue(s)", "(0, 215, 3)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_DeepPocketIssue>()) {
const auto& aDeepPocketIssue = static_cast<const DFMMachining_DeepPocketIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Depth", "mm", aDeepPocketIssue.ExpectedMaxDepth(),
"Actual Depth", "mm", aDeepPocketIssue.ActualDepth(),
theShapeIdVector);
theManager.AddGroupData ("Deep Pocket Issue(s)", "(190, 10, 100)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_HighBossIssue>()) {
const auto& aHighBossIssue = static_cast<const DFMMachining_HighBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Height", "mm", aHighBossIssue.ExpectedMaxHeight(),
"Actual Height", "mm", aHighBossIssue.ActualHeight(),
theShapeIdVector);
theManager.AddGroupData ("High Boss Issue(s)", "(180, 100, 50)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_LargeMilledPartIssue>()) {
const auto& aLMPIssue = static_cast<const DFMMachining_LargeMilledPartIssue&> (theIssue);
const auto& anExpectedSize = aLMPIssue.ExpectedMaxMilledPartSize();
const auto& anActualSize = aLMPIssue.ActualMilledPartSize();
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Size (LxWxH)", "mm",
ArrayType ({ anExpectedSize.Length(), anExpectedSize.Width(), anExpectedSize.Height() }),
"Actual Size (LxWxH)", "mm",
ArrayType ({ anActualSize.Length(), anActualSize.Width(), anActualSize.Height() }),
theShapeIdVector);
theManager.AddGroupData ("Large Milled Part(s)", "(17, 37, 205)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_SmallRadiusMilledPartInternalCornerIssue>()) {
const auto& aMSICRIssue = static_cast<const DFMMachining_SmallRadiusMilledPartInternalCornerIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Radius", "mm", aMSICRIssue.ExpectedMinRadius(),
"Actual Radius", "mm", aMSICRIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData (
"Small Radius Milled Part Internal Corner(s)", "(10, 10, 200)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NonPerpendicularMilledPartShapeIssue>()) {
const auto& aNPMPSIssue = static_cast<const DFMMachining_NonPerpendicularMilledPartShapeIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Actual Angle", "deg", aNPMPSIssue.ActualAngle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Non Perpendicular Milled Part Shape(s)", "(129, 227, 138)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_MilledPartExternalEdgeFilletIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Milled Part External Edge Fillet(s)", "(201, 227, 13)", aFeatureData, theCount);
const auto& anInconsistentRadiusIssue =
auto aFeatureData = WriteFeatureDataToString (
"Expected Radius", "mm", anInconsistentRadiusIssue.ExpectedRadius(),
"Actual Radius", "mm", anInconsistentRadiusIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Inconsistent Radius Milled Part Floor Fillet Issue(s)", "(180, 15, 190)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NarrowRegionInPocketIssue>()) {
const auto& aNarrowRegionIssue =
static_cast<const DFMMachining_NarrowRegionInPocketIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Region Size", "mm", aNarrowRegionIssue.ExpectedMinRegionSize(),
"Actual Region Size", "mm", aNarrowRegionIssue.ActualRegionSize(),
theShapeIdVector);
theManager.AddGroupData ("Narrow Region In Pocket Issue(s)", "(70, 150, 150)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_LargeDifferenceRegionsSizeInPocketIssue>()) {
const auto& aLargeRatioIssue =
auto aFeatureData = WriteFeatureDataToString (
"Expected Regions Maximum To Minimum Size Ratio", "", aLargeRatioIssue.ExpectedMaxRegionsMaxToMinSizeRatio(),
"Actual Regions Maximum To Minimum Size Ratio", "", aLargeRatioIssue.ActualMaxRegionsMaxToMinSizeRatio(),
theShapeIdVector);
theManager.AddGroupData ("Large Difference Regions Size In Pocket Issue(s)", "(100, 150, 150)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_SmallWallThicknessIssue>()) {
const auto& aSWTIssue = static_cast<const DFMMachining_SmallWallThicknessIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Thickness", "mm", aSWTIssue.ExpectedMinThickness(),
"Actual Thickness", "mm", aSWTIssue.ActualThickness(), theShapeIdVector);
theManager.AddGroupData ("Small Wall Thickness Issue(s)", "(64, 224, 208)", aFeatureData, theCount);
}
}
void AddTurningIssue (FeatureGroupManager& theManager,
const DFMBase_Issue& theIssue,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
if (theIssue.IsOfType<DFMMachining_LargeTurnedPartIssue>()) {
const auto& aLTSIssue = static_cast<const DFMMachining_LargeTurnedPartIssue&> (theIssue);
const auto& anExpectedSize = aLTSIssue.ExpectedMaxTurnedPartSize();
const auto& anActualSize = aLTSIssue.ActualTurnedPartSize();
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Size (LxR)", "mm", std::make_pair (anExpectedSize.Length(), anExpectedSize.Radius()),
"Actual Size (LxR)", "mm", std::make_pair (anActualSize.Length(), anActualSize.Radius()),
theShapeIdVector);
theManager.AddGroupData ("Large Turned Part(s)", "(195, 195, 195)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_LongSlenderTurnedPartIssue>()) {
const auto& aLSTIssue = static_cast<const DFMMachining_LongSlenderTurnedPartIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Length", "mm", aLSTIssue.ExpectedMaxLength(),
"Actual Length", "mm", aLSTIssue.ActualLength(),
"Actual Minimum Diameter", "mm", aLSTIssue.ActualMinDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Long-Slender Turned Part(s)", "(195, 195, 195)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_SmallDepthBlindBoredHoleReliefIssue>()) {
const auto& aBBHRIssue = static_cast<const DFMMachining_SmallDepthBlindBoredHoleReliefIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Relief Depth", "mm", aBBHRIssue.ExpectedMinReliefDepth(),
"Actual Relief Depth", "mm", aBBHRIssue.ActualReliefDepth(),
"Actual Diameter", "mm", aBBHRIssue.ActualDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Small Depth Blind Bored Hole Relief(s)", "(88, 19, 94)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_DeepBoredHoleIssue>()) {
const auto& aISBHIssue = static_cast<const DFMMachining_DeepBoredHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Depth", "mm", aISBHIssue.ExpectedMaxDepth(),
"Actual Depth", "mm", aISBHIssue.ActualDepth(),
"Actual Diameter", "mm", aISBHIssue.ActualDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Deep Bored Hole(s)", "(161, 251, 142)", aFeatureData, theCount);
const auto& aODPRIssue = static_cast<const DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Face Incline Angle", "deg", aODPRIssue.ExpectedMaxFaceInclineAngle() * 180 / M_PI,
"Actual Face Incline Angle", "deg", aODPRIssue.ActualFaceInclineAngle() * 180 / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Irregular Turned Part Outer Diameter Profile Relief(s)", "(239, 136, 190)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_SmallRadiusTurnedPartInternalCornerIssue>()) {
const auto& aTSICRIssue = static_cast<const DFMMachining_SmallRadiusTurnedPartInternalCornerIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Radius", "mm", aTSICRIssue.ExpectedMinRadius(),
"Actual Radius", "mm", aTSICRIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Small Radius Turned Part Internal Corner(s)", "(127, 130, 187)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_SquareEndKeywayIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Square End Keyway(s)", "(157, 160, 207)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMachining_NonSymmetricalAxialSlotIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Symmetrical Axial Slot(s)", "(130, 170, 200)", aFeatureData, theCount);
}
}
void AddMoldingIssue (FeatureGroupManager& theManager,
const DFMBase_Issue& theIssue,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
if (theIssue.IsOfType<DFMMolding_HighRibIssue>()) {
const auto& aHRIssue = static_cast<const DFMMolding_HighRibIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Height", "mm", aHRIssue.ExpectedMaxHeight(),
"Actual Height", "mm", aHRIssue.ActualHeight(),
theShapeIdVector);
theManager.AddGroupData ("High Rib(s)", "(284, 36, 12)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_HighScrewBossIssue>()) {
const auto& aHSBIssue = static_cast<const DFMMolding_HighScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Height", "mm", aHSBIssue.ExpectedMaxHeight(),
"Actual Height", "mm", aHSBIssue.ActualHeight(),
theShapeIdVector);
theManager.AddGroupData ("High Screw Boss(es)", "(16, 75, 95)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_IrregularCoreDepthScrewBossIssue>()) {
const auto& aICDSBIssue = static_cast<const DFMMolding_IrregularCoreDepthScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Actual Height", "mm", aICDSBIssue.ActualHeight(),
"Actual Core Depth", "mm", aICDSBIssue.ActualCoreDepth(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Core Depth Screw Boss(es)", "(56, 176, 95)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_IrregularCoreDiameterScrewBossIssue>()) {
const auto& aICDSBIssue = static_cast<const DFMMolding_IrregularCoreDiameterScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Outer Diameter", "mm", aICDSBIssue.ExpectedMinCoreDiameter(),
"Expected Maximum Outer Diameter", "mm", aICDSBIssue.ExpectedMaxCoreDiameter(),
"actual core diameter", "mm", aICDSBIssue.ActualCoreDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Core Diameter Screw Boss(es)", "(195, 195, 195)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_IrregularThicknessRibIssue>()) {
const auto& aITRIssue = static_cast<const DFMMolding_IrregularThicknessRibIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Thickness", "mm", aITRIssue.ExpectedMinThickness(),
"Expected Maximum Thickness", "mm", aITRIssue.ExpectedMaxThickness(),
"Actual Thickness", "mm", aITRIssue.ActualThickness(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Thickness Rib(s)", "(68, 114, 250)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_IrregularWallThicknessIssue>()) {
const auto& aIWTIssue = static_cast<const DFMMolding_IrregularWallThicknessIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Wall Thickness", "mm", aIWTIssue.ExpectedMaxThickness(),
"Expected Minimum Wall Thickness", "mm", aIWTIssue.ExpectedMinThickness(),
"Actual Wall Thickness", "mm", aIWTIssue.ActualThickness(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Wall(s)", "(23, 11, 19)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_IrregularWallThicknessScrewBossIssue>()) {
const auto& aIWTSBIssue = static_cast<const DFMMolding_IrregularWallThicknessScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Thickness", "mm", aIWTSBIssue.ExpectedMaxThickness(),
"Expected Minimum Thickness", "mm", aIWTSBIssue.ExpectedMinThickness(),
"Actual Thickness", "mm", aIWTSBIssue.ActualThickness(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Wall Thickness Screw Boss(es)", "(13, 12, 245)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_LargeWallThicknessIssue>()) {
const auto& aLWTIssue = static_cast<const DFMMolding_LargeWallThicknessIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Wall Thickness", "mm", aLWTIssue.ExpectedMaxThickness(),
"Actual Wall Thickness", "mm", aLWTIssue.ActualThickness(),
theShapeIdVector);
theManager.AddGroupData ("Large Wall(s)", "(101, 22, 129)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallBaseRadiusRibIssue>()) {
const auto& aSBRRIssue = static_cast<const DFMMolding_SmallBaseRadiusRibIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Base Radius", "mm", aSBRRIssue.ExpectedMinBaseRadius() ,
"Actual Base Radius", "mm", aSBRRIssue.ActualBaseRadius(),
theShapeIdVector);
theManager.AddGroupData ("Small Base Radius Rib(s)", "(13, 12, 90)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallBaseRadiusScrewBossIssue>()) {
const auto& aSBRSBIssue = static_cast<const DFMMolding_SmallBaseRadiusScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Base Radius", "mm", aSBRSBIssue.ExpectedMinBaseRadius() ,
"Actual Base Radius", "mm", aSBRSBIssue.ActualBaseRadius(),
theShapeIdVector);
theManager.AddGroupData ("Small Base Radius Screw Boss(es)", "(56, 18, 23)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallDraftAngleRibIssue>()) {
const auto& aSDARIssue = static_cast<const DFMMolding_SmallDraftAngleRibIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Draft Angle", "deg", aSDARIssue.ExpectedMinDraftAngle() * 180. / M_PI,
"Actual Draft Angle", "deg", aSDARIssue.ActualDraftAngle() * 180. / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Small Draft Angle Rib(s)", "(189, 200, 13)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallDraftAngleScrewBossIssue>()) {
const auto& aSDASBIssue = static_cast<const DFMMolding_SmallDraftAngleScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Draft Angle", "deg", aSDASBIssue.ExpectedMinDraftAngle() * 180. / M_PI,
"Actual Draft Angle", "deg", aSDASBIssue.ActualDraftAngle() * 180. / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Small Draft Angle Screw Boss(es)", "(27, 101, 27)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallHoleBaseRadiusScrewBossIssue>()) {
const auto& aSHBRSBIssue = static_cast<const DFMMolding_SmallHoleBaseRadiusScrewBossIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Hole Base Radius", "mm", aSHBRSBIssue.ExpectedMinHoleBaseRadius(),
"Actual Hole Base Radius", "mm", aSHBRSBIssue.ActualHoleBaseRadius(),
theShapeIdVector);
theManager.AddGroupData ("Small Hole Base Radius Screw Boss(es)", "(98, 8, 2)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallDraftAngleWallIssue>()) {
const auto& aSDAWIssue = static_cast<const DFMMolding_SmallDraftAngleWallIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Draft Angle", "deg", aSDAWIssue.ExpectedMinDraftAngle() * 180. / M_PI,
"Actual Draft Angle", "deg", aSDAWIssue.ActualDraftAngle() * 180. / M_PI,
theShapeIdVector);
theManager.AddGroupData ("Small Draft Angle Wall(s)", "(101, 67, 33)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_NonChamferedScrewBossIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Chamfered Screw Boss(es)", "(38, 38, 10)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallDistanceBetweenRibsIssue>()) {
const auto& aSDBRIssue = static_cast<const DFMMolding_SmallDistanceBetweenRibsIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Distance", "mm", aSDBRIssue.ExpectedMinDistanceBetweenRibs(),
"Actual Distance", "mm", aSDBRIssue.ActualDistanceBetweenRibs(),
theShapeIdVector);
theManager.AddGroupData ("Small Distance Between Ribs Issue(s)", "(11, 90, 111)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallWallThicknessIssue>()) {
const auto& aSWTIssue = static_cast<const DFMMolding_SmallWallThicknessIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Wall Thickness", "mm", aSWTIssue.ExpectedMinThickness(),
"Actual Wall Thickness", "mm", aSWTIssue.ActualThickness(),
theShapeIdVector);
theManager.AddGroupData ("Small Wall(s)", "(14, 209, 199)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMMolding_SmallDistanceBetweenBossesIssue>()) {
const auto& aSDBBIssue = static_cast<const DFMMolding_SmallDistanceBetweenBossesIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Distance Between Bosses", "mm", aSDBBIssue.ExpectedMinDistanceBetweenBosses(),
"Actual Distance Between Bosses", "mm", aSDBBIssue.ActualDistanceBetweenBosses(),
theShapeIdVector);
theManager.AddGroupData ("Small Distance Between Bosses Issue(s)", "(255, 102, 0)", aFeatureData, theCount);
}
}
void AddSheetMetalIssue (FeatureGroupManager& theManager,
const DFMBase_Issue& theIssue,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
if (theIssue.IsOfType<DFMSheetMetal_FlatPatternInterferenceIssue>()) {
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Flat Pattern Interference(s)", "(115, 251, 253)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue>()) {
const auto& aICFRNIssue = static_cast<const DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Corner Fillet Radius", "mm", aICFRNIssue.ExpectedCornerFilletRadius(),
"Actual Corner Fillet Radius", "mm", aICFRNIssue.ActualCornerFilletRadius(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Corner Fillet Radius Notch(es)", "(239, 136, 190)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularDepthExtrudedHoleIssue>()) {
const auto& aIDEHIssue = static_cast<const DFMSheetMetal_IrregularDepthExtrudedHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Extruded Height", "mm", aIDEHIssue.ExpectedMaxExtrudedHeight(),
"Expected Minimum Extruded Height", "mm", aIDEHIssue.ExpectedMinExtrudedHeight(),
"Actual Extruded Height", "mm", aIDEHIssue.ActualExtrudedHeight(),
theShapeIdVector);
theManager.AddGroupData ("Irregular depth extruded Hole(s)", "(50, 120, 210)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularRadiusOpenHemBendIssue>()) {
const auto& aIROHBIssue = static_cast<const DFMSheetMetal_IrregularRadiusOpenHemBendIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Radius", "mm", aIROHBIssue.ExpectedRadius(),
"Actual Radius", "mm", aIROHBIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Irregular Radius Open Hem Bend(s)", "(188, 121, 11)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_InconsistentRadiusBendIssue>()) {
const auto& aIRBIssue = static_cast<const DFMSheetMetal_InconsistentRadiusBendIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Radius", "mm", aIRBIssue.ExpectedRadius(),
"Actual Radius", "mm", aIRBIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Inconsistent Radius Bend(s)", "(0, 35, 245)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularSizeBendReliefIssue>()) {
const auto& aISBRIssue = static_cast<const DFMSheetMetal_IrregularSizeBendReliefIssue&> (theIssue);
const auto& anExpectedRelief = aISBRIssue.ExpectedMinBendRelief();
const auto& aFirstActualRelief = aISBRIssue.FirstActualRelief();
const auto& aSecondActualRelief = aISBRIssue.SecondActualRelief();
std::string aFeatureData;
if (aFirstActualRelief && aSecondActualRelief) {
aFeatureData = WriteFeatureDataToString (
"Expected Minimum Relief Size (LxW)", "mm", std::make_pair (anExpectedRelief.Length(), anExpectedRelief.Width()),
"First Actual Relief Size (LxW)", "mm", std::make_pair (aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"Second Actual Relief Size (LxW)", "mm", std::make_pair (aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
} else if (!aFirstActualRelief) {
aFeatureData = WriteFeatureDataToString (
"Expected Minimum Relief Size (LxW)", "mm", std::make_pair (anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", std::make_pair (aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
} else {
aFeatureData = WriteFeatureDataToString (
"Expected Minimum Relief Size (LxW)", "mm", std::make_pair (anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", std::make_pair (aFirstActualRelief.Length(), aFirstActualRelief.Width()),
theShapeIdVector);
}
theManager.AddGroupData ("Irregular Size Bend Relief(s)", "(22, 65, 124)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularSizeNotchIssue>()) {
const auto& aISNIssue = static_cast<const DFMSheetMetal_IrregularSizeNotchIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Size (LxW)", "mm", std::make_pair (aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", std::make_pair (aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData ("Irregular Size Notch(s)", "(255, 254, 145)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularSizeTabIssue>()) {
const auto& aISTIssue = static_cast<const DFMSheetMetal_IrregularSizeTabIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Size (LxW)", "mm", std::make_pair (aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", std::make_pair (aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData ("Irregular Size Tab(s)", "(240, 155, 89)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_LargeDepthBeadIssue>()) {
const auto& aLDBIssue = static_cast<const DFMSheetMetal_LargeDepthBeadIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Maximum Depth", "mm", aLDBIssue.ExpectedMaxDepth(),
"Actual Depth", "mm", aLDBIssue.ActualDepth(),
theShapeIdVector);
theManager.AddGroupData ("Large Depth Bead(s)", "(129, 127, 38)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDepthLouverIssue>()) {
const auto& aSDLIssue = static_cast<const DFMSheetMetal_SmallDepthLouverIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Depth", "mm", aSDLIssue.ExpectedMinDepth(),
"Actual Depth", "mm", aSDLIssue.ActualDepth(),
theShapeIdVector);
theManager.AddGroupData ("Small Depth Louver(s)", "(190, 127, 58)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_NonStandardSheetSizeIssue>()) {
const auto& aNSSSIssue = static_cast<const DFMSheetMetal_NonStandardSheetSizeIssue&> (theIssue);
const auto& aNesrestStandardSize = aNSSSIssue.NearestStandardSheetSize();
const auto& anActualSize = aNSSSIssue.ActualSheetSize();
auto aFeatureData = WriteFeatureDataToString (
"Nearest Standard Size (LxW)", "mm", std::make_pair (aNesrestStandardSize.Length(), aNesrestStandardSize.Width()),
"Actual Size (LxW)", "mm", std::make_pair (anActualSize.Length(), anActualSize.Width()),
theShapeIdVector);
theManager.AddGroupData ("Non Standard Sheet Size(s)", "(0, 0, 0)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_NonStandardSheetThicknessIssue>()) {
const auto& aNSSTIssue = static_cast<const DFMSheetMetal_NonStandardSheetThicknessIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Nearest Standard Thickness", "mm", aNSSTIssue.NearestStandardSheetThickness(),
"Actual Thickness", "mm", aNSSTIssue.ActualSheetThickness(),
theShapeIdVector);
theManager.AddGroupData ("Non Standard Sheet Thickness(s)", "(0, 0, 0)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDiameterHoleIssue>()) {
const auto& aSDHIssue = static_cast<const DFMSheetMetal_SmallDiameterHoleIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Diameter", "mm", aSDHIssue.ExpectedMinDiameter(),
"Actual Diameter", "mm", aSDHIssue.ActualDiameter(),
theShapeIdVector);
theManager.AddGroupData ("Small Diameter Hole(s)", "(115, 43, 245)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallLengthFlangeIssue>()) {
const auto& aSLFIssue = static_cast<const DFMSheetMetal_SmallLengthFlangeIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Length", "mm", aSLFIssue.ExpectedMinLength(),
"Actual Length", "mm", aSLFIssue.ActualLength(),
theShapeIdVector);
theManager.AddGroupData ("Small Length Flange(s)", "(88, 19, 94)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallLengthHemBendFlangeIssue>()) {
const auto& aSLFIssue = static_cast<const DFMSheetMetal_SmallLengthHemBendFlangeIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Length", "mm", aSLFIssue.ExpectedMinLength(),
"Actual Length", "mm", aSLFIssue.ActualLength(),
theShapeIdVector);
theManager.AddGroupData ("Small Length Hem Bend Flange(s)", "(70, 139, 51)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallRadiusBendIssue>()) {
const auto& aSRBIssue = static_cast<const DFMSheetMetal_SmallRadiusBendIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Radius", "mm", aSRBIssue.ExpectedMinRadius(),
"Actual Radius", "mm", aSRBIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData ("Small Radius Bend(s)", "(161, 251, 142)", aFeatureData, theCount);
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenFeaturesIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenFeaturesIssue&> (theIssue);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Distance", "mm", aSDIssue.ExpectedMinDistanceBetweenFeatures(),
"Actual Distance", "mm", aSDIssue.ActualDistanceBetweenFeatures(),
theShapeIdVector);
theManager.AddGroupData (SmallDistanceIssueName (aSDIssue), SmallDistanceIssueColor (aSDIssue), aFeatureData, theCount);
}
}
ShapeIDVectorType GetShapesId (const ModelData::Shape& theShape,
{
ShapeIDVectorType aShapeIdVector;
ModelData::ShapeIterator aShapeIt (theShape, theType);
for (; aShapeIt.HasNext();) {
const auto& aShape = aShapeIt.Next();
aShapeIdVector.push_back (aShape.Id());
}
return aShapeIdVector;
}
void AddShapesId (const ModelData::Shape& theShape,
ShapeIDVectorType& theShapesIdVec)
{
ModelData::ShapeIterator aShapeIt (theShape, theType);
for (; aShapeIt.HasNext();) {
const auto& aShape = aShapeIt.Next();
theShapesIdVec.push_back (aShape.Id());
}
}
void SortFeatures (const MTKBase_FeatureList& theFeatures,
FeatureMapType& theMap)
{
for (size_t i = 0; i < theFeatures.Size(); i++) {
const auto& aFeature = theFeatures[i];
if (aFeature.IsOfType<MTKBase_CompositeFeature>()) {
const auto& aCompositeFeature = static_cast<const MTKBase_CompositeFeature&> (aFeature);
SortFeatures (aCompositeFeature.FeatureList(), theMap);
continue;
}
auto& anElement = theMap[aFeature];
++anElement.first;
//features
if (aFeature.IsOfType<MTKBase_ShapeFeature>()) {
const auto& aShapeFeature = static_cast<const MTKBase_ShapeFeature&> (aFeature);
ModelData::ShapeType aShapeType = ModelData::ShapeType::Face;
if (aFeature.IsOfType<SheetMetal_Cutout>()
|| (aFeature.IsOfType<SheetMetal_Hole>() && !aFeature.IsOfType<SheetMetal_ComplexHole>())
|| aFeature.IsOfType<SheetMetal_Notch>() || aFeature.IsOfType<SheetMetal_Tab>()) {
aShapeType = ModelData::ShapeType::Edge;
}
auto aShapeIdVector = GetShapesId (aShapeFeature.Shape(), aShapeType);
anElement.second.push_back (aShapeIdVector);
}
//dfm machining drilling
else if (aFeature.IsOfType<DFMMachining_DrillingIssue>()){
const auto& anIssue = static_cast<const DFMMachining_DrillingIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (anIssue.Hole().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
}
//dfm machining milling
const auto& aNSRMPFFIssue = static_cast<const DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aNSRMPFFIssue.FloorFillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_DeepPocketIssue>()) {
const auto& aDCIssue = static_cast<const DFMMachining_DeepPocketIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aDCIssue.Pocket().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_HighBossIssue>()) {
const auto& aHBIssue = static_cast<const DFMMachining_HighBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aHBIssue.Boss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_LargeMilledPartIssue>()) {
anElement.second.push_back (ShapeIDVectorType());
} else if (aFeature.IsOfType<DFMMachining_SmallRadiusMilledPartInternalCornerIssue>()) {
const auto& aMSICRIssue = static_cast<const DFMMachining_SmallRadiusMilledPartInternalCornerIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aMSICRIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_NonPerpendicularMilledPartShapeIssue>()) {
const auto& aNPMPSIssue = static_cast<const DFMMachining_NonPerpendicularMilledPartShapeIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aNPMPSIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_MilledPartExternalEdgeFilletIssue>()) {
const auto& aMPEEFIssue = static_cast<const DFMMachining_MilledPartExternalEdgeFilletIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aMPEEFIssue.Fillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
const auto& aIRMPFFIssue = static_cast<const DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIRMPFFIssue.FloorFillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_NarrowRegionInPocketIssue>()) {
const auto& aNRIPIssue = static_cast<const DFMMachining_NarrowRegionInPocketIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aNRIPIssue.InnerFeature(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aNRIPIssue.NarrowRegionSidewall(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_LargeDifferenceRegionsSizeInPocketIssue>()) {
const auto& aLDRSIPIssue = static_cast<const DFMMachining_LargeDifferenceRegionsSizeInPocketIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aLDRSIPIssue.InnerFeature(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aLDRSIPIssue.MinRegionPocketSidewall(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aLDRSIPIssue.MaxRegionPocketSidewall(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_SmallWallThicknessIssue>()) {
const auto& aSWTIssue = static_cast<const DFMMachining_SmallWallThicknessIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
}
//dfm machining turning
else if (aFeature.IsOfType<DFMMachining_SmallDepthBlindBoredHoleReliefIssue>()) {
const auto& aBBHRIssue = static_cast<const DFMMachining_SmallDepthBlindBoredHoleReliefIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aBBHRIssue.BlindBoredHole(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_DeepBoredHoleIssue>()) {
const auto& aISBHIssue = static_cast<const DFMMachining_DeepBoredHoleIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aISBHIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
const auto& aODPRIssue = static_cast<const DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aODPRIssue.Face(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_SmallRadiusTurnedPartInternalCornerIssue>()) {
const auto& aTSICRIssue = static_cast<const DFMMachining_SmallRadiusTurnedPartInternalCornerIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aTSICRIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_SquareEndKeywayIssue>()) {
const auto& aSEKIssue = static_cast<const DFMMachining_SquareEndKeywayIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSEKIssue.Keyway().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_NonSymmetricalAxialSlotIssue>()) {
const auto& aNSASIssue = static_cast<const DFMMachining_NonSymmetricalAxialSlotIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aNSASIssue.AxialSlot().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMachining_LargeTurnedPartIssue>()) {
anElement.second.push_back (ShapeIDVectorType());
} else if (aFeature.IsOfType<DFMMachining_LongSlenderTurnedPartIssue>()) {
anElement.second.push_back (ShapeIDVectorType());
}
//dfm molding
else if (aFeature.IsOfType<DFMMolding_HighRibIssue>()) {
const auto& aHRIssue = static_cast<const DFMMolding_HighRibIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aHRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_HighScrewBossIssue>()) {
const auto& aHSBIssue = static_cast<const DFMMolding_HighScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aHSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_IrregularCoreDepthScrewBossIssue>()) {
const auto& aICDSBIssue = static_cast<const DFMMolding_IrregularCoreDepthScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aICDSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_IrregularCoreDiameterScrewBossIssue>()) {
const auto& aICDSBIssue = static_cast<const DFMMolding_IrregularCoreDiameterScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aICDSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_IrregularThicknessRibIssue>()) {
const auto& aITRIssue = static_cast<const DFMMolding_IrregularThicknessRibIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aITRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_IrregularWallThicknessScrewBossIssue>()) {
const auto& aIWTSBIssue = static_cast<const DFMMolding_IrregularWallThicknessScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIWTSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
} else if (aFeature.IsOfType<DFMMolding_SmallDraftAngleWallIssue>()) {
const auto& aSDAWIssue = static_cast<const DFMMolding_SmallDraftAngleWallIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSDAWIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallDistanceBetweenRibsIssue>()) {
const auto& aSDBRIssue = static_cast<const DFMMolding_SmallDistanceBetweenRibsIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDBRIssue.FirstRib().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDBRIssue.SecondRib().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallBaseRadiusRibIssue>()) {
const auto& aSBRRIssue = static_cast<const DFMMolding_SmallBaseRadiusRibIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSBRRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallBaseRadiusScrewBossIssue>()) {
const auto& aSBRSBIssue = static_cast<const DFMMolding_SmallBaseRadiusScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSBRSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallDraftAngleRibIssue>()) {
const auto& aSMARIssue = static_cast<const DFMMolding_SmallDraftAngleRibIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSMARIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallDraftAngleScrewBossIssue>()) {
const auto& aSDASBIssue = static_cast<const DFMMolding_SmallDraftAngleScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSDASBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallHoleBaseRadiusScrewBossIssue>()) {
const auto& aSHBRSBIssue = static_cast<const DFMMolding_SmallHoleBaseRadiusScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSHBRSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_NonChamferedScrewBossIssue>()) {
const auto& aWTCSBIssue = static_cast<const DFMMolding_NonChamferedScrewBossIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aWTCSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_IrregularWallThicknessIssue>()) {
const auto& aIWTIssue = static_cast<const DFMMolding_IrregularWallThicknessIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_LargeWallThicknessIssue>()) {
const auto& aLWTIssue = static_cast<const DFMMolding_LargeWallThicknessIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aLWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallWallThicknessIssue>()) {
const auto& aSWTIssue = static_cast<const DFMMolding_SmallWallThicknessIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMMolding_SmallDistanceBetweenBossesIssue>()) {
const auto& aSDBBIssue = static_cast<const DFMMolding_SmallDistanceBetweenBossesIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDBBIssue.FirstBoss().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDBBIssue.SecondBoss().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
}
//dfm sheet metal
else if (aFeature.IsOfType<DFMSheetMetal_FlatPatternInterferenceIssue>()) {
const auto& aFPIIssue = static_cast<const DFMSheetMetal_FlatPatternInterferenceIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector ({ aFPIIssue.FirstFace().Id(),
aFPIIssue.SecondFace().Id() });
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue>()) {
const auto& aICFRNIssue = static_cast<const DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aICFRNIssue.Notch().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularDepthExtrudedHoleIssue>()) {
const auto& aIDEHIssue = static_cast<const DFMSheetMetal_IrregularDepthExtrudedHoleIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIDEHIssue.Hole().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularRadiusOpenHemBendIssue>()) {
const auto& aIROHBIssue = static_cast<const DFMSheetMetal_IrregularRadiusOpenHemBendIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIROHBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_InconsistentRadiusBendIssue>()) {
const auto& aIRBIssue = static_cast<const DFMSheetMetal_InconsistentRadiusBendIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aIRBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularSizeBendReliefIssue>()) {
const auto& aISBRIssue = static_cast<const DFMSheetMetal_IrregularSizeBendReliefIssue&> (aFeature);
const auto& aFirstActualRelief = aISBRIssue.FirstActualRelief();
const auto& aSecondActualRelief = aISBRIssue.SecondActualRelief();
ShapeIDVectorType aShapeIdVector;
AddShapesId (aISBRIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
if (aFirstActualRelief) {
AddShapesId (aFirstActualRelief.Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
}
if (aSecondActualRelief) {
AddShapesId (aSecondActualRelief.Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
}
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularSizeNotchIssue>()) {
const auto& aISNIssue = static_cast<const DFMSheetMetal_IrregularSizeNotchIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aISNIssue.Notch().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_IrregularSizeTabIssue>()) {
const auto& aISTIssue = static_cast<const DFMSheetMetal_IrregularSizeTabIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aISTIssue.Tab().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_LargeDepthBeadIssue>()) {
const auto& aLDBIssue = static_cast<const DFMSheetMetal_LargeDepthBeadIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aLDBIssue.Bead().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDepthLouverIssue>()) {
const auto& aSDLIssue = static_cast<const DFMSheetMetal_SmallDepthLouverIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSDLIssue.Louver().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_NonStandardSheetSizeIssue>()) {
anElement.second.push_back (ShapeIDVectorType());
} else if (aFeature.IsOfType<DFMSheetMetal_NonStandardSheetThicknessIssue>()) {
anElement.second.push_back (ShapeIDVectorType());
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDiameterHoleIssue>()) {
const auto& aSDHIssue = static_cast<const DFMSheetMetal_SmallDiameterHoleIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSDHIssue.Hole().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallLengthFlangeIssue>()) {
const auto& aSLFIssue = static_cast<const DFMSheetMetal_SmallLengthFlangeIssue&> (aFeature);
const auto& aFlange = aSLFIssue.Flange().FeatureList();
ShapeIDVectorType aShapeIdVector;
for (size_t j = 0; j < aFlange.Size(); j++) {
const auto& aFlangeFace = aFlange[j];
if (aFlangeFace.IsOfType<MTKBase_ShapeFeature>()) {
const auto& aShapeFeature = static_cast<const MTKBase_ShapeFeature&> (aFlangeFace);
AddShapesId (aShapeFeature.Shape(), ModelData::ShapeType::Face, aShapeIdVector);
}
}
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallLengthHemBendFlangeIssue>()) {
const auto& aSLFIssue = static_cast<const DFMSheetMetal_SmallLengthHemBendFlangeIssue&> (aFeature);
const auto& aFlange = aSLFIssue.Flange().FeatureList();
ShapeIDVectorType aShapeIdVector;
for (size_t j = 0; j < aFlange.Size(); j++) {
const auto& aFlangeFace = aFlange[j];
if (aFlangeFace.IsOfType<MTKBase_ShapeFeature>()) {
const auto& aShapeFeature = static_cast<const MTKBase_ShapeFeature&> (aFlangeFace);
AddShapesId (aShapeFeature.Shape(), ModelData::ShapeType::Face, aShapeIdVector);
}
}
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallRadiusBendIssue>()) {
const auto& aSRBIssue = static_cast<const DFMSheetMetal_SmallRadiusBendIssue&> (aFeature);
auto aShapeIdVector = GetShapesId (aSRBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.Louver().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
aShapeIdVector.push_back (aSDIssue.Edge().Id());
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstHole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.SecondHole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Cutout().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
aShapeIdVector.push_back (aSDIssue.Edge().Id());
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Louver().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Notch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenHolesIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenHolesIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstHole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.SecondHole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Notch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenNotchesIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenNotchesIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstNotch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.SecondNotch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
} else if (aFeature.IsOfType<DFMSheetMetal_SmallDistanceBetweenTabsIssue>()) {
const auto& aSDIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenTabsIssue&> (aFeature);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstTab().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.SecondTab().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
}
}
}
bool WriteFeatures (JSONWriter& theWriter,
const char* theGroupName,
const char* theSubgroupName,
const MTKBase_FeatureList& theFeatures,
const char* theMessageForEmptyList)
{
theWriter.OpenSection (theSubgroupName);
theWriter.WriteData ("name", theGroupName);
if (theFeatures.IsEmpty()) {
theWriter.WriteData ("message", theMessageForEmptyList);
} else {
FeatureMapType aSortedFeatures;
SortFeatures (theFeatures, aSortedFeatures);
FeatureGroupManager aFGManager;
for (const auto& i : aSortedFeatures) {
const auto& aFeature = i.first;
size_t aCount = i.second.first;
const auto& aShapeIDVec = i.second.second;
if (aFeature.IsOfType<MTKBase_ShapeFeature>()) {
AddShapeFeature (aFGManager, static_cast<const MTKBase_ShapeFeature&> (aFeature), aCount, aShapeIDVec);
} else if (aFeature.IsOfType<DFMMachining_DrillingIssue>()) {
AddDrillingIssue (aFGManager, static_cast<const DFMMachining_DrillingIssue&> (aFeature), aCount, aShapeIDVec);
} else if (aFeature.IsOfType<DFMMachining_MillingIssue>()) {
AddMillingIssue (aFGManager, static_cast<const DFMMachining_MillingIssue&> (aFeature), aCount, aShapeIDVec);
} else if (aFeature.IsOfType<DFMSheetMetal_BendIssue>()
|| aFeature.IsOfType<DFMSheetMetal_HoleIssue>()
|| aFeature.IsOfType<DFMSheetMetal_IrregularSizeNotchIssue>()
|| aFeature.IsOfType<DFMSheetMetal_IrregularSizeTabIssue>()
|| aFeature.IsOfType<DFMSheetMetal_LargeDepthBeadIssue>()
|| aFeature.IsOfType<DFMSheetMetal_SmallDepthLouverIssue>()
AddSheetMetalIssue (aFGManager, static_cast<const DFMBase_Issue&> (aFeature), aCount, aShapeIDVec);
} else if (aFeature.IsOfType<DFMMolding_HighRibIssue>()
|| aFeature.IsOfType<DFMMolding_HighScrewBossIssue>()
|| aFeature.IsOfType<DFMMolding_IrregularThicknessRibIssue>()
//|| aFeature.IsOfType<DFMMolding_IrregularWallThicknessScrewBossIssue>()
|| aFeature.IsOfType<DFMMolding_SmallBaseRadiusRibIssue>()
|| aFeature.IsOfType<DFMMolding_SmallDraftAngleRibIssue>()
|| aFeature.IsOfType<DFMMolding_SmallDraftAngleWallIssue>()
|| aFeature.IsOfType<DFMMolding_NonChamferedScrewBossIssue>()
//|| aFeature.IsOfType<DFMMolding_IrregularWallThicknessIssue>()
//|| aFeature.IsOfType<DFMMolding_LargeWallThicknessIssue>()
//|| aFeature.IsOfType<DFMMolding_SmallWallThicknessIssue>()
|| aFeature.IsOfType<DFMMolding_SmallDistanceBetweenBossesIssue>()) {
AddMoldingIssue (aFGManager, static_cast<const DFMBase_Issue&> (aFeature), aCount, aShapeIDVec);
} else if (aFeature.IsOfType<DFMBase_Issue>()) {
AddTurningIssue (aFGManager, static_cast<const DFMBase_Issue&> (aFeature), aCount, aShapeIDVec);
}
}
theWriter.WriteData ("totalFeatureCount", aFGManager.TotalFeatureCount());
theWriter.OpenArraySection ("featureGroups");
aFGManager.Write (theWriter);
theWriter.CloseArraySection();
}
theWriter.CloseSection();
return true;
}
const char* MachiningProcessName (Machining_OperationType theOperation)
{
switch (theOperation) {
case Machining_OT_Milling: return "CNC Machining Milling";
case Machining_OT_LatheMilling: return "CNC Machining Lathe+Milling";
default:
break;
}
return "CNC Machining";
}
bool HasShapes (const std::vector<ModelData::Body>& theBodies, ModelData::ShapeType theType)
{
for (const auto& aBody : theBodies) {
ModelData::ShapeIterator aShapeIt (aBody, theType);
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 WriteUnfoldedPartFeatures (JSONWriter& theWriter,
const MTKConverter_UnfoldedPartData& theData)
{
theWriter.OpenSection ("featureRecognitionUnfolded");
theWriter.WriteData ("name", "Feature Recognition");
if (theData.IsInit()) {
std::stringstream aStream;
aStream << std::fixed << std::setprecision (2);
JSONWriter aWriter (aStream, 4);
aWriter.WriteData ("parametersCount", 3);
aWriter.OpenArraySection ("parameters");
const auto& aFlatPattern = theData.myFlatPattern;
WriteParameter (aWriter, "Length", "mm", aFlatPattern.Length());
WriteParameter (aWriter, "Width", "mm", aFlatPattern.Width());
WriteParameter (aWriter, "Thickness", "mm", aFlatPattern.Thickness());
WriteParameter (aWriter, "Perimeter", "mm", aFlatPattern.Perimeter());
aWriter.CloseArraySection();
theWriter.WriteRawData (aStream.str());
} else {
theWriter.WriteData ("message", "Unfolded part wasn't generated.");
}
theWriter.CloseSection();
}
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) {
WriteThicknessNode (theWriter, "Minimum Thickness", aWTD->myMinThickness, aWTD->myMinThicknessPoints, "minThickness");
WriteThicknessNode (theWriter, "Maximum Thickness", aWTD->myMaxThickness, aWTD->myMaxThicknessPoints, "maxThickness");
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);
}
}
}
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) {
aWriter.OpenSection();
WritePartProcessData (aWriter, aProcessData);
aWriter.CloseSection();
}
aWriter.CloseArraySection();
}
aWriter.CloseSection();
return true;
}
Describes a base class for issues found during design for manufacturing (DFM) analysis.
Definition DFMBase_Issue.hxx:33
Describes deep bored hole issue found during cnc machining turning design analysis.
Definition DFMMachining_DeepBoredHoleIssue.hxx:33
Describes deep hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_DeepHoleIssue.hxx:29
Describes a base class for drilling issues found during cnc machining drilling design analysis.
Definition DFMMachining_DrillingIssue.hxx:36
Describes flat bottom hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_FlatBottomHoleIssue.hxx:29
Describes high boss issues found during cnc machining milling design analysis.
Definition DFMMachining_HighBossIssue.hxx:30
Describes inconsistent radius milled part floor fillet issue found during cnc machining milling desig...
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.hxx:33
Describes intersecting cavity hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_IntersectingCavityHoleIssue.hxx:29
Describes irregular outer diameter profile relief found during cnc machining turning design analysis.
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.hxx:33
Described the Narrow Pocket maximum to minimum sizes ratio issue found during cnc machining milling d...
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.hxx:35
Describes large milled part issue found during cnc machining milling design analysis.
Definition DFMMachining_LargeMilledPartIssue.hxx:31
const DFMMachining_MilledPartSize & ExpectedMaxMilledPartSize() const
Definition DFMMachining_LargeMilledPartIssue.cxx:72
Describes large turned part issue found during cnc machining turning design analysis.
Definition DFMMachining_LargeTurnedPartIssue.hxx:31
const DFMMachining_TurnedPartSize & ExpectedMaxTurnedPartSize() const
Definition DFMMachining_LargeTurnedPartIssue.cxx:71
Describes long-slender turned part issue found during cnc machining turning design analysis.
Definition DFMMachining_LongSlenderTurnedPartIssue.hxx:29
Describes external edge fillet issue found during cnc machining milling design analysis.
Definition DFMMachining_MilledPartExternalEdgeFilletIssue.hxx:33
Describes a base class for milling issues found during cnc machining milling design analysis.
Definition DFMMachining_MillingIssue.hxx:33
Described the Narrow Pocket minimum size issue found during DFM analysis for Machining Milling operat...
Definition DFMMachining_NarrowRegionInPocketIssue.hxx:33
Describes non perpendicular hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_NonPerpendicularHoleIssue.hxx:29
Describes non perpendicular milled part shape issue found during cnc machining milling design analysi...
Definition DFMMachining_NonPerpendicularMilledPartShapeIssue.hxx:33
Describes non standard diameter hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_NonStandardDiameterHoleIssue.hxx:29
Describes non standard drill point angle blind hole issues found during cnc machining drilling design...
Definition DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.hxx:29
Describes non standard radius milled part floor fillet issue found during cnc machining milling desig...
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.hxx:33
Describes asymmetric axial slot issue found during cnc machining turning design analysis.
Definition DFMMachining_NonSymmetricalAxialSlotIssue.hxx:29
Describes partial hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_PartialHoleIssue.hxx:28
Describes small depth blind bored hole relief found during cnc machining turning design analysis.
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.hxx:32
Describes small diameter hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_SmallDiameterHoleIssue.hxx:29
Describes internal corner radius issues found during cnc machining milling design analysis.
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.hxx:33
Describes internal corner radius issues found during cnc machining turning design analysis.
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.hxx:33
Describes wall with small thickness issues found during cnc machining milling design analysis.
Definition DFMMachining_SmallWallThicknessIssue.hxx:33
Describes square form keyway issue found during cnc machining turning design analysis.
Definition DFMMachining_SquareEndKeywayIssue.hxx:30
Describes large height rib issues found during injection molding design analysis.
Definition DFMMolding_HighRibIssue.hxx:28
Describes high screw boss issues found during injection molding design analysis.
Definition DFMMolding_HighScrewBossIssue.hxx:34
Describes irregular core depth screw boss issues found during injection molding design analysis.
Definition DFMMolding_IrregularCoreDepthScrewBossIssue.hxx:34
Describes irregular screw boss core diameter issues found during injection molding design analysis.
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.hxx:34
Describes irregular thickness rib issues found during injection molding design analysis.
Definition DFMMolding_IrregularThicknessRibIssue.hxx:28
Describes wall with irregular thickness issues found during molding design analysis.
Definition DFMMolding_IrregularWallThicknessIssue.hxx:29
Describes irregular wall thickness screw boss issues found during injection molding design analysis.
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.hxx:34
Describes wall with large thickness issues found during molding design analysis.
Definition DFMMolding_LargeWallThicknessIssue.hxx:28
Describes screw boss without top chamfer issues found during injection molding design analysis.
Definition DFMMolding_NonChamferedScrewBossIssue.hxx:28
Describes small rib base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallBaseRadiusRibIssue.hxx:28
Describes small screw boss base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallBaseRadiusScrewBossIssue.hxx:28
Describes a base class for small distance between bosses issues found during molding design analysis.
Definition DFMMolding_SmallDistanceBetweenBossesIssue.hxx:34
Describes a class for small distance between ribs issues found during molding design analysis.
Definition DFMMolding_SmallDistanceBetweenRibsIssue.hxx:30
Describes small draft angle rib issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleRibIssue.hxx:28
Describes small screw boss draft angle issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleScrewBossIssue.hxx:28
Describes small wall draft angle issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleWallIssue.hxx:30
Describes small screw boss hole base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallHoleBaseRadiusScrewBossIssue.hxx:28
Describes wall with small thickness issues found during molding design analysis.
Definition DFMMolding_SmallWallThicknessIssue.hxx:28
Describes a base class for bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_BendIssue.hxx:34
Describes a base class for hole issues found during sheet metal design analysis.
Definition DFMSheetMetal_HoleIssue.hxx:34
Describes inconsistent radius bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_InconsistentRadiusBendIssue.hxx:28
Describes irregular notch corner fillet radius issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.hxx:31
Describes irregular depth extruded hole issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.hxx:30
Describes irregular open hem bend radius issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularRadiusOpenHemBendIssue.hxx:30
Describes irregular size bend relief issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.hxx:30
SheetMetal_BendRelief ExpectedMinBendRelief() const
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:123
SheetMetal_BendRelief FirstActualRelief() const
Returns the first relief of the bend if the bend relief issue was detected. Otherwise returns empty b...
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:132
Describes irregular size notch issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeNotchIssue.hxx:31
Describes irregular size tab issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeTabIssue.hxx:31
Describes large depth bead issue found during sheet metal design analysis.
Definition DFMSheetMetal_LargeDepthBeadIssue.hxx:30
const DFMSheetMetal_SheetSize & NearestStandardSheetSize() const
Definition DFMSheetMetal_NonStandardSheetSizeIssue.cxx:68
Describes small depth louver issue found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDepthLouverIssue.hxx:30
Describes small diameter hole issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDiameterHoleIssue.hxx:28
Describes small distance between bend and louver issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.hxx:31
Describes small distance between complex hole and bend issues found during sheet metal design analysi...
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.hxx:31
Describes small distance detween extruded hole and edge issues found during sheet metal design analys...
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.hxx:34
Describes small distance between extruded holes issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.hxx:30
Describes a base class for small distance issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.hxx:34
Describes small distance between hole and bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.hxx:31
Describes small distance between hole and cutout issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.hxx:31
Describes small distance detween hole and edge issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.hxx:34
Describes small distance between hole and louver issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.hxx:31
Describes small distance detween hole and notch issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.hxx:31
Describes small distance detween holes issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHolesIssue.hxx:30
Describes small distance detween notch and bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.hxx:31
Describes small distance between notches issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenNotchesIssue.hxx:30
Describes small distance between tabs issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenTabsIssue.hxx:30
Describes small length flange issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallLengthFlangeIssue.hxx:31
const MTKBase_CompositeFeature & Flange() const
Definition DFMSheetMetal_SmallLengthFlangeIssue.cxx:111
Describes small length hem bend flange issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.hxx:30
const MTKBase_CompositeFeature & Flange() const
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:121
Describes small radius bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallRadiusBendIssue.hxx:28
Defines a 3D Direction.
Definition Direction.hxx:34
Defines a 3D point.
Definition Point.hxx:35
Describes a boss. In CNC Machining a boss is a protrusion or raised area on a workpiece that is creat...
Definition MTKBase_Boss.hxx:31
Describeas a base class for composite features.
Definition MTKBase_CompositeFeature.hxx:34
const MTKBase_FeatureList & FeatureList() const
Returns the feature references list.
Definition MTKBase_CompositeFeature.cxx:93
Provides possibility to compare MTK based features depending on their type and parameters.
Definition MTKBase_FeatureComparator.hxx:29
Describes a base class of MTK based features.
Definition MTKBase_Feature.hxx:33
bool IsEmpty() const
Definition MTKBase_FeatureList.hxx:50
Describes a feature with assigned shape.
Definition MTKBase_ShapeFeature.hxx:36
Describes a machining countersink.
Definition Machining_Countersink.hxx:33
Describes a face produced by a specified machining operation.
Definition Machining_Face.hxx:38
Machining_FaceType Type() const
Definition Machining_Face.cxx:218
Describes a machining hole of a specified type. Hole is a cylindrical feature that can be made by cut...
Definition Machining_Hole.hxx:30
Machining_HoleType Type() const
Definition Machining_Hole.cxx:144
Describes a machining pocket. A pocket is a feature obtained by milling the material inside an arbitr...
Definition Machining_Pocket.hxx:33
Machining_PocketType Type() const
Definition Machining_Pocket.cxx:165
Describes a stepped hole feature.
Definition Machining_SteppedHole.hxx:33
Describes a face with radius produced by a specified machining operation. Cutting material from workp...
Definition Machining_TurningFace.hxx:29
Base class of topological shapes.
Definition Shape.hxx:32
Describes a rib.
Definition Molding_Rib.hxx:29
Describes a screw boss. In injection molding, the Screw Boss is essentially a cylindrical protrusion ...
Definition Molding_ScrewBoss.hxx:29
Describes a sheet metal bead.
Definition SheetMetal_Bead.hxx:28
Describes a bend in sheet metal.
Definition SheetMetal_Bend.hxx:32
Describes a sheet metal bridge feature.
Definition SheetMetal_Bridge.hxx:28
Describes a sheet metal complex hole feature.
Definition SheetMetal_ComplexHole.hxx:28
Describes a sheet metal compound bend feature.
Definition SheetMetal_CompoundBend.hxx:28
Describes a sheet metal curved bend feature.
Definition SheetMetal_CurvedBend.hxx:28
Describes a cutout in sheet metal.
Definition SheetMetal_Cutout.hxx:28
Describes a sheet metal Hem bend feature.
Definition SheetMetal_HemBend.hxx:29
Describes a circle hole drilled or punched in sheet metal.
Definition SheetMetal_Hole.hxx:32
Describes a sheet metal louver feature.
Definition SheetMetal_Louver.hxx:28
Describes a sheet metal notch.
Definition SheetMetal_Notch.hxx:32
Describes a sheet metal straight notch.
Definition SheetMetal_StraightNotch.hxx:28
Describes a sheet metal tab.
Definition SheetMetal_Tab.hxx:28
Describes a sheet metal V-notch.
Definition SheetMetal_VNotch.hxx:28
ShapeType
Defines shape type.
Definition ShapeType.hxx:27
Machining_HoleType
Defines a hole type in machining.
Definition Machining_HoleType.hxx:28
Machining_FaceType
Describes a face produced by a specified machining operation.
Definition Machining_FaceType.hxx:28
SheetMetal_HemBendType
Defines a hem bend type in sheet metal.
Definition SheetMetal_HemBendType.hxx:28

MTKConverter_Application.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#ifndef _MTKConverter_Application_HeaderFile
#define _MTKConverter_Application_HeaderFile
enum MTKConverter_ReturnCode
{
// General codes
MTKConverter_RC_OK = 0,
MTKConverter_RC_UnknownError = 1,
MTKConverter_RC_GeneralException = 2,
MTKConverter_RC_NoValidLicense = 3,
MTKConverter_RC_InvalidArgumentsNumber = 4,
MTKConverter_RC_InvalidArgument = 5,
// Import errors
MTKConverter_RC_UnsupportedVersion = 100,
MTKConverter_RC_UnexpectedFormat = 101,
MTKConverter_RC_UnsupportedFileVariant = 102,
MTKConverter_RC_ImportError = 103,
// Process errors
MTKConverter_RC_ProcessError = 200,
// Export errors
MTKConverter_RC_ExportError = 300,
};
class MTKConverter_Application
{
public:
MTKConverter_Application();
MTKConverter_ReturnCode Run (int argc, char *argv[]) const;
void PrintUsage() const;
};
#endif

MTKConverter_Application.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// This file may be used under the terms and conditions of the License
// Agreement supplied with the software.
//
// This file is provided "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED
// OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTY OF DESIGN,
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// ****************************************************************************
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <MTKConverter_Application.hxx>
#include <MTKConverter_MachiningProcessor.hxx>
#include <MTKConverter_MoldingProcessor.hxx>
#include <MTKConverter_Report.hxx>
#include <MTKConverter_SheetMetalProcessor.hxx>
#include <MTKConverter_WallThicknessProcessor.hxx>
#include <cstring>
#include <iostream>
#include <unordered_map>
#if defined(__GNUC__)
#include <sys/stat.h>
#elif !defined(_MSC_VER) || _MSC_VER > 1900
#include <filesystem>
#endif
using namespace cadex;
namespace {
enum MTKConverter_ProcessType
{
MTKConverter_PT_Undefined = -1,
MTKConverter_PT_WallThickness = 0,
MTKConverter_PT_MachiningMilling,
MTKConverter_PT_MachiningTurning,
MTKConverter_PT_Molding,
MTKConverter_PT_SheetMetal
};
MTKConverter_ProcessType ProcessType (const UTF16String& theProcessName)
{
static std::unordered_map<UTF16String, MTKConverter_ProcessType, UTF16StringHash> aProcessMap
{
{"wall_thickness" , MTKConverter_PT_WallThickness},
{"machining_milling", MTKConverter_PT_MachiningMilling},
{"machining_turning", MTKConverter_PT_MachiningTurning},
{"molding" , MTKConverter_PT_Molding},
{"sheet_metal" , MTKConverter_PT_SheetMetal}
};
auto aRes = aProcessMap.find (theProcessName);
if (aRes != aProcessMap.end()) {
return aRes->second;
}
return MTKConverter_PT_Undefined;
}
MTKConverter_ReturnCode Import (const UTF16String& theFilePath, ModelData::Model& theModel)
{
std::cout << "Importing " << theFilePath << "..." << std::flush;
if (!aReader.Read (theFilePath, theModel)) {
std::cerr << std::endl << "ERROR: Failed to import " << theFilePath << ". Exiting" << std::endl;
return MTKConverter_RC_ImportError;
}
return MTKConverter_RC_OK;
}
MTKConverter_ReturnCode Process (const UTF16String& theProcess,
ModelData::Model& theModel,
MTKConverter_Report& theReport,
ModelData::Model& theProcessModel)
{
std::cout << "Processing " << theProcess << "..." << std::flush;
theModel.AssignUuids();
auto ApplyProcessorToModel = [&theModel, &theReport] (MTKConverter_PartProcessor& theProcessor) {
ModelData::ModelElementUniqueVisitor aVisitor (theProcessor);
theModel.Accept (aVisitor);
for (const auto& i : theProcessor.myData) {
theReport.AddData (i);
}
};
auto aProcessType = ProcessType (theProcess);
switch (aProcessType) {
case MTKConverter_PT_WallThickness:
{
MTKConverter_WallThicknessProcessor aProcessor (800);
ApplyProcessorToModel (aProcessor);
break;
}
case MTKConverter_PT_MachiningMilling:
{
MTKConverter_MachiningProcessor aProcessor (Machining_OT_Milling);
ApplyProcessorToModel (aProcessor);
break;
}
case MTKConverter_PT_MachiningTurning:
{
MTKConverter_MachiningProcessor aProcessor (Machining_OT_LatheMilling);
ApplyProcessorToModel (aProcessor);
break;
}
case MTKConverter_PT_Molding:
{
MTKConverter_MoldingProcessor aProcessor;
ApplyProcessorToModel (aProcessor);
break;
}
case MTKConverter_PT_SheetMetal:
{
theProcessModel.SetName (theModel.Name() + "_unfolded");
MTKConverter_SheetMetalProcessor aProcessor (theProcessModel);
ApplyProcessorToModel (aProcessor);
break;
}
case MTKConverter_PT_Undefined:
default : return MTKConverter_RC_InvalidArgument;
}
return MTKConverter_RC_OK;
}
MTKConverter_ReturnCode Export (const UTF16String& theFolderPath,
const ModelData::Model& theModel,
const MTKConverter_Report& theReport,
const ModelData::Model& theProcessModel)
{
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++ 2017 (VC14.1) compiler or newer." << std::flush;
return MTKConverter_RC_OK;
#else
#if defined(__GNUC__)
mkdir (theFolderPath.ToString().c_str(), 0755);
#else
std::filesystem::create_directory (theFolderPath.ToString());
#endif
UTF16String aModelPath = theFolderPath + "/" + theModel.Name() + ".mtkweb" + "/scenegraph.mtkweb";
if (!theModel.Save (aModelPath, ModelData::Model::FileFormatType::MTKWEB)) {
std::cerr << std::endl << "ERROR: Failed to export " << aModelPath << ". Exiting" << std::endl;
return MTKConverter_RC_ExportError;
}
if (!theProcessModel.IsEmpty()) {
UTF16String aProcessModelPath = theFolderPath + "/" + theProcessModel.Name() + ".mtkweb" + "/scenegraph.mtkweb";
if (!theProcessModel.Save (aProcessModelPath, ModelData::Model::FileFormatType::MTKWEB)) {
std::cerr << std::endl << "ERROR: Failed to export " << aProcessModelPath << ". Exiting" << std::endl;
return MTKConverter_RC_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_RC_ExportError;
}
return MTKConverter_RC_OK;
#endif
}
}
MTKConverter_Application::MTKConverter_Application()
{
}
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_RC_OK;
}
if (argc < 6) {
std::cerr << "Invalid number of arguments. Please use \"-h\" or \"--help\" for usage information." << std::endl;
return MTKConverter_RC_InvalidArgumentsNumber;
}
//parse and execute command line
enum Mode { NeutralMode, ImportMode, ProcessMode, ExportMode };
ModelData::Model aProcessModel;
auto aMode = NeutralMode;
MTKConverter_Report aReport;
auto aRes = MTKConverter_RC_OK;
for (int i = 1; (i < argc) && (aRes == MTKConverter_RC_OK); ++i) {
const UTF16String anArgument = argv[i];
if (anArgument == "-i") {
aMode = ImportMode;
} else if (anArgument == "-p") {
aMode = ProcessMode;
} else if (anArgument == "-e") {
aMode = ExportMode;
} else {
try {
if (aMode == ImportMode) {
aRes = Import (anArgument, aModel);
} else if (aMode == ProcessMode) {
aRes = Process (anArgument, aModel, aReport, aProcessModel);
} else if (aMode == ExportMode) {
aRes = Export (anArgument, aModel, aReport, aProcessModel);
} else {
std::cerr << "ERROR!: Invalid argument " << anArgument << ". Exiting" << std::endl;
std::cerr << "Type " << argv[0] << " -h for help." << std::endl;
return MTKConverter_RC_InvalidArgument;
}
std::cout << "Done." << std::endl;
} catch (...) {
std::cerr << "Failed.\nERROR: Unhandled exception caught." << std::endl;
return MTKConverter_RC_GeneralException;
}
}
}
return aRes;
}
void MTKConverter_Application::PrintUsage() const
{
std::cout << "Usage:" << std::endl;
std::cout << "MTKConverter -i <import_file> -p <process> -e <export_folder>" << std::endl << std::endl;
std::cout << "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_folder> - export folder name" << std::endl;
std::cout << "Example:" << std::endl;
std::cout << "MTKConverter -i C:\\models\\test.step -p machining_milling -e C:\\models\\test" << 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;
}
Defines a visitor that visits each unique element only once.
Definition ModelElementVisitor.hxx:87
void SetName(const UTF16String &theName)
Sets a model name.
Definition Model.cxx:241
UTF16String Name() const
Returns a model name.
Definition Model.cxx:250
void AssignUuids()
Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned ye...
Definition Model.cxx:264
bool IsEmpty() const
Returns true if the model is empty.
Definition Model.cxx:169
void Accept(ModelElementVisitor &theVisitor) const
Accepts a visitor.
Definition Model.cxx:270
Reads STEP and native format.
Definition ModelReader.hxx:29
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:227

main.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#include <cadex/LicenseManager_Activate.h>
#include <MTKConverter_Application.hxx>
#include <iostream>
#include "../../mtk_license.cxx"
using namespace cadex;
using namespace std;
int main (int argc, char* argv[])
{
auto aKey = MTKLicenseKey::Value();
// Activate the license (aKey must be defined in mtk_license.cxx)
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate Manufacturing Toolkit license." << endl;
return 1;
}
MTKConverter_Application anApp;
return anApp.Run (argc, argv);
}