#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>
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;
std::pair<size_t, ShapeIDVectorVectorType>,
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)
{
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));
}
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;
};
{
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)";
}
{
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)";
}
{
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)";
}
{
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)";
}
{
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)";
}
{
return HemTypeToString (aHemBend.Type());
return "Curved Bend(s)";
}
return "Bend(s)";
}
{
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)";
return "(255, 254, 145)";
}
return "(0, 35, 245)";
}
{
return "Complex Hole(s)";
}
return "Hole(s)";
}
{
return "(115, 43, 245)";
}
return "(129, 127, 38)";
}
{
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)";
return "Small Distance Between Extruded Holes Issue(s)";
return "Small Distance Between Hole And Bend Issue(s)";
return "Small Distance Between Hole And Cutout Issue(s)";
return "Small Distance Between Hole And Edge Issue(s)";
return "Small Distance Between Hole And Louver Issue(s)";
return "Small Distance Between Hole And Notch Issue(s)";
return "Small Distance Between Holes Issue(s)";
return "Small Distance Between Notch And Bend Issue(s)";
return "Small Distance Between Notches Issue(s)";
return "Small Distance Between Tabs Issue(s)";
}
return "Small Distance Between Feature(s)";
}
{
return "(195, 56, 19)";
return "(212, 75, 90)";
return "(198, 75, 105)";
return "(170, 65, 120)";
return "(239, 136, 190)";
return "(127, 130, 187)";
return "(240, 135, 132)";
return "(15, 5, 129)";
return "(235, 51, 36)";
return "(142, 64, 58)";
return "(58, 6, 3)";
return "(0, 215, 3)";
return "(157, 160, 207)";
}
return "(0, 0, 0)";
}
void AddShapeFeature (FeatureGroupManager& theManager,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
const auto& aFeature = theFeature;
for (size_t i = 0; i < theFeatures.Size(); ++i) {
const auto& aGroupFeature = theFeatures[i];
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);
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);
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);
}
}
};
auto aType = aTurningFace.
Type();
auto aFeatureData = WriteFeatureDataToString ("Radius", "mm", aTurningFace.Radius(), theShapeIdVector);
theManager.AddGroupData (MachiningFaceTypeToString (aType), MachiningFaceColor (aType), aFeatureData, theCount);
auto aType = aFace.
Type();
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData (MachiningFaceTypeToString (aType), MachiningFaceColor (aType), aFeatureData, theCount);
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);
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);
GroupByParameters(aSteppedHole.FeatureList());
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);
}
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);
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);
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);
}
auto aFeatureData = WriteFeatureDataToString ("Depth", "mm", aBead.Depth(), theShapeIdVector);
theManager.AddGroupData ("Bead(s)", "(115, 251, 253)", aFeatureData, theCount);
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);
GroupByParameters (aCompoundBend.FeatureList());
auto aFeatureData = WriteFeatureDataToString (
"Length", "mm", aBridge.Length(),
"Depth", "mm", aBridge.Depth(),
theShapeIdVector);
theManager.AddGroupData ("Bridge(s)", "(240, 155, 89)", aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString (
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", aHole.Axis().Axis(),
theShapeIdVector);
theManager.AddGroupData (SheetMetalHoleName (aHole), SheetMetalHoleColor (aHole), aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString ("Perimeter", "mm", aCutout.Perimeter(), theShapeIdVector);
theManager.AddGroupData ("Cutout(s)", "(88, 19, 94)", aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString (
"Depth", "mm", aLouver.Depth(),
theShapeIdVector);
theManager.AddGroupData ("Louver(s)", "(161, 251, 142)", aFeatureData, theCount);
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);
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);
}
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,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
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);
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);
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);
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);
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);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Flat Bottom Hole(s)", "(240, 155, 89)", aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Perpendicular Hole(s)", "(129, 127, 38)", aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Intersecting Cavity Hole(s)", "(115, 43, 245)", aFeatureData, theCount);
}
}
void AddMillingIssue (FeatureGroupManager& theManager,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
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);
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);
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);
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);
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);
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);
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);
const auto& aNarrowRegionIssue =
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);
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);
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,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
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);
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);
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);
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);
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);
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);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Square End Keyway(s)", "(157, 160, 207)", aFeatureData, theCount);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Symmetrical Axial Slot(s)", "(130, 170, 200)", aFeatureData, theCount);
}
}
void AddMoldingIssue (FeatureGroupManager& theManager,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Non Chamfered Screw Boss(es)", "(38, 38, 10)", aFeatureData, theCount);
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);
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);
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,
size_t theCount,
const ShapeIDVectorVectorType& theShapeIdVector)
{
auto aFeatureData = WriteFeatureDataToString (theShapeIdVector);
theManager.AddGroupData ("Flat Pattern Interference(s)", "(115, 251, 253)", aFeatureData, theCount);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
auto aFeatureData = WriteFeatureDataToString (
"Expected Minimum Distance", "mm", aSDIssue.ExpectedMinDistanceBetweenFeatures(),
"Actual Distance", "mm", aSDIssue.ActualDistanceBetweenFeatures(),
theShapeIdVector);
theManager.AddGroupData (SmallDistanceIssueName (aSDIssue), SmallDistanceIssueColor (aSDIssue), aFeatureData, theCount);
}
}
{
ShapeIDVectorType aShapeIdVector;
for (; aShapeIt.HasNext();) {
const auto& aShape = aShapeIt.Next();
aShapeIdVector.push_back (aShape.Id());
}
return aShapeIdVector;
}
ShapeIDVectorType& theShapesIdVec)
{
for (; aShapeIt.HasNext();) {
const auto& aShape = aShapeIt.Next();
theShapesIdVec.push_back (aShape.Id());
}
}
FeatureMapType& theMap)
{
for (
size_t i = 0; i < theFeatures.
Size(); i++) {
const auto& aFeature = theFeatures[i];
SortFeatures (aCompositeFeature.FeatureList(), theMap);
continue;
}
auto& anElement = theMap[aFeature];
++anElement.first;
aShapeType = ModelData::ShapeType::Edge;
}
auto aShapeIdVector = GetShapesId (aShapeFeature.Shape(), aShapeType);
anElement.second.push_back (aShapeIdVector);
}
auto aShapeIdVector = GetShapesId (anIssue.Hole().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
}
auto aShapeIdVector = GetShapesId (aNSRMPFFIssue.FloorFillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aDCIssue.Pocket().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aHBIssue.Boss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
anElement.second.push_back (ShapeIDVectorType());
auto aShapeIdVector = GetShapesId (aMSICRIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aNPMPSIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aMPEEFIssue.Fillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIRMPFFIssue.FloorFillet(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aNRIPIssue.InnerFeature(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aNRIPIssue.NarrowRegionSidewall(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
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);
auto aShapeIdVector = GetShapesId (aSWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
}
auto aShapeIdVector = GetShapesId (aBBHRIssue.BlindBoredHole(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aISBHIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aODPRIssue.Face(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aTSICRIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSEKIssue.Keyway().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aNSASIssue.AxialSlot().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
anElement.second.push_back (ShapeIDVectorType());
anElement.second.push_back (ShapeIDVectorType());
}
auto aShapeIdVector = GetShapesId (aHRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aHSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aICDSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aICDSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aITRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIWTSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
auto aShapeIdVector = GetShapesId (aSDAWIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDBRIssue.FirstRib().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDBRIssue.SecondRib().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSBRRIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSBRSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSMARIssue.Rib().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSDASBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSHBRSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aWTCSBIssue.ScrewBoss().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aLWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSWTIssue.Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDBBIssue.FirstBoss().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDBBIssue.SecondBoss().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector ({ aFPIIssue.FirstFace().Id(),
aFPIIssue.SecondFace().Id() });
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aICFRNIssue.Notch().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIDEHIssue.Hole().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIROHBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aIRBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
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);
auto aShapeIdVector = GetShapesId (aISNIssue.Notch().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aISTIssue.Tab().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aLDBIssue.Bead().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSDLIssue.Louver().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
anElement.second.push_back (ShapeIDVectorType());
anElement.second.push_back (ShapeIDVectorType());
auto aShapeIdVector = GetShapesId (aSDHIssue.Hole().Shape(), ModelData::ShapeType::Edge);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
for (size_t j = 0; j < aFlange.Size(); j++) {
const auto& aFlangeFace = aFlange[j];
AddShapesId (aShapeFeature.Shape(), ModelData::ShapeType::Face, aShapeIdVector);
}
}
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
for (size_t j = 0; j < aFlange.Size(); j++) {
const auto& aFlangeFace = aFlange[j];
AddShapesId (aShapeFeature.Shape(), ModelData::ShapeType::Face, aShapeIdVector);
}
}
anElement.second.push_back (aShapeIdVector);
auto aShapeIdVector = GetShapesId (aSRBIssue.Bend().Shape(), ModelData::ShapeType::Face);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.Louver().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
aShapeIdVector.push_back (aSDIssue.Edge().Id());
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstHole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
AddShapesId (aSDIssue.SecondHole().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Cutout().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
aShapeIdVector.push_back (aSDIssue.Edge().Id());
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Louver().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Hole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Notch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstHole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.SecondHole().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.Notch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.Bend().Shape(), ModelData::ShapeType::Face, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
ShapeIDVectorType aShapeIdVector;
AddShapesId (aSDIssue.FirstNotch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
AddShapesId (aSDIssue.SecondNotch().Shape(), ModelData::ShapeType::Edge, aShapeIdVector);
anElement.second.push_back (aShapeIdVector);
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 char* theMessageForEmptyList)
{
theWriter.OpenSection (theSubgroupName);
theWriter.WriteData ("name", theGroupName);
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;
AddShapeFeature (aFGManager,
static_cast<const MTKBase_ShapeFeature&
> (aFeature), aCount, aShapeIDVec);
AddSheetMetalIssue (aFGManager,
static_cast<const DFMBase_Issue&
> (aFeature), aCount, aShapeIDVec);
AddMoldingIssue (aFGManager,
static_cast<const DFMBase_Issue&
> (aFeature), aCount, aShapeIDVec);
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;
}
{
switch (theOperation) {
case Machining_OT_Milling: return "CNC Machining Milling";
case Machining_OT_LatheMilling: return "CNC Machining Lathe+Milling";
default:
break;
}
return "CNC Machining";
}
{
for (const auto& aBody : theBodies) {
if (aShapeIt.HasNext()) {
return true;
}
}
return false;
}
void WriteThicknessNode (JSONWriter& theWriter,
const char* theParamName,
double theParamValue,
const PointPairType& thePoints,
const char* theNodeName)
{
std::stringstream aStream;
aStream << std::fixed << std::setprecision (2);
JSONWriter aWriter (aStream, 3);
aWriter.OpenSection (theNodeName);
aWriter.WriteData ("name", theParamName);
aWriter.WriteData ("units", "mm");
aWriter.WriteData ("value", theParamValue);
aWriter.WriteData ("firstPoint", thePoints.first);
aWriter.WriteData ("secondPoint", thePoints.second);
aWriter.CloseSection();
theWriter.WriteRawData (aStream.str());
}
void 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
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
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