Demonstrates how to perform sheet metal design analysis on a 3D model and print information about found issues and their parameters in a console.
In this example demonstrates how to perform sheet metal design analysis on a 3D model using sheet metal dfm analyzer tool (DFMSheetMetal_Analyzer). For this purpose, used a console application that imports a model, traverses through unique ModelData::Part , creates and runs DFMSheetMetal_Analyzer, groups and prints information about found issues and their parameters into console. Sheet metal design analysis will be performed for each unique ModelData::Part , but only for the scope of accepted geometries.
for (size_t i = 0; i < theIssueList.Size(); ++i) {
const auto& anIssue = theIssueList[i];
if (anIssue.IsOfType<DFMSheetMetal_SmallRadiusBendIssue>()) {
aManager.AddFeature ("Small Radius Bend Issue(s)", "Bend(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_SmallDiameterHoleIssue>()) {
aManager.AddFeature ("Small Diameter Hole Issue(s)", "Hole(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_FlatPatternInterferenceIssue>()) {
aManager.AddFeature ("Flat Pattern Interference Issue(s)", "", false, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue>()) {
aManager.AddFeature ("Irregular Corner Fillet Radius Notch Issue(s)", "Notch(es)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularDepthExtrudedHoleIssue>()) {
aManager.AddFeature ("Irregular Depth Extruded Hole Issue(s)", "Hole(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularRadiusOpenHemBendIssue>()) {
aManager.AddFeature ("Irregular Radius Open Hem Bend Issue(s)", "Hem Bend(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularSizeBendReliefIssue>()) {
aManager.AddFeature ("Irregular Size Bend Relief Issue(s)", "Bend(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_LargeDepthBeadIssue>()) {
aManager.AddFeature ("Large Depth Bead Issue(s)", "Bead(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_InconsistentRadiusBendIssue>()) {
aManager.AddFeature ("Inconsistent Radius Bend Issue(s)", "Bend(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_SmallLengthFlangeIssue>()) {
aManager.AddFeature ("Small Length Flange Issue(s)", "Flange(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_SmallLengthHemBendFlangeIssue>()) {
aManager.AddFeature ("Small Length Hem Bend Flange Issue(s)", "Flange(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularSizeNotchIssue>()) {
aManager.AddFeature ("Irregular Size Notch Issue(s)", "Notch(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_IrregularSizeTabIssue>()) {
aManager.AddFeature ("Irregular Size Tab Issue(s)", "Tab(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_SmallDepthLouverIssue>()) {
aManager.AddFeature ("Small Depth Louver Issue(s)", "Louver(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenFeaturesIssue>()) {
const auto& aSDBFIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenFeaturesIssue&> (anIssue);
aManager.AddFeature (SmallDistanceIssueName (aSDBFIssue), "Distance(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_NonStandardSheetThicknessIssue>()) {
aManager.AddFeature ("Non Standard Sheet Thickness Issue(s)", "Sheet Thickness(s)", true, anIssue);
} else if (anIssue.IsOfType<DFMSheetMetal_NonStandardSheetSizeIssue>()) {
aManager.AddFeature ("Non Standard Sheet Size Issue(s)", "Sheet Size(s)", true, anIssue);
}
}
auto PrintFeatureParameters = [] (const MTKBase_Feature& theIssue)
{
if (theIssue.IsOfType<DFMSheetMetal_SmallRadiusBendIssue>()) {
const auto& aSRBIssue = static_cast<const DFMSheetMetal_SmallRadiusBendIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected min radius", aSRBIssue.ExpectedMinRadius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual radius", aSRBIssue.ActualRadius(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDiameterHoleIssue>()) {
const auto& aSDHIssue = static_cast<const DFMSheetMetal_SmallDiameterHoleIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected min diameter", aSDHIssue.ExpectedMinDiameter(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual diameter", aSDHIssue.ActualDiameter(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDistanceBetweenFeaturesIssue>()) {
const auto& aSDBFIssue = static_cast<const DFMSheetMetal_SmallDistanceBetweenFeaturesIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter (
"expected min distance", aSDBFIssue.ExpectedMinDistanceBetweenFeatures(), "mm");
FeatureGroupManager::PrintFeatureParameter (
"actual distance", aSDBFIssue.ActualDistanceBetweenFeatures(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_FlatPatternInterferenceIssue>()) {
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue>()) {
const auto& aICFRNIssue = static_cast<const DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected corner fillet radius", aICFRNIssue.ExpectedCornerFilletRadius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual corner fillet radius", aICFRNIssue.ActualCornerFilletRadius(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularDepthExtrudedHoleIssue>()) {
const auto& aIDEHIssue = static_cast<const DFMSheetMetal_IrregularDepthExtrudedHoleIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected max extruded height", aIDEHIssue.ExpectedMaxExtrudedHeight(), "mm");
FeatureGroupManager::PrintFeatureParameter ("expected min extruded height", aIDEHIssue.ExpectedMinExtrudedHeight(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual extruded height", aIDEHIssue.ActualExtrudedHeight(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_IrregularRadiusOpenHemBendIssue>()) {
const auto& aIROHBIssue = static_cast<const DFMSheetMetal_IrregularRadiusOpenHemBendIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected radius", aIROHBIssue.ExpectedRadius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual radius", aIROHBIssue.ActualRadius(), "mm");
} 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();
FeatureGroupManager::PrintFeatureParameter (
"expected min relief size (LxW)",
std::make_pair (anExpectedRelief.Length(), anExpectedRelief.Width()),
"mm");
if (aFirstActualRelief && aSecondActualRelief) {
FeatureGroupManager::PrintFeatureParameter (
"first actual relief size (LxW)",
std::make_pair (aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
FeatureGroupManager::PrintFeatureParameter (
"second actual relief size (LxW)",
std::make_pair (aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
} else if (!aFirstActualRelief) {
FeatureGroupManager::PrintFeatureParameter (
"actual relief size (LxW)",
std::make_pair (aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
} else {
FeatureGroupManager::PrintFeatureParameter (
"actual relief size (LxW)",
std::make_pair (aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
}
} else if (theIssue.IsOfType<DFMSheetMetal_LargeDepthBeadIssue>()) {
const auto& aLDBIssue = static_cast<const DFMSheetMetal_LargeDepthBeadIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected max depth", aLDBIssue.ExpectedMaxDepth(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual depth", aLDBIssue.ActualDepth(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_SmallDepthLouverIssue>()) {
const auto& aLDBIssue = static_cast<const DFMSheetMetal_SmallDepthLouverIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected min depth", aLDBIssue.ExpectedMinDepth(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual depth", aLDBIssue.ActualDepth(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_InconsistentRadiusBendIssue>()) {
const auto& aIRBIssue = static_cast<const DFMSheetMetal_InconsistentRadiusBendIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected max radius", aIRBIssue.ExpectedRadius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual radius", aIRBIssue.ActualRadius(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_SmallLengthFlangeIssue>()) {
const auto& aSLFIssue = static_cast<const DFMSheetMetal_SmallLengthFlangeIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected min length", aSLFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual length", aSLFIssue.ActualLength(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_SmallLengthHemBendFlangeIssue>()) {
const auto& aSLHBFIssue = static_cast<const DFMSheetMetal_SmallLengthHemBendFlangeIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter ("expected min length", aSLHBFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager::PrintFeatureParameter ("actual length", aSLHBFIssue.ActualLength(), "mm");
} else if (theIssue.IsOfType <DFMSheetMetal_IrregularSizeNotchIssue>()) {
const auto& aISNIssue = static_cast<const DFMSheetMetal_IrregularSizeNotchIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter (
"expected size (LxW)",
std::make_pair (aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"mm");
FeatureGroupManager::PrintFeatureParameter (
"actual size (LxW)",
std::make_pair (aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
"mm");
} else if (theIssue.IsOfType <DFMSheetMetal_IrregularSizeTabIssue>()) {
const auto& aISTIssue = static_cast<const DFMSheetMetal_IrregularSizeTabIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter (
"expected size (LxW)",
std::make_pair (aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"mm");
FeatureGroupManager::PrintFeatureParameter (
"actual size (LxW)",
std::make_pair (aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
"mm");
} else if (theIssue.IsOfType<DFMSheetMetal_NonStandardSheetThicknessIssue>()) {
const auto& aNSSTIssue = static_cast<const DFMSheetMetal_NonStandardSheetThicknessIssue&> (theIssue);
FeatureGroupManager::PrintFeatureParameter (
"nearest standard sheet thickness", aNSSTIssue.NearestStandardSheetThickness(), "mm");
FeatureGroupManager::PrintFeatureParameter (
"actual sheet thickness", aNSSTIssue.ActualSheetThickness(), "mm");
} else if (theIssue.IsOfType<DFMSheetMetal_NonStandardSheetSizeIssue>()) {
const auto& aNSSSIssue = static_cast<const DFMSheetMetal_NonStandardSheetSizeIssue&> (theIssue);
const auto& aNearestStandardSize = aNSSSIssue.NearestStandardSheetSize();
const auto& anActualSize = aNSSSIssue.ActualSheetSize();
FeatureGroupManager::PrintFeatureParameter (
"nearest standard sheet size (LxW)",
std::make_pair (aNearestStandardSize.Length(), aNearestStandardSize.Width()),
"mm");
FeatureGroupManager::PrintFeatureParameter (
"actual sheet size (LxW)",
std::make_pair (anActualSize.Length(), anActualSize.Width()),
"mm");
}
};
aManager.Print ("issues", PrintFeatureParameters);