Hide menu
Loading...
Searching...
No Matches
Sheet Metal DFM Analyzer Example

Demonstrates how to perform sheet metal design analysis on a 3D model and print information about found issues and their parameters in a console.

Overview

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.


Application needs 1 input argument to run:

Usage: sheet_metal_dfm_analyzer <input_file>, where:
<input_file> is a name of the file to be read


For more information about sheet metal design analysis visit Sheet Metal Design for Manufacturing (DFM) page.

Implementation

PartProcessor class is inherited from ShapeProcessor and overrides ProcessSolid and ProcessShell methods that are used to run DFMSheetMetal_Analyzer on given shapes. Then PrintIssues method is used to print information about found issues and their parameters in a console.
Visit Model Explore Helper Implementation page for more information about base ShapeProcessor class implementation.

using namespace cadex;
class PartProcessor : public ShapeProcessor
{
public:
void ProcessSolid (const ModelData::Solid& theSolid) override
{
auto anIssueList = myAnalyzer.Perform (theSolid);
PrintIssues (anIssueList);
}
void ProcessShell (const ModelData::Shell& theShell) override
{
auto anIssueList = myAnalyzer.Perform (theShell);
PrintIssues (anIssueList);
}
private:
};
Provides an interface to run DFM Sheet Metal analysis.
Definition DFMSheetMetal_Analyzer.hxx:44
Defines a connected set of faces.
Definition Shell.hxx:32
Defines a topological solid.
Definition Solid.hxx:32
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30

To traverse only unique parts of the imported model, the ModelData::ModelElementUniqueVisitor class is used.

using namespace cadex;
PartProcessor aPartProcessor;
ModelData::ModelElementUniqueVisitor aVisitor (aPartProcessor);
aModel.Accept (aVisitor);
Defines a visitor that visits each unique element only once.
Definition ModelElementVisitor.hxx:87

After performing design analysis, the object of FeatureGroupManager class is used to group and sort found issues. For this purpose, there is a traverse through all found issues and add each of them to FeatureGroupManager with a specified name.

using namespace cadex;
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 ...
}
Describes small diameter hole issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDiameterHoleIssue.hxx:28
Describes small radius bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallRadiusBendIssue.hxx:28

After adding all found issues to FeatureGroupManager, a Print method of the manager is used to print information about found issues and their parameters in a console. PrintFeatureParameters is created to explore and print issue parameters. It uses as an input parameter of Print method.

using namespace cadex;
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 ...
};
aManager.Print ("issues", PrintFeatureParameters);
Describes a base class of MTK based features.
Definition MTKBase_Feature.hxx:33

Visit Feature Group Helper Implementation page for more information about FeatureGroupManager class implementation.

Example output

Below is the example output for model from ./examples/models/Power_box_Chasis.stp.

Model Example output
Model: Power_box_Chasis

Part #0 ["power box sheetmetal"] - solid #0 has:
    Irregular Depth Extruded Hole Issue(s): 3
        3 Hole(s) with
          expected max extruded height: 1.5 mm
          expected min extruded height: 0.6 mm
          actual extruded height: 2.29072 mm
    Large Depth Bead Issue(s): 1
        1 Bead(s) with
          expected max depth: 0.36 mm
          actual depth: 5 mm
    ...

    Total issues: 17

Files