Hide menu
Loading...
Searching...
No Matches
sheet_metal/dfm_analyzer/dfm_analyzer.java
Refer to the Sheet Metal DFM Analyzer Example

feature_group.java

// ****************************************************************************
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2026, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
import cadex.*;
import cadex.mtk.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Consumer;
class FeatureComparator implements Comparator<MTKBase_Feature> {
@Override
public int compare(MTKBase_Feature theA, MTKBase_Feature theB) {
MTKBase_FeatureComparator aComparator = new MTKBase_FeatureComparator();
boolean anALessThanB = aComparator.Apply(theA, theB);
if (anALessThanB) {
return -1;
}
boolean aBLessThanA = aComparator.Apply(theB, theA);
if (aBLessThanA) {
return 1;
}
return 0;
}
}
class Pair {
public Pair(double theFirst, double theSecond) {
this.First = theFirst;
this.Second = theSecond;
}
public String toString() {
return String.format("%f x %f", First, Second);
}
public double First;
public double Second;
}
class Dimension {
public Dimension(double theL, double theW, double theD) {
this.L = theL;
this.W = theW;
this.D = theD;
}
public String toString() {
return String.format("%f x %f x %f", L, W, D);
}
public double L;
public double W;
public double D;
}
class Direction {
public Direction(double theX, double theY, double theZ) {
this.X = theX;
this.Y = theY;
this.Z = theZ;
}
public String toString() {
return "(" + FormattedString(X) + ", " + FormattedString(Y) + ", " + FormattedString(Z) + ")";
}
private String FormattedString(double theValue) {
DecimalFormat aDF = new DecimalFormat("0.00");
return aDF.format(theValue);
}
public double X;
public double Y;
public double Z;
}
class FeatureMap extends TreeMap<MTKBase_Feature, Long> {
public FeatureMap() {
super(new FeatureComparator());
}
}
class FeatureGroupManager {
public FeatureGroupManager() {
myGroups = new ArrayList<FeatureGroup>();
}
public void AddFeature(String theGroupName, String theSubgroupName, boolean theHasParameters, MTKBase_Feature theFeature) {
//find or create
int aRes = -1;
for (int i = 0; i < myGroups.size(); ++i) {
FeatureGroup aGroup = myGroups.get(i);
if (aGroup.myName == theGroupName) {
aRes = i;
break;
}
}
if (aRes == -1) {
myGroups.add(new FeatureGroup(theGroupName, theSubgroupName, theHasParameters));
aRes = myGroups.size() - 1;
}
//update
FeatureGroup aGroup = myGroups.get(aRes);
FeatureMap aSubgroups = aGroup.myFeatureSubgroups;
if (aSubgroups.containsKey(theFeature)) {
aSubgroups.put(theFeature, aSubgroups.get(theFeature) + 1);
} else {
aSubgroups.put(theFeature, 1L);
}
}
public void Print(String theFeatureType, Consumer<MTKBase_Feature> thePrintFeatureParameters) {
Collections.sort(myGroups, new FeatureGroupComparator());
long aTotalCount = 0;
for (FeatureGroup aGroup : myGroups) {
long aFeatureCount = aGroup.FeatureCount();
aTotalCount += aFeatureCount;
System.out.format(" %s: %d\n", aGroup.myName, aFeatureCount);
if (!aGroup.myHasParameters) {
continue;
}
String aSubgroupName = aGroup.mySubgroupName;
for (Map.Entry<MTKBase_Feature, Long> aFeatureSubgroup : aGroup.myFeatureSubgroups.entrySet()) {
System.out.format(" %d %s with\n", aFeatureSubgroup.getValue(), aSubgroupName);
thePrintFeatureParameters.accept(aFeatureSubgroup.getKey());
}
}
System.out.format("\n Total %s: %d\n", theFeatureType, aTotalCount);
}
public static <T> void PrintFeatureParameter(String theName, T theValue, String theUnits) {
System.out.format(" %s: %s %s\n", theName, theValue, theUnits);
}
private class FeatureGroup {
public FeatureGroup(String theName, String theSubgroupName, boolean theHasParameters) {
myName = theName;
mySubgroupName = theSubgroupName;
myHasParameters = theHasParameters;
myFeatureSubgroups = new FeatureMap();
}
public long FeatureCount() {
long aCount = 0;
for (Map.Entry<MTKBase_Feature, Long> aFeatureSubgroup : myFeatureSubgroups.entrySet()) {
aCount += aFeatureSubgroup.getValue();
}
return aCount;
}
public String myName;
public String mySubgroupName;
public boolean myHasParameters;
public FeatureMap myFeatureSubgroups;
}
private class FeatureGroupComparator implements Comparator<FeatureGroup> {
@Override
public int compare(FeatureGroup theA, FeatureGroup theB) {
String anAName = theA.myName;
String aBName = theB.myName;
if (anAName == aBName) {
return 0;
}
FeatureMap anAFeatureSubgroups = theA.myFeatureSubgroups;
FeatureMap aBFeatureSubgroups = theB.myFeatureSubgroups;
if (anAFeatureSubgroups.isEmpty() || aBFeatureSubgroups.isEmpty()) {
return anAName.compareTo(aBName);
}
MTKBase_Feature anAFeature = anAFeatureSubgroups.firstKey();
MTKBase_Feature aBFeature = aBFeatureSubgroups.firstKey();
FeatureComparator aFeatureComparator = new FeatureComparator();
return aFeatureComparator.compare(anAFeature, aBFeature);
}
}
private ArrayList<FeatureGroup> myGroups;
}
The mtk namespace is intended to become the primary namespace for MTK and replace direct use of the c...
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.

shape_processor.java

// ****************************************************************************
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2026, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
import cadex.*;
import cadex.mtk.*;
import cadex.ModelData.*;
import cadex.Collections.*;
abstract class ShapeProcessor extends ModelElementVoidVisitor {
public void Apply(Part thePart) {
String aPartName = thePart.Name().IsEmpty() ? "noname" : thePart.Name().Data();
BodyList aBodyList = thePart.Bodies();
for (int i = 0; i < aBodyList.size(); ++i) {
Body aBody = aBodyList.get(i);
ShapeIterator aShapeIt = new ShapeIterator(aBody);
while (aShapeIt.HasNext()) {
Shape aShape = aShapeIt.Next();
if (aShape.Type() == ShapeType.Solid) {
System.out.format("Part #%d [\"%s\"] - solid #%d has:\n", myPartIndex, aPartName, i);
ProcessSolid(Solid.Cast(aShape));
} else if (aShape.Type() == ShapeType.Shell) {
System.out.format("Part #%d [\"%s\"] - shell #%d has:\n", myPartIndex, aPartName, i);
ProcessShell(Shell.Cast(aShape));
}
}
}
++myPartIndex;
}
public abstract void ProcessSolid(Solid theSolid);
public abstract void ProcessShell(Shell theShell);
private long myPartIndex = 0;
}
abstract class SolidProcessor extends ModelElementVoidVisitor {
public void Apply(Part thePart) {
String aPartName = thePart.Name().IsEmpty() ? "noname" : thePart.Name().Data();
// Looking for a suitable body
BodyList aBodyList = thePart.Bodies();
for (int i = 0; i < aBodyList.size(); ++i) {
Body aBody = aBodyList.get(i);
ShapeIterator aShapeIt = new ShapeIterator(aBody);
while (aShapeIt.HasNext()) {
Shape aShape = aShapeIt.Next();
if (aShape.Type() == ShapeType.Solid) {
System.out.format("Part #%d [\"%s\"] - solid #%d has:\n", myPartIndex, aPartName, i);
ProcessSolid(Solid.Cast(aShape));
}
}
}
++myPartIndex;
}
public abstract void ProcessSolid(Solid theSolid);
private long myPartIndex = 0;
}
abstract class SolidAndMeshProcessor extends ModelElementVoidVisitor {
public void Apply(Part thePart) {
String aPartName = thePart.Name().IsEmpty() ? "noname" : thePart.Name().ToString();
myShapeIndex = 0;
BodyList aBodyList = thePart.Bodies();
for (Body aBody : aBodyList) {
if (MeshBody.CompareType(aBody)) {
ProcessMeshBody(MeshBody.Cast(aBody), aPartName);
} else if (SolidBody.CompareType(aBody)) {
System.out.format("Part #%d [\"%s\"] - solid #%d has:\n", myPartIndex, aPartName, myShapeIndex);
ProcessSolid(SolidBody.Cast(aBody).Solid(), aPartName);
myShapeIndex++;
}
}
++myPartIndex;
}
public abstract void ProcessSolid(Solid theSolid, String thePartName);
public abstract void ProcessITS(IndexedTriangleSet theITS, String thePartName);
private void ProcessMeshBody(MeshBody theMeshBody, String thePartName) {
MeshShapeList aShapeList = theMeshBody.Shapes();
for (MeshShape aMeshShape : aShapeList) {
if (IndexedTriangleSet.CompareType(aMeshShape)) {
System.out.format("Part #%d [\"%s\"] - ITS #%d has:\n", myPartIndex, thePartName, myShapeIndex);
ProcessITS(IndexedTriangleSet.Cast(aMeshShape), thePartName);
myShapeIndex++;
}
}
}
protected long myPartIndex = 0;
protected long myShapeIndex = 0;
}
Defines classes, types, enums, and functions related to topological entities and scene graph elements...

dfm_analyzer.java

// ****************************************************************************
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2026, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
import cadex.*;
import cadex.mtk.*;
import cadex.ModelData.*;
import java.util.function.Consumer;
public class dfm_analyzer {
static {
try {
System.loadLibrary("MTKCore");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage: " + " <input_file>, where:");
System.out.println(" <input_file> is a name of the file to be read");
System.exit(1);
}
String aKey = MTKLicenseKey.Value();
// Setup the runtime key
if (!LicenseHelper.SetupRuntimeKey()) {
System.exit(1);
}
try {
LicenseManager.Activate(aKey);
} catch (LicenseError theException) {
LicenseManager.Deactivate();
System.out.println("Failed to activate Manufacturing Toolkit license: " + theException.what());
System.exit(1);
}
String aSource = args[0];
Model aModel = new Model();
ModelReader aReader = new ModelReader();
// Reading the file
if (!aReader.Read(new UTF16String(aSource), aModel)) {
LicenseManager.Deactivate();
System.out.println("Failed to read the file " + aSource);
System.exit(1);
}
System.out.println("Model: " + aModel.Name() + "\n");
PartProcessor aPartProcessor = new PartProcessor();
ModelElementUniqueVisitor aVisitor = new ModelElementUniqueVisitor(aPartProcessor);
aModel.Accept(aVisitor);
LicenseManager.Deactivate();
}
static class PartProcessor extends ShapeProcessor {
public PartProcessor() {
myAnalyzer = new DFMSheetMetal_Analyzer();
}
public void ProcessSolid(Solid theSolid) {
MTKBase_FeatureList anIssueList = myAnalyzer.Perform(theSolid);
Report.PrintIssues(anIssueList);
}
public void ProcessShell(Shell theShell) {
MTKBase_FeatureList anIssueList = myAnalyzer.Perform(theShell);
Report.PrintIssues(anIssueList);
}
private DFMSheetMetal_Analyzer myAnalyzer;
}
static class Report {
public static void PrintIssues(MTKBase_FeatureList theIssueList) {
FeatureGroupManager aManager = new FeatureGroupManager();
//group by parameters to provide more compact information about issues
for (long i = 0; i < theIssueList.Size(); ++i) {
MTKBase_Feature anIssue = theIssueList.Feature(i);
if (DFMSheetMetal_SmallRadiusBendIssue.CompareType(anIssue)) {
aManager.AddFeature("Small Radius Bend Issue(s)", "Bend(s)", true, anIssue);
} else if (DFMSheetMetal_SmallDiameterHoleIssue.CompareType(anIssue)) {
aManager.AddFeature("Small Diameter Hole Issue(s)", "Hole(s)", true, anIssue);
} else if (DFMSheetMetal_FlatPatternInterferenceIssue.CompareType(anIssue)) {
aManager.AddFeature("Flat Pattern Interference Issue(s)", "", false, anIssue);
} else if (DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Corner Fillet Radius Notch Issue(s)", "Notch(es)", true, anIssue);
} else if (DFMSheetMetal_IrregularDepthExtrudedHoleIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Depth Extruded Hole Issue(s)", "Hole(s)", true, anIssue);
} else if (DFMSheetMetal_IrregularRadiusOpenHemBendIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Radius Open Hem Bend Issue(s)", "Bend(s)", true, anIssue);
} else if (DFMSheetMetal_IrregularSizeBendReliefIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Size Bend Relief Issue(s)", "Bend(s)", true, anIssue);
} else if (DFMSheetMetal_LargeDepthBeadIssue.CompareType(anIssue)) {
aManager.AddFeature("Large Depth Bead Issue(s)", "Bead(s)", true, anIssue);
} else if (DFMSheetMetal_LargeDepthCountersinkIssue.CompareType(anIssue)) {
aManager.AddFeature("Large Depth Countersink Issue(s)", "Countersink(s)", true, anIssue);
} else if (DFMSheetMetal_NarrowCutoutIssue.CompareType(anIssue)) {
aManager.AddFeature("Narrow Cutout Issue(s)", "Cutout(s)", true, anIssue);
} else if (DFMSheetMetal_SmallDepthLouverIssue.CompareType(anIssue)) {
aManager.AddFeature("Small Depth Louver Issue(s)", "Louver(s)", true, anIssue);
} else if (DFMSheetMetal_InconsistentRadiusBendIssue.CompareType(anIssue)) {
aManager.AddFeature("Inconsistent Radius Bend Issue(s)", "Bend(s)", true, anIssue);
} else if (DFMSheetMetal_SmallLengthFlangeIssue.CompareType(anIssue)) {
aManager.AddFeature("Small Length Flange Issue(s)", "Flange(s)", true, anIssue);
} else if (DFMSheetMetal_SmallLengthHemBendFlangeIssue.CompareType(anIssue)) {
aManager.AddFeature("Small Length Hem Bend Flange Issue(s)", "Flange(s)", true, anIssue);
} else if (DFMSheetMetal_IrregularSizeNotchIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Size Notch Issue(s)", "Notch(s)", true, anIssue);
} else if (DFMSheetMetal_IrregularSizeTabIssue.CompareType(anIssue)) {
aManager.AddFeature("Irregular Size Tab Issue(s)", "Tab(s)", true, anIssue);
} else if (DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.CompareType(anIssue)) {
DFMSheetMetal_SmallDistanceBetweenFeaturesIssue aSDBFIssue = DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.Cast(anIssue);
aManager.AddFeature(SmallDistanceIssueName(aSDBFIssue), "Distance(s)", true, anIssue);
} else if (DFMSheetMetal_NonStandardSheetThicknessIssue.CompareType(anIssue)) {
aManager.AddFeature("Non Standard Sheet Thickness Issue(s)", "Sheet Thickness(s)", true, anIssue);
} else if (DFMSheetMetal_NonStandardSheetSizeIssue.CompareType(anIssue)) {
aManager.AddFeature("Non Standard Sheet Size Issue(s)", "Sheet Size(s)", true, anIssue);
}
}
//print
Consumer<MTKBase_Feature> PrintFeatureParameters = theIssue ->
{
if (DFMSheetMetal_SmallRadiusBendIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallRadiusBendIssue aSRBIssue = DFMSheetMetal_SmallRadiusBendIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min radius", aSRBIssue.ExpectedMinRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aSRBIssue.ActualRadius(), "mm");
} else if (DFMSheetMetal_SmallDiameterHoleIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallDiameterHoleIssue aSDHIssue = DFMSheetMetal_SmallDiameterHoleIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min diameter", aSDHIssue.ExpectedMinDiameter(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual diameter", aSDHIssue.ActualDiameter(), "mm");
} else if (DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallDistanceBetweenFeaturesIssue aSDBFIssue = DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min distance", aSDBFIssue.ExpectedMinDistanceBetweenFeatures(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual distance", aSDBFIssue.ActualDistanceBetweenFeatures(), "mm");
} else if (DFMSheetMetal_FlatPatternInterferenceIssue.CompareType(theIssue)) {
//no parameters
} else if (DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue aICFRNIssue = DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected corner fillet radius", aICFRNIssue.ExpectedCornerFilletRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual corner fillet radius", aICFRNIssue.ActualCornerFilletRadius(), "mm");
} else if (DFMSheetMetal_IrregularDepthExtrudedHoleIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularDepthExtrudedHoleIssue aIDEHIssue = DFMSheetMetal_IrregularDepthExtrudedHoleIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min extruded height", aIDEHIssue.ExpectedMinExtrudedHeight(), "mm");
FeatureGroupManager.PrintFeatureParameter("expected max extruded height", aIDEHIssue.ExpectedMaxExtrudedHeight(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual extruded height", aIDEHIssue.ActualExtrudedHeight(), "mm");
} else if (DFMSheetMetal_IrregularRadiusOpenHemBendIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularRadiusOpenHemBendIssue aIROHBIssue = DFMSheetMetal_IrregularRadiusOpenHemBendIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected radius", aIROHBIssue.ExpectedRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aIROHBIssue.ActualRadius(), "mm");
} else if (DFMSheetMetal_IrregularSizeBendReliefIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularSizeBendReliefIssue aISBRIssue = DFMSheetMetal_IrregularSizeBendReliefIssue.Cast(theIssue);
SheetMetal_BendRelief anExpectedRelief = aISBRIssue.ExpectedMinBendRelief();
SheetMetal_BendRelief aFirstActualRelief = aISBRIssue.FirstActualRelief();
SheetMetal_BendRelief aSecondActualRelief = aISBRIssue.SecondActualRelief();
FeatureGroupManager.PrintFeatureParameter(
"expected min relief size (LxW)",
new Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"mm");
if (aFirstActualRelief != null && aSecondActualRelief != null) {
FeatureGroupManager.PrintFeatureParameter(
"first actual relief size (LxW)",
new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"second actual relief size (LxW)",
new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
} else if (aFirstActualRelief == null) {
FeatureGroupManager.PrintFeatureParameter(
"actual relief size (LxW)",
new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
} else {
FeatureGroupManager.PrintFeatureParameter(
"actual relief size (LxW)",
new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
}
} else if (DFMSheetMetal_LargeDepthBeadIssue.CompareType(theIssue)) {
DFMSheetMetal_LargeDepthBeadIssue anIssue = DFMSheetMetal_LargeDepthBeadIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected max depth", anIssue.ExpectedMaxDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual depth", anIssue.ActualDepth(), "mm");
} else if (DFMSheetMetal_LargeDepthCountersinkIssue.CompareType(theIssue)) {
DFMSheetMetal_LargeDepthCountersinkIssue anIssue = DFMSheetMetal_LargeDepthCountersinkIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected max depth", anIssue.ExpectedMaxDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual depth", anIssue.ActualDepth(), "mm");
} else if (DFMSheetMetal_NarrowCutoutIssue.CompareType(theIssue)) {
DFMSheetMetal_NarrowCutoutIssue anIssue = DFMSheetMetal_NarrowCutoutIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min width", anIssue.ExpectedMinWidth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual width", anIssue.ActualWidth(), "mm");
} else if (DFMSheetMetal_SmallDepthLouverIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallDepthLouverIssue aSDLIssue = DFMSheetMetal_SmallDepthLouverIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min depth", aSDLIssue.ExpectedMinDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual depth", aSDLIssue.ActualDepth(), "mm");
} else if (DFMSheetMetal_InconsistentRadiusBendIssue.CompareType(theIssue)) {
DFMSheetMetal_InconsistentRadiusBendIssue aIRBIssue = DFMSheetMetal_InconsistentRadiusBendIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected max radius", aIRBIssue.ExpectedRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aIRBIssue.ActualRadius(), "mm");
} else if (DFMSheetMetal_SmallLengthFlangeIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallLengthFlangeIssue aSLFIssue = DFMSheetMetal_SmallLengthFlangeIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min length", aSLFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual length", aSLFIssue.ActualLength(), "mm");
} else if (DFMSheetMetal_SmallLengthHemBendFlangeIssue.CompareType(theIssue)) {
DFMSheetMetal_SmallLengthHemBendFlangeIssue aSLHBFIssue = DFMSheetMetal_SmallLengthHemBendFlangeIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter("expected min length", aSLHBFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual length", aSLHBFIssue.ActualLength(), "mm");
} else if (DFMSheetMetal_IrregularSizeNotchIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularSizeNotchIssue aISNIssue = DFMSheetMetal_IrregularSizeNotchIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter(
"expected size (LxW)",
new Pair(aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual size (LxW)",
new Pair(aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
"mm");
} else if (DFMSheetMetal_IrregularSizeTabIssue.CompareType(theIssue)) {
DFMSheetMetal_IrregularSizeTabIssue aISTIssue = DFMSheetMetal_IrregularSizeTabIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter(
"expected size (LxW)",
new Pair(aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual size (LxW)",
new Pair(aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
"mm");
} else if (DFMSheetMetal_NonStandardSheetThicknessIssue.CompareType(theIssue)) {
DFMSheetMetal_NonStandardSheetThicknessIssue aNSSTIssue = DFMSheetMetal_NonStandardSheetThicknessIssue.Cast(theIssue);
FeatureGroupManager.PrintFeatureParameter(
"nearest standard sheet thickness", aNSSTIssue.NearestStandardSheetThickness(), "mm");
FeatureGroupManager.PrintFeatureParameter(
"actual sheet thickness", aNSSTIssue.ActualSheetThickness(), "mm");
} else if (DFMSheetMetal_NonStandardSheetSizeIssue.CompareType(theIssue)) {
DFMSheetMetal_NonStandardSheetSizeIssue aNSSSIssue = DFMSheetMetal_NonStandardSheetSizeIssue.Cast(theIssue);
DFMSheetMetal_SheetSize aNearestStandardSize = aNSSSIssue.NearestStandardSheetSize();
DFMSheetMetal_SheetSize anActualSize = aNSSSIssue.ActualSheetSize();
FeatureGroupManager.PrintFeatureParameter(
"nearest standard sheet size (LxW)",
new Pair(aNearestStandardSize.Length(), aNearestStandardSize.Width()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual sheet size (LxW)",
new Pair(anActualSize.Length(), anActualSize.Width()),
"mm");
}
};
aManager.Print("issues", PrintFeatureParameters);
}
static String SmallDistanceIssueName(DFMSheetMetal_SmallDistanceBetweenFeaturesIssue theIssue) {
if (DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.CompareType(theIssue)) {
return "Small Distance Between Bend And Louver Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.CompareType(theIssue)) {
return "Small Distance Between Extruded Hole And Bend Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.CompareType(theIssue)) {
return "Small Distance Between Extruded Hole And Edge Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.CompareType(theIssue)) {
return "Small Distance Between Extruded Holes Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.CompareType(theIssue)) {
return "Small Distance Between Hole And Bend Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.CompareType(theIssue)) {
return "Small Distance Between Hole And Cutout Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.CompareType(theIssue)) {
return "Small Distance Between Hole And Edge Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.CompareType(theIssue)) {
return "Small Distance Between Hole And Louver Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.CompareType(theIssue)) {
return "Small Distance Between Hole And Notch Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenHolesIssue.CompareType(theIssue)) {
return "Small Distance Between Holes Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.CompareType(theIssue)) {
return "Small Distance Between Notch And Bend Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenNotchesIssue.CompareType(theIssue)) {
return "Small Distance Between Notches Issue(s)";
} else if (DFMSheetMetal_SmallDistanceBetweenTabsIssue.CompareType(theIssue)) {
return "Small Distance Between Tabs Issue(s)";
}
return "Small Distance Between Feature(s)";
}
static double ToDegrees(double theAngleRad) {
return theAngleRad * 180 / Math.PI;
}
}
}