Hide menu
Loading...
Searching...
No Matches
Molding DFM Analyzer Example

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

Overview

This example demonstrates how to perform molding design analysis on a 3D model using molding DFM analyzer tool (DFMMolding_Analyzer). For this purpose, used a console application that imports a model, traverses through unique ModelData.Part , creates and runs DFMMolding_Analyzer, groups and prints information about found issues and their parameters into console. Molding 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: molding_dfm_analyzer <input_file>, where:
<input_file> is a name of the file to be read


For more information about molding design analysis visit Injection Molding Design for Manufacturing (DFM) page.

Implementation

PartProcessor class is inherited from SolidProcessor and overrides ProcessSolid method that are used to run design analysis on given shape.
Visit Model Explore Helper Implementation page for more information about base SolidProcessor class implementation.

class PartProcessor : SolidProcessor
{
public override void ProcessSolid (Solid theSolid)
{
// Set up recognizer
var aRecognizerParameters = new Molding_FeatureRecognizerParameters();
aRecognizerParameters.SetMaxRibThickness(30.0);
aRecognizerParameters.SetMaxRibDraftAngle(0.2);
aRecognizerParameters.SetMaxRibTaperAngle(0.1);
var aRecognizer = new Molding_FeatureRecognizer (aRecognizerParameters);
var aFeatureList = aRecognizer.Perform (theSolid);
PrintFeatures (aFeatureList);
}
}

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

var aPartProcessor = new PartProcessor(anOperation);
var aVisitor = new ModelData.ModelElementUniqueVisitor(aPartProcessor);
aModel.Accept(aVisitor);

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.

for (uint i = 0; i < theIssueList.Size(); ++i)
{
MTKBase_Feature anIssue = theIssueList.Feature (i);
if (DFMMolding_IrregularCoreDepthScrewBossIssue.CompareType(anIssue))
{
aManager.AddFeature("Irregular Core Depth Screw Boss Issue(s)", "Screw Boss(es)", true, anIssue);
}
else if (DFMMolding_IrregularCoreDiameterScrewBossIssue.CompareType(anIssue))
{
aManager.AddFeature("Irregular Core Diameter Screw Boss Issue(s)", "Screw Boss(es)", true, anIssue);
}
else if ...
}

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.

Action<MTKBase_Feature> PrintFeatureParameters = theIssue =>
{
if (DFMMolding_IrregularCoreDepthScrewBossIssue.CompareType (theIssue))
{
DFMMolding_IrregularCoreDepthScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDepthScrewBossIssue.Cast (theIssue);
FeatureGroupManager.PrintFeatureParameter ("actual height", aICDSBIssue.ActualCoreDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter ("actual core depth", aICDSBIssue.ActualHeight(), "mm");
}
else if (DFMMolding_IrregularCoreDiameterScrewBossIssue.CompareType (theIssue))
{
DFMMolding_IrregularCoreDiameterScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDiameterScrewBossIssue.Cast (theIssue);
FeatureGroupManager.PrintFeatureParameter ("expected min core diameter", aICDSBIssue.ExpectedMinCoreDiameter(), "mm");
FeatureGroupManager.PrintFeatureParameter ("expected max core diameter", aICDSBIssue.ExpectedMaxCoreDiameter(), "mm");
FeatureGroupManager.PrintFeatureParameter ("actual core diameter", aICDSBIssue.ActualCoreDiameter(), "mm");
}
else if ...
};
aManager.Print ("issues", PrintFeatureParameters);

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

Example output

Below is an example output for model from ./examples/models/Part3.stp.

Model Example output
Model: Part3

Part #0 ["Part3"] - solid #0 has:
    High Rib Issue(s): 3
        3 Rib(s) with
          expected max height: 11.7371 mm
          actual height: 29 mm
    High Screw Boss Issue(s): 3
        1 Screw Boss(es) with
          expected max height: 3.50883 mm
          actual height: 50 mm
        1 Screw Boss(es) with
          expected max height: 5.775 mm
          actual height: 30 mm
        1 Screw Boss(es) with
          expected max height: 18 mm
          actual height: 30 mm
    ...

    Total issues: 84

Files