import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Consumer;
class MTKConverter_Pair
{
public MTKConverter_Pair(double theFirst, double theSecond)
{
this.First = theFirst;
this.Second = theSecond;
}
public String toString()
{
return FormattedString(First) + " x " + FormattedString(Second);
}
private String FormattedString(double theValue)
{
DecimalFormatSymbols aDFS = new DecimalFormatSymbols();
aDFS.setDecimalSeparator('.');
DecimalFormat aDF = new DecimalFormat("0.00", aDFS);
return aDF.format(theValue);
}
public double First;
public double Second;
}
class MTKConverter_Dimension
{
public MTKConverter_Dimension(double theL, double theW, double theD)
{
this.L = theL;
this.W = theW;
this.D = theD;
}
public String toString()
{
return FormattedString(L) + " x " + FormattedString(W) + " x " + FormattedString(D);
}
private String FormattedString(double theValue)
{
DecimalFormatSymbols aDFS = new DecimalFormatSymbols();
aDFS.setDecimalSeparator('.');
DecimalFormat aDF = new DecimalFormat("0.00", aDFS);
return aDF.format(theValue);
}
public double L;
public double W;
public double D;
}
class MTKConverter_Direction
{
public MTKConverter_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)
{
DecimalFormatSymbols aDFS = new DecimalFormatSymbols();
aDFS.setDecimalSeparator('.');
DecimalFormat aDF = new DecimalFormat("0.00", aDFS);
return aDF.format(theValue);
}
public double X;
public double Y;
public double Z;
}
class MTKConverter_Point
{
public MTKConverter_Point(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)
{
DecimalFormatSymbols aDFS = new DecimalFormatSymbols();
aDFS.setDecimalSeparator('.');
DecimalFormat aDF = new DecimalFormat("0.00", aDFS);
return aDF.format(theValue);
}
public double X;
public double Y;
public double Z;
}
class MTKConverter_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 ShapeIDVector extends ArrayList<Long>
{
public ShapeIDVector()
{
super ();
}
}
class ShapeIDVectorVector extends ArrayList<ShapeIDVector>
{
public ShapeIDVectorVector()
{
super ();
}
}
class CountShapeIDVectorVectorPair
{
public CountShapeIDVectorVectorPair(long theCount, ShapeIDVectorVector theVector)
{
this.Count = theCount;
this.Vector = theVector;
}
public long Count;
public ShapeIDVectorVector Vector;
}
class MTKConverter_FeatureMap extends TreeMap<MTKBase_Feature, CountShapeIDVectorVectorPair>
{
public MTKConverter_FeatureMap()
{
super (new MTKConverter_FeatureComparator());
}
}
class JSONWriter
{
public JSONWriter(PrintWriter theStream, int theStartNestingLevel)
{
myStream = theStream;
myNestingLevel = theStartNestingLevel;
myPrevNestingLevel = theStartNestingLevel - 1;
}
public void OpenSection()
{
DoOpenSection("", '{');
}
public void OpenSection(String theName)
{
DoOpenSection(theName, '{');
}
public void OpenArraySection(String theName)
{
DoOpenSection(theName, '[');
}
public void CloseSection()
{
DoCloseSection('}');
}
public void CloseArraySection()
{
DoCloseSection(']');
}
public <T> void WriteData(String theParamName, T theValue)
{
DecimalFormatSymbols aDFS = new DecimalFormatSymbols();
aDFS.setDecimalSeparator('.');
DecimalFormat aDF = new DecimalFormat("0.00", aDFS);
String aValueString = theValue instanceof Double ? aDF.format(theValue) : theValue.toString();
Stream().print("\"" + theParamName + "\": \"" + aValueString + "\"");
}
void WriteRawData(String theRawData)
{
PrepareStream();
myStream.write(theRawData);
}
public void WriteEmptyArray(String theParamName)
{
Stream().write("\"" + theParamName + "\": []");
}
public int NestingLevel()
{
return myNestingLevel;
}
private void DoOpenSection(String theName, char theOpenBracketSymbol)
{
PrintWriter aStream = Stream();
if (!theName.isEmpty())
{
aStream.print("\"" + theName + "\": ");
}
aStream.write(theOpenBracketSymbol);
++myNestingLevel;
}
private void DoCloseSection(char theCloseBracketSymbol)
{
--myNestingLevel;
Stream().print(theCloseBracketSymbol);
}
private void PrepareStream()
{
if (myNestingLevel == myPrevNestingLevel)
{
myStream.print(",");
}
myPrevNestingLevel = myNestingLevel;
if (myIsInit)
{
myStream.println();
}
myIsInit = true;
}
private PrintWriter Stream()
{
PrepareStream();
for (int i = 0; i < myNestingLevel; ++i)
{
myStream.print(" ");
}
return myStream;
}
private PrintWriter myStream;
private boolean myIsInit = false;
private int myNestingLevel;
private int myPrevNestingLevel;
}
class MTKConverter_FeatureGroupManager
{
public MTKConverter_FeatureGroupManager()
{
myGroups = new ArrayList<FeatureGroup>();
}
public void AddGroupData(String theGroupName, String theGroupColor, String theFeatureData, long theFeatureNb)
{
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, theGroupColor));
aRes = myGroups.size() - 1;
}
FeatureGroup aGroup = myGroups.get(aRes);
aGroup.myFeatureData.add(theFeatureData);
aGroup.myFeatureCount += theFeatureNb;
}
public long TotalFeatureCount()
{
long aTotalFeatureCount = 0;
for (FeatureGroup aGroup : myGroups)
{
aTotalFeatureCount += aGroup.myFeatureCount;
}
return aTotalFeatureCount;
}
public void Write(JSONWriter theWriter)
{
for (FeatureGroup aGroup : myGroups)
{
theWriter.OpenSection();
theWriter.WriteData("name", aGroup.myName);
theWriter.WriteData("color", aGroup.myColor);
theWriter.WriteData("totalGroupFeatureCount", aGroup.myFeatureCount);
ArrayList<String> aFeatureData = aGroup.myFeatureData;
if (!aFeatureData.isEmpty())
{
boolean aHasParams = aFeatureData.get(0).indexOf("parameters") != -1;
if (aHasParams)
{
theWriter.WriteData("subGroupCount", aFeatureData.size());
theWriter.OpenArraySection("subGroups");
for (String j : aFeatureData)
{
theWriter.WriteRawData(j);
}
theWriter.CloseArraySection();
}
else
{
for (String j : aFeatureData)
{
theWriter.WriteRawData(j);
}
}
}
theWriter.CloseSection();
}
}
private class FeatureGroup
{
public FeatureGroup(String theName, String theColor)
{
myName = theName;
myColor = theColor;
myFeatureData = new ArrayList<String>();
}
public String myName;
public String myColor;
public ArrayList<String> myFeatureData;
public long myFeatureCount = 0;
}
private ArrayList<FeatureGroup> myGroups;
}
class MTKConverter_Report
{
public MTKConverter_Report()
{
myData = new ArrayList<MTKConverter_ProcessData>();
}
public void AddData(MTKConverter_ProcessData theData)
{
myData.add(theData);
}
public boolean WriteToJSON(UTF16String thePath)
{
String aPath = thePath.toString();
File aFile = new File(aPath);
if (aFile.exists())
{
aFile.delete();
}
try
{
PrintWriter aStream = new PrintWriter (new BufferedWriter(new FileWriter(aPath)));
JSONWriter aWriter = new JSONWriter(aStream, 0);
aWriter.OpenSection();
aWriter.WriteData("version", "1");
if (myData.isEmpty())
{
aWriter.WriteData("error", "The model doesn't contain any parts.");
}
else
{
aWriter.OpenArraySection("parts");
for (MTKConverter_ProcessData aProcessData : myData)
{
aWriter.OpenSection();
WritePartProcessData(aWriter, aProcessData);
aWriter.CloseSection();
}
aWriter.CloseArraySection();
}
aWriter.CloseSection();
aStream.close();
}
catch (Exception anE)
{
return false;
}
return true;
}
private <T> void WriteParameter(JSONWriter theWriter, String theParamName, String theParamUnits, T theParamValue)
{
theWriter.OpenSection();
theWriter.WriteData("name", theParamName);
theWriter.WriteData("units", theParamUnits);
theWriter.WriteData("value", theParamValue);
theWriter.CloseSection();
}
private void WriteShapeIDs(JSONWriter theWriter, ShapeIDVectorVector theVector)
{
if (theVector.isEmpty())
{
return;
}
theWriter.WriteData("featureCount", theVector.size());
theWriter.OpenArraySection("features");
for (ShapeIDVector aShapeIDVector : theVector)
{
theWriter.OpenSection();
theWriter.WriteData("shapeIDCount", aShapeIDVector.size());
if (aShapeIDVector.isEmpty())
{
theWriter.WriteEmptyArray("shapeIDs");
}
else
{
theWriter.OpenArraySection("shapeIDs");
for (long aShapeID : aShapeIDVector)
{
theWriter.OpenSection();
theWriter.WriteData("id", aShapeID);
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
private String DoWriteFeatureDataToString(Consumer<JSONWriter> theFunc, int theParamCount, ShapeIDVectorVector theVector)
{
StringWriter aStrWriter = new StringWriter();
PrintWriter aStream = new PrintWriter(aStrWriter);
JSONWriter aWriter = new JSONWriter(aStream, 7);
aWriter.OpenSection();
aWriter.WriteData("parametersCount", theParamCount);
aWriter.OpenArraySection("parameters");
theFunc.accept(aWriter);
aWriter.CloseArraySection();
WriteShapeIDs(aWriter, theVector);
aWriter.CloseSection();
return aStrWriter.toString();
}
private String WriteFeatureDataToString(ShapeIDVectorVector theVector)
{
StringWriter aStrWriter = new StringWriter();
PrintWriter aStream = new PrintWriter(aStrWriter);
JSONWriter aWriter = new JSONWriter(aStream, 6);
WriteShapeIDs(aWriter, theVector);
return aStrWriter.toString();
}
private <T> String WriteFeatureDataToString(String theParamName, String theParamUnits,
T theParamValue, ShapeIDVectorVector theVector)
{
Consumer<JSONWriter> WriteParams = (theWriter) ->
{
WriteParameter(theWriter, theParamName, theParamUnits, theParamValue);
};
return DoWriteFeatureDataToString(WriteParams, 1, theVector);
}
private <T1, T2> String WriteFeatureDataToString(String theParamName1, String theParamUnits1, T1 theParamValue1,
String theParamName2, String theParamUnits2, T2 theParamValue2,
ShapeIDVectorVector theVector)
{
Consumer<JSONWriter> WriteParams = (theWriter) ->
{
WriteParameter(theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter(theWriter, theParamName2, theParamUnits2, theParamValue2);
};
return DoWriteFeatureDataToString(WriteParams, 2, theVector);
}
private <T1, T2, T3> String WriteFeatureDataToString(String theParamName1, String theParamUnits1, T1 theParamValue1,
String theParamName2, String theParamUnits2, T2 theParamValue2,
String theParamName3, String theParamUnits3, T3 theParamValue3,
ShapeIDVectorVector theVector)
{
Consumer<JSONWriter> WriteParams = (theWriter) ->
{
WriteParameter(theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter(theWriter, theParamName2, theParamUnits2, theParamValue2);
WriteParameter(theWriter, theParamName3, theParamUnits3, theParamValue3);
};
return DoWriteFeatureDataToString(WriteParams, 3, theVector);
}
private <T1, T2, T3, T4> String WriteFeatureDataToString(String theParamName1, String theParamUnits1, T1 theParamValue1,
String theParamName2, String theParamUnits2, T2 theParamValue2,
String theParamName3, String theParamUnits3, T3 theParamValue3,
String theParamName4, String theParamUnits4, T4 theParamValue4,
ShapeIDVectorVector theVector)
{
Consumer<JSONWriter> WriteParams = (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);
}
private String MachiningFaceTypeToString(Machining_FaceType theType)
{
switch (theType)
{
default:
break;
}
return "Face(s)";
}
private String MachiningFaceColor(Machining_FaceType theType)
{
switch (theType)
{
default:
break;
}
return "(0, 0, 0)";
}
private String MachiningHoleTypeToString(Machining_HoleType theType)
{
switch (theType)
{
default:
break;
}
return "Hole(s)";
}
private String MachiningHoleColor(Machining_HoleType theType)
{
switch (theType)
{
default:
break;
}
return "(0, 0, 0)";
}
private String 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)";
}
private String 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)";
}
private String HemTypeToString (SheetMetal_HemBendType theType)
{
switch (theType) {
default:
break;
}
return "Hem Bend(s)";
}
private String BendName(SheetMetal_Bend theBend)
{
if (SheetMetal_HemBend.CompareType(theBend))
{
SheetMetal_HemBend aHemBend = SheetMetal_HemBend.Cast(theBend);
return HemTypeToString(aHemBend.Type());
}
else if (SheetMetal_CurvedBend.CompareType(theBend))
{
return "Curved Bend(s)";
}
return "Bend(s)";
}
private String BendColor(SheetMetal_Bend theBend)
{
if (SheetMetal_HemBend.CompareType(theBend))
{
switch (aType) {
default:
break;
}
return "(0, 0, 0)";
}
else if (SheetMetal_CurvedBend.CompareType(theBend))
{
return "(255, 254, 145)";
}
return "(0, 35, 245)";
}
private String SheetMetalHoleName(SheetMetal_Hole theHole)
{
if (SheetMetal_ComplexHole.CompareType(theHole))
{
return "Complex Hole(s)";
}
return "Hole(s)";
}
private String SheetMetalHoleColor(SheetMetal_Hole theHole)
{
if (SheetMetal_ComplexHole.CompareType(theHole))
{
return "(115, 43, 245)";
}
return "(129, 127, 38)";
}
private 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)";
}
private String SmallDistanceIssueColor(DFMSheetMetal_SmallDistanceBetweenFeaturesIssue theIssue)
{
if (DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.CompareType(theIssue))
{
return "(195, 56, 19)";
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.CompareType(theIssue))
{
return "(212, 75, 90)";
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.CompareType(theIssue))
{
return "(198, 75, 105)";
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.CompareType(theIssue))
{
return "(170, 65, 120)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.CompareType(theIssue))
{
return "(239, 136, 190)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.CompareType(theIssue))
{
return "(127, 130, 187)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.CompareType(theIssue))
{
return "(240, 135, 132)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.CompareType(theIssue))
{
return "(15, 5, 129)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.CompareType(theIssue))
{
return "(235, 51, 36)";
}
else if (DFMSheetMetal_SmallDistanceBetweenHolesIssue.CompareType(theIssue))
{
return "(142, 64, 58)";
}
else if (DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.CompareType(theIssue))
{
return "(58, 6, 3)";
}
else if (DFMSheetMetal_SmallDistanceBetweenNotchesIssue.CompareType(theIssue))
{
return "(0, 215, 3)";
}
else if (DFMSheetMetal_SmallDistanceBetweenTabsIssue.CompareType(theIssue))
{
return "(157, 160, 207)";
}
return "(0, 0, 0)";
}
private void AddShapeFeature(MTKConverter_FeatureGroupManager theManager, MTKBase_ShapeFeature theFeature,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
MTKBase_ShapeFeature aFeature = theFeature;
if (Machining_TurningFace.CompareType(aFeature))
{
Machining_TurningFace aTurningFace = Machining_TurningFace.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString("Radius", "mm", aTurningFace.Radius(), theShapeIdVector);
theManager.AddGroupData(MachiningFaceTypeToString(aType), MachiningFaceColor(aType), aFeatureData, theCount);
}
else if (Machining_Face.CompareType(aFeature))
{
Machining_Face aFace = Machining_Face.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData(MachiningFaceTypeToString(aType), MachiningFaceColor(aType), aFeatureData, theCount);
}
else if (Machining_Countersink.CompareType(aFeature))
{
Machining_Countersink aCountersink = Machining_Countersink.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aCountersink.Radius(),
"Depth", "mm", aCountersink.Depth(),
"Axis",
"",
new MTKConverter_Direction(aDir.
X(), aDir.
Y(), aDir.
Z()),
theShapeIdVector);
theManager.AddGroupData("Countersink(s)", "(55, 125, 34)", aFeatureData, theCount);
}
else if (Machining_Hole.CompareType(aFeature))
{
Machining_Hole aHole = Machining_Hole.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", new MTKConverter_Direction(aDir.X(), aDir.Y(), aDir.Z()),
theShapeIdVector);
theManager.AddGroupData(MachiningHoleTypeToString(aType), MachiningHoleColor(aType), aFeatureData, theCount);
}
else if (Machining_Pocket.CompareType(aFeature))
{
Machining_Pocket aPocket = Machining_Pocket.Cast(aFeature);
Machining_PocketType aType = aPocket.Type();
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aPocket.Length(),
"Width", "mm", aPocket.Width(),
"Depth", "mm", aPocket.Depth(),
"Axis", "", new MTKConverter_Direction(aDir.X(), aDir.Y(), aDir.Z()),
theShapeIdVector);
theManager.AddGroupData(MachiningPocketTypeToString(aType), MachiningPocketColor(aType), aFeatureData, theCount);
}
else if (Molding_ScrewBoss.CompareType (aFeature))
{
Molding_ScrewBoss aScrewBoss = Molding_ScrewBoss.Cast (aFeature);
String aFeatureData = WriteFeatureDataToString(
"Outer Radius", "mm", aScrewBoss.OuterRadius(),
"Inner Radius", "mm", aScrewBoss.InnerRadius(),
"Draft Angle", "deg", aScrewBoss.DraftAngle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Screw Boss(es)", "(12, 32, 63)", aFeatureData, theCount);
}
else if (MTKBase_Boss.CompareType(aFeature))
{
MTKBase_Boss aBoss = MTKBase_Boss.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aBoss.Length(),
"Width", "mm", aBoss.Width(),
"Height", "mm", aBoss.Height(),
theShapeIdVector);
theManager.AddGroupData("Boss(es)", "(56, 72, 13)", aFeatureData, theCount);
}
else if (Molding_Rib.CompareType(aFeature))
{
Molding_Rib aRib = Molding_Rib.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aRib.Length(),
"Height", "mm", aRib.Height(),
"Thickness", "mm", aRib.Thickness(),
"Draft Angle", "deg", aRib.DraftAngle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Rib(s)", "(34, 51, 127)", aFeatureData, theCount);
}
else if (SheetMetal_Bead.CompareType(aFeature))
{
SheetMetal_Bead aBead = SheetMetal_Bead.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString("Depth", "mm", aBead.Depth(), theShapeIdVector);
theManager.AddGroupData("Bead(s)", "(115, 251, 253)", aFeatureData, theCount);
}
else if (SheetMetal_Bend.CompareType(aFeature))
{
SheetMetal_Bend aBend = SheetMetal_Bend.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aBend.Radius(),
"Angle", "deg", aBend.Angle() * 180 / Math.PI,
"Length", "mm", aBend.Length(),
"Width", "mm", aBend.Width(),
theShapeIdVector);
theManager.AddGroupData(BendName(aBend), BendColor(aBend), aFeatureData, theCount);
}
else if (SheetMetal_Bridge.CompareType(aFeature))
{
SheetMetal_Bridge aBridge = SheetMetal_Bridge.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aBridge.Length(),
"Depth", "mm", aBridge.Depth(),
theShapeIdVector);
theManager.AddGroupData("Bridge(s)", "(240, 155, 89)", aFeatureData, theCount);
}
else if (SheetMetal_Hole.CompareType(aFeature))
{
SheetMetal_Hole aHole = SheetMetal_Hole.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", new MTKConverter_Direction(aDir.X(), aDir.Y(), aDir.Z()),
theShapeIdVector);
theManager.AddGroupData(SheetMetalHoleName(aHole), SheetMetalHoleColor(aHole), aFeatureData, theCount);
}
else if (SheetMetal_Cutout.CompareType(aFeature))
{
SheetMetal_Cutout aCutout = SheetMetal_Cutout.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString("Perimeter", "mm", aCutout.Perimeter(), theShapeIdVector);
theManager.AddGroupData("Cutout(s)", "(88, 19, 94)", aFeatureData, theCount);
}
else if (SheetMetal_Louver.CompareType(aFeature))
{
SheetMetal_Louver aLouver = SheetMetal_Louver.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Depth", "mm", aLouver.Depth(),
theShapeIdVector);
theManager.AddGroupData("Louver(s)", "(161, 251, 142)", aFeatureData, theCount);
}
else if (SheetMetal_Notch.CompareType(aFeature))
{
SheetMetal_Notch aNotch = SheetMetal_Notch.Cast(aFeature);
if (SheetMetal_StraightNotch.CompareType(aNotch))
{
SheetMetal_StraightNotch aStraightNotch = SheetMetal_StraightNotch.Cast(aNotch);
String 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);
}
else if (SheetMetal_VNotch.CompareType(aNotch))
{
SheetMetal_VNotch aVNotch = SheetMetal_VNotch.Cast(aNotch);
String aFeatureData = WriteFeatureDataToString (
"Length", "mm", aNotch.Length(),
"Width", "mm", aNotch.Width(),
"Angle", "deg", aVNotch.Angle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData ("V Notch(es)", "(235, 51, 36)", aFeatureData, theCount);
}
else
{
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aNotch.Length(),
"Width", "mm", aNotch.Width(),
theShapeIdVector);
theManager.AddGroupData("Notch(es)", "(239, 136, 190)", aFeatureData, theCount);
}
}
else if (SheetMetal_Tab.CompareType(aFeature))
{
SheetMetal_Tab aTab = SheetMetal_Tab.Cast(aFeature);
String aFeatureData = WriteFeatureDataToString(
"Length", "mm", aTab.Length(),
"Width", "mm", aTab.Width(),
theShapeIdVector);
theManager.AddGroupData("Tab(s)", "(127, 130, 187)", aFeatureData, theCount);
}
}
private void AddDrillingIssue(MTKConverter_FeatureGroupManager theManager, DFMMachining_DrillingIssue theIssue,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
if (DFMMachining_SmallDiameterHoleIssue.CompareType(theIssue))
{
DFMMachining_SmallDiameterHoleIssue aSmallHoleIssue = DFMMachining_SmallDiameterHoleIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_DeepHoleIssue.CompareType(theIssue))
{
DFMMachining_DeepHoleIssue aDeepHoleIssue = DFMMachining_DeepHoleIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Maximum Depth", "mm", aDeepHoleIssue.ExpectedMaxDepth(),
"Actual Depth", "mm", aDeepHoleIssue.ActualDepth(),
theShapeIdVector);
theManager.AddGroupData("Deep Hole(s)", "(0, 35, 245)", aFeatureData, theCount);
}
else if (DFMMachining_NonStandardDiameterHoleIssue.CompareType(theIssue))
{
DFMMachining_NonStandardDiameterHoleIssue aNSDiameterHoleIssue = DFMMachining_NonStandardDiameterHoleIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.CompareType(theIssue))
{
DFMMachining_NonStandardDrillPointAngleBlindHoleIssue aNSDrillPointAngleBlindHoleIssue = DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Nearest Standard Angle", "deg", aNSDrillPointAngleBlindHoleIssue.NearestStandardAngle() * 180 / Math.PI,
"Actual Angle", "deg", aNSDrillPointAngleBlindHoleIssue.ActualAngle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Non Standard Drill Point Angle Blind Hole(s)", "(88, 13, 78)", aFeatureData, theCount);
}
else if (DFMMachining_PartialHoleIssue.CompareType(theIssue))
{
DFMMachining_PartialHoleIssue aPartialHoleIssue = DFMMachining_PartialHoleIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_FlatBottomHoleIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Flat Bottom Hole(s)", "(240, 155, 89)", aFeatureData, theCount);
}
else if (DFMMachining_NonPerpendicularHoleIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Perpendicular Hole(s)", "(129, 127, 38)", aFeatureData, theCount);
}
else if (DFMMachining_IntersectingCavityHoleIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Intersecting Cavity Hole(s)", "(115, 43, 245)", aFeatureData, theCount);
}
}
private void AddMillingIssue(MTKConverter_FeatureGroupManager theManager, DFMMachining_MillingIssue theIssue,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
if (DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.CompareType(theIssue))
{
DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue aFloorRadiusIssue =
DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_DeepPocketIssue.CompareType(theIssue))
{
DFMMachining_DeepPocketIssue aDeepPocketIssue = DFMMachining_DeepPocketIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_HighBossIssue.CompareType(theIssue))
{
DFMMachining_HighBossIssue aHighBossIssue = DFMMachining_HighBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_LargeMilledPartIssue.CompareType(theIssue))
{
DFMMachining_LargeMilledPartIssue aLMPIssue = DFMMachining_LargeMilledPartIssue.Cast(theIssue);
DFMMachining_MilledPartSize anExpectedSize = aLMPIssue.ExpectedMaxMilledPartSize();
DFMMachining_MilledPartSize anActualSize = aLMPIssue.ActualMilledPartSize();
String aFeatureData = WriteFeatureDataToString(
"Expected Maximum Size (LxWxH)", "mm",
new MTKConverter_Dimension(anExpectedSize.Length(), anExpectedSize.Width(), anExpectedSize.Height()),
"Actual Size (LxWxH)", "mm",
new MTKConverter_Dimension(anActualSize.Length(), anActualSize.Width(), anActualSize.Height()),
theShapeIdVector);
theManager.AddGroupData("Large Milled Part(s)", "(17, 37, 205)", aFeatureData, theCount);
}
else if (DFMMachining_SmallRadiusMilledPartInternalCornerIssue.CompareType(theIssue))
{
DFMMachining_SmallRadiusMilledPartInternalCornerIssue aMSICRIssue =
DFMMachining_SmallRadiusMilledPartInternalCornerIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_NonPerpendicularMilledPartShapeIssue.CompareType(theIssue))
{
DFMMachining_NonPerpendicularMilledPartShapeIssue aNPMPSIssue =
DFMMachining_NonPerpendicularMilledPartShapeIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Actual Angle", "deg", aNPMPSIssue.ActualAngle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData ("Non Perpendicular Milled Part Shape(s)", "(129, 227, 138)", aFeatureData, theCount);
}
else if (DFMMachining_MilledPartExternalEdgeFilletIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData ("Milled Part External Edge Fillet(s)", "(201, 227, 13)", aFeatureData, theCount);
}
else if (DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.CompareType(theIssue))
{
DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue anInconsistentRadiusIssue =
DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected", "mm", anInconsistentRadiusIssue.ExpectedRadius(),
"Actual Radius", "mm", anInconsistentRadiusIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData("Inconsistent Radius Milled Part Floor Fillet Issue(s)", "(180, 15, 190)", aFeatureData, theCount);
}
else if (DFMMachining_NarrowRegionInPocketIssue.CompareType(theIssue))
{
DFMMachining_NarrowRegionInPocketIssue aNarrowRegionIssue =
DFMMachining_NarrowRegionInPocketIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.CompareType(theIssue))
{
DFMMachining_LargeDifferenceRegionsSizeInPocketIssue aLargeRatioIssue =
DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_SmallWallThicknessIssue.CompareType(theIssue))
{
DFMMachining_SmallWallThicknessIssue aSWTIssue = DFMMachining_SmallWallThicknessIssue.Cast(theIssue);
String 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);
}
}
private void AddTurningIssue(MTKConverter_FeatureGroupManager theManager, DFMBase_Issue theIssue,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
if (DFMMachining_LargeTurnedPartIssue.CompareType(theIssue))
{
DFMMachining_LargeTurnedPartIssue aLTSIssue = DFMMachining_LargeTurnedPartIssue.Cast(theIssue);
DFMMachining_TurnedPartSize anExpectedSize = aLTSIssue.ExpectedMaxTurnedPartSize();
DFMMachining_TurnedPartSize anActualSize = aLTSIssue.ActualTurnedPartSize();
String aFeatureData = WriteFeatureDataToString(
"Expected Maximum Size (LxR)", "mm", new MTKConverter_Pair(anExpectedSize.Length(), anExpectedSize.Radius()),
"Actual Size (LxR)", "mm", new MTKConverter_Pair(anActualSize.Length(), anActualSize.Radius()),
theShapeIdVector);
theManager.AddGroupData("Large Turned Part(s)", "(195, 195, 195)", aFeatureData, theCount);
}
else if (DFMMachining_LongSlenderTurnedPartIssue.CompareType(theIssue))
{
DFMMachining_LongSlenderTurnedPartIssue aLSTIssue = DFMMachining_LongSlenderTurnedPartIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_SmallDepthBlindBoredHoleReliefIssue.CompareType(theIssue))
{
DFMMachining_SmallDepthBlindBoredHoleReliefIssue aBBHRIssue = DFMMachining_SmallDepthBlindBoredHoleReliefIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_DeepBoredHoleIssue.CompareType(theIssue))
{
DFMMachining_DeepBoredHoleIssue aISBHIssue = DFMMachining_DeepBoredHoleIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.CompareType(theIssue))
{
DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue aODPRIssue =
DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Maximum Face Incline Angle", "deg", aODPRIssue.ExpectedMaxFaceInclineAngle() * 180 / Math.PI,
"Actual Face Incline Angle", "deg", aODPRIssue.ActualFaceInclineAngle() * 180 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Irregular Turned Part Outer Diameter Profile Relief(s)", "(239, 136, 190)", aFeatureData, theCount);
}
else if (DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.CompareType(theIssue))
{
DFMMachining_SmallRadiusTurnedPartInternalCornerIssue aTSICRIssue =
DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.Cast(theIssue);
String 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);
}
else if (DFMMachining_SquareEndKeywayIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Square End Keyway(s)", "(157, 160, 207)", aFeatureData, theCount);
}
else if (DFMMachining_NonSymmetricalAxialSlotIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Symmetrical Axial Slot(s)", "(130, 170, 200)", aFeatureData, theCount);
}
}
private void AddMoldingIssue (MTKConverter_FeatureGroupManager theManager, DFMBase_Issue theIssue,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
if (DFMMolding_HighRibIssue.CompareType (theIssue))
{
DFMMolding_HighRibIssue aHRIssue = DFMMolding_HighRibIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Maximum Height", "mm", aHRIssue.ExpectedMaxHeight(),
"Actual Height", "mm", aHRIssue.ActualHeight(),
theShapeIdVector);
theManager.AddGroupData("High Rib(s)", "(284, 36, 12)", aFeatureData, theCount);
}
else if (DFMMolding_HighScrewBossIssue.CompareType (theIssue))
{
DFMMolding_HighScrewBossIssue aHSBIssue = DFMMolding_HighScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_IrregularCoreDepthScrewBossIssue.CompareType (theIssue))
{
DFMMolding_IrregularCoreDepthScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDepthScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_IrregularCoreDiameterScrewBossIssue.CompareType (theIssue))
{
DFMMolding_IrregularCoreDiameterScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDiameterScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_IrregularThicknessRibIssue.CompareType (theIssue))
{
DFMMolding_IrregularThicknessRibIssue aITRIssue = DFMMolding_IrregularThicknessRibIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_IrregularWallThicknessIssue.CompareType (theIssue))
{
DFMMolding_IrregularWallThicknessIssue aIWTIssue = DFMMolding_IrregularWallThicknessIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_IrregularWallThicknessScrewBossIssue.CompareType (theIssue))
{
DFMMolding_IrregularWallThicknessScrewBossIssue aIWTSBIssue = DFMMolding_IrregularWallThicknessScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_LargeWallThicknessIssue.CompareType (theIssue))
{
DFMMolding_LargeWallThicknessIssue aLWTIssue = DFMMolding_LargeWallThicknessIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallBaseRadiusRibIssue.CompareType (theIssue))
{
DFMMolding_SmallBaseRadiusRibIssue aSBRRIssue = DFMMolding_SmallBaseRadiusRibIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallBaseRadiusScrewBossIssue.CompareType (theIssue))
{
DFMMolding_SmallBaseRadiusScrewBossIssue aSBRSBIssue = DFMMolding_SmallBaseRadiusScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallDraftAngleRibIssue.CompareType (theIssue))
{
DFMMolding_SmallDraftAngleRibIssue aSDARIssue = DFMMolding_SmallDraftAngleRibIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Draft Angle", "deg", aSDARIssue.ExpectedMinDraftAngle() * 180.0 / Math.PI,
"Actual Draft Angle", "deg", aSDARIssue.ActualDraftAngle() * 180.0 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Small Draft Angle Rib(s)", "(189, 200, 13)", aFeatureData, theCount);
}
else if (DFMMolding_SmallDistanceBetweenRibsIssue.CompareType (theIssue))
{
DFMMolding_SmallDistanceBetweenRibsIssue aSDBRIssue = DFMMolding_SmallDistanceBetweenRibsIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallDraftAngleScrewBossIssue.CompareType (theIssue))
{
DFMMolding_SmallDraftAngleScrewBossIssue aSDASBIssue = DFMMolding_SmallDraftAngleScrewBossIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Draft Angle", "deg", aSDASBIssue.ExpectedMinDraftAngle() * 180.0 / Math.PI,
"Actual Draft Angle", "deg", aSDASBIssue.ActualDraftAngle() * 180.0 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Small Draft Angle Screw Boss(es)", "(27, 101, 27)", aFeatureData, theCount);
}
else if (DFMMolding_SmallHoleBaseRadiusScrewBossIssue.CompareType (theIssue))
{
DFMMolding_SmallHoleBaseRadiusScrewBossIssue aSHBRSBIssue = DFMMolding_SmallHoleBaseRadiusScrewBossIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallDraftAngleWallIssue.CompareType (theIssue))
{
DFMMolding_SmallDraftAngleWallIssue aSDAWIssue = DFMMolding_SmallDraftAngleWallIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Draft Angle", "deg", aSDAWIssue.ExpectedMinDraftAngle() * 180.0 / Math.PI,
"Actual Draft Angle", "deg", aSDAWIssue.ActualDraftAngle() * 180.0 / Math.PI,
theShapeIdVector);
theManager.AddGroupData("Small Draft Angle Wall(s)", "(101, 67, 33)", aFeatureData, theCount);
}
else if (DFMMolding_NonChamferedScrewBossIssue.CompareType (theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Chamfered Screw Boss(es)", "(38, 38, 10)", aFeatureData, theCount);
}
else if (DFMMolding_SmallWallThicknessIssue.CompareType (theIssue))
{
DFMMolding_SmallWallThicknessIssue aSWTIssue = DFMMolding_SmallWallThicknessIssue.Cast(theIssue);
String 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);
}
else if (DFMMolding_SmallDistanceBetweenBossesIssue.CompareType (theIssue))
{
DFMMolding_SmallDistanceBetweenBossesIssue aSDBBIssue = DFMMolding_SmallDistanceBetweenBossesIssue.Cast(theIssue);
String 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);
}
}
private void AddSheetMetalIssue(MTKConverter_FeatureGroupManager theManager, DFMBase_Issue theIssue,
long theCount, ShapeIDVectorVector theShapeIdVector)
{
if (DFMSheetMetal_FlatPatternInterferenceIssue.CompareType(theIssue))
{
String aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Flat Pattern Interference(s)", "(115, 251, 253)", aFeatureData, theCount);
}
else if (DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.CompareType(theIssue))
{
DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue aICFRNIssue = DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_IrregularDepthExtrudedHoleIssue.CompareType(theIssue))
{
DFMSheetMetal_IrregularDepthExtrudedHoleIssue aIDEHIssue = DFMSheetMetal_IrregularDepthExtrudedHoleIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Extruded Height", "mm", aIDEHIssue.ExpectedMinExtrudedHeight(),
"Expected Maximum Extruded Height", "mm", aIDEHIssue.ExpectedMaxExtrudedHeight(),
"Actual Extruded Height", "mm", aIDEHIssue.ActualExtrudedHeight(),
theShapeIdVector);
theManager.AddGroupData("Irregular Depth Extruded Hole(s)", "(50, 120, 210)", aFeatureData, theCount);
}
else if (DFMSheetMetal_IrregularRadiusOpenHemBendIssue.CompareType(theIssue))
{
DFMSheetMetal_IrregularRadiusOpenHemBendIssue aIROHBIssue = DFMSheetMetal_IrregularRadiusOpenHemBendIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_InconsistentRadiusBendIssue.CompareType(theIssue))
{
DFMSheetMetal_InconsistentRadiusBendIssue aIRBIssue = DFMSheetMetal_InconsistentRadiusBendIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Radius", "mm", aIRBIssue.ExpectedRadius(),
"Actual Radius", "mm", aIRBIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData("Inconsistent Radius Bend(s)", "(0, 35, 245)", aFeatureData, theCount);
}
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();
String aFeatureData;
if (!aFirstActualRelief.IsNull() && !aSecondActualRelief.IsNull())
{
aFeatureData = WriteFeatureDataToString(
"Expected Minimum Relief Size (LxW)", "mm", new MTKConverter_Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"First Actual Relief Size (LxW)", "mm", new MTKConverter_Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"Second Actual Relief Size (LxW)", "mm", new MTKConverter_Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
}
else if (aFirstActualRelief.IsNull())
{
aFeatureData = WriteFeatureDataToString(
"Expected Minimum Relief Size (LxW)", "mm", new MTKConverter_Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", new MTKConverter_Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
}
else
{
aFeatureData = WriteFeatureDataToString(
"Expected Minimum Relief Size (LxW)", "mm", new MTKConverter_Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", new MTKConverter_Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
theShapeIdVector);
}
theManager.AddGroupData("Irregular Size Bend Relief(s)", "(22, 65, 124)", aFeatureData, theCount);
}
else if (DFMSheetMetal_IrregularSizeNotchIssue.CompareType(theIssue))
{
DFMSheetMetal_IrregularSizeNotchIssue aISNIssue = DFMSheetMetal_IrregularSizeNotchIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Size (LxW)", "mm", new MTKConverter_Pair(aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", new MTKConverter_Pair(aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData("Irregular Size Notch(s)", "(255, 254, 145)", aFeatureData, theCount);
}
else if (DFMSheetMetal_IrregularSizeTabIssue.CompareType(theIssue))
{
DFMSheetMetal_IrregularSizeTabIssue aISTIssue = DFMSheetMetal_IrregularSizeTabIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Size (LxW)", "mm", new MTKConverter_Pair(aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", new MTKConverter_Pair(aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData("Irregular Size Tab(s)", "(240, 155, 89)", aFeatureData, theCount);
}
else if (DFMSheetMetal_LargeDepthBeadIssue.CompareType(theIssue))
{
DFMSheetMetal_LargeDepthBeadIssue aLDBIssue = DFMSheetMetal_LargeDepthBeadIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_SmallDepthLouverIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallDepthLouverIssue aSDLIssue = DFMSheetMetal_SmallDepthLouverIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_NonStandardSheetSizeIssue.CompareType(theIssue))
{
DFMSheetMetal_NonStandardSheetSizeIssue aNSSSIssue = DFMSheetMetal_NonStandardSheetSizeIssue.Cast(theIssue);
DFMSheetMetal_SheetSize aNesrestStandardSize = aNSSSIssue.NearestStandardSheetSize();
DFMSheetMetal_SheetSize anActualSize = aNSSSIssue.ActualSheetSize();
String aFeatureData = WriteFeatureDataToString(
"Nearest Standard Size (LxW)", "mm", new MTKConverter_Pair(aNesrestStandardSize.Length(), aNesrestStandardSize.Width()),
"Actual Size (LxW)", "mm", new MTKConverter_Pair(anActualSize.Length(), anActualSize.Width()),
theShapeIdVector);
theManager.AddGroupData("Non Standard Sheet Size(s)", "(0, 0, 0)", aFeatureData, theCount);
}
else if (DFMSheetMetal_NonStandardSheetThicknessIssue.CompareType(theIssue))
{
DFMSheetMetal_NonStandardSheetThicknessIssue aNSSTIssue = DFMSheetMetal_NonStandardSheetThicknessIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_SmallDiameterHoleIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallDiameterHoleIssue aSDHIssue = DFMSheetMetal_SmallDiameterHoleIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_SmallLengthFlangeIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallLengthFlangeIssue aSLFIssue = DFMSheetMetal_SmallLengthFlangeIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_SmallLengthHemBendFlangeIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallLengthHemBendFlangeIssue aSLHBFIssue = DFMSheetMetal_SmallLengthHemBendFlangeIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Length", "mm", aSLHBFIssue.ExpectedMinLength(),
"Actual Length", "mm", aSLHBFIssue.ActualLength(),
theShapeIdVector);
theManager.AddGroupData("Small Length Hem Bend Flange(s)", "(70, 139, 51)", aFeatureData, theCount);
}
else if (DFMSheetMetal_SmallRadiusBendIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallRadiusBendIssue aSRBIssue = DFMSheetMetal_SmallRadiusBendIssue.Cast(theIssue);
String 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);
}
else if (DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.CompareType(theIssue))
{
DFMSheetMetal_SmallDistanceBetweenFeaturesIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.Cast(theIssue);
String aFeatureData = WriteFeatureDataToString(
"Expected Minimum Distance", "mm", aSDIssue.ExpectedMinDistanceBetweenFeatures(),
"Actual Distance", "mm", aSDIssue.ActualDistanceBetweenFeatures(),
theShapeIdVector);
theManager.AddGroupData(SmallDistanceIssueName(aSDIssue), SmallDistanceIssueColor(aSDIssue), aFeatureData, theCount);
}
}
private ShapeIDVector GetShapesId(Shape theShape, ShapeType theType)
{
ShapeIDVector aShapeIdVector = new ShapeIDVector();
ShapeIterator aShapeIt = new ShapeIterator(theShape, theType);
while (aShapeIt.HasNext())
{
Shape aShape = aShapeIt.Next();
aShapeIdVector.add(aShape.Id());
}
return aShapeIdVector;
}
private void AddShapesId(Shape theShape, ShapeType theType, ShapeIDVector theShapesIdVec)
{
ShapeIterator aShapeIt = new ShapeIterator(theShape, theType);
while (aShapeIt.HasNext())
{
Shape aShape = aShapeIt.Next();
theShapesIdVec.add(aShape.Id());
}
}
private void SortFeatures(MTKBase_FeatureList theFeatures, MTKConverter_FeatureMap theMap)
{
for (long i = 0; i < theFeatures.Size(); i++)
{
MTKBase_Feature aFeature = theFeatures.Feature(i);
if (MTKBase_CompositeFeature.CompareType(aFeature))
{
MTKBase_CompositeFeature aCompositeFeature = MTKBase_CompositeFeature.Cast(aFeature);
SortFeatures(aCompositeFeature.FeatureList(), theMap);
continue;
}
CountShapeIDVectorVectorPair anElement;
if (theMap.containsKey(aFeature))
{
anElement = theMap.get(aFeature);
}
else
{
anElement = new CountShapeIDVectorVectorPair(0, new ShapeIDVectorVector());
}
ShapeIDVectorVector aValue = anElement.Vector;
if (MTKBase_ShapeFeature.CompareType(aFeature))
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFeature);
if (SheetMetal_Cutout.CompareType(aFeature)
|| (SheetMetal_Hole.CompareType(aFeature) && !SheetMetal_ComplexHole.CompareType(aFeature))
|| SheetMetal_Notch.CompareType(aFeature) || SheetMetal_Tab.CompareType(aFeature))
{
}
ShapeIDVector aShapeIdVector = GetShapesId(aShapeFeature.Shape(), aShapeType);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_DrillingIssue.CompareType(aFeature))
{
DFMMachining_DrillingIssue anIssue = DFMMachining_DrillingIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(anIssue.Hole().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.CompareType(aFeature))
{
DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue aNSRMPFFIssue =
DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aNSRMPFFIssue.FloorFillet(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_DeepPocketIssue.CompareType(aFeature))
{
DFMMachining_DeepPocketIssue aDCIssue = DFMMachining_DeepPocketIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aDCIssue.Pocket().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_HighBossIssue.CompareType(aFeature))
{
DFMMachining_HighBossIssue aHBIssue = DFMMachining_HighBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aHBIssue.Boss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_LargeMilledPartIssue.CompareType(aFeature))
{
aValue.add(new ShapeIDVector());
}
else if (DFMMachining_SmallRadiusMilledPartInternalCornerIssue.CompareType(aFeature))
{
DFMMachining_SmallRadiusMilledPartInternalCornerIssue aMSICRIssue =
DFMMachining_SmallRadiusMilledPartInternalCornerIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aMSICRIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_NonPerpendicularMilledPartShapeIssue.CompareType(aFeature))
{
DFMMachining_NonPerpendicularMilledPartShapeIssue aNPMPSIssue =
DFMMachining_NonPerpendicularMilledPartShapeIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = GetShapesId (aNPMPSIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_MilledPartExternalEdgeFilletIssue.CompareType(aFeature))
{
DFMMachining_MilledPartExternalEdgeFilletIssue aMPEEFSIssue = DFMMachining_MilledPartExternalEdgeFilletIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = GetShapesId (aMPEEFSIssue.Fillet(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.CompareType(aFeature))
{
DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue aIRMPFFIssue =
DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aIRMPFFIssue.FloorFillet(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_NarrowRegionInPocketIssue.CompareType(aFeature)) {
DFMMachining_NarrowRegionInPocketIssue aNRIPIssue =
DFMMachining_NarrowRegionInPocketIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aNRIPIssue.InnerFeature(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aNRIPIssue.NarrowRegionSidewall(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.CompareType(aFeature)) {
DFMMachining_LargeDifferenceRegionsSizeInPocketIssue aLDRSIPIssue =
DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aLDRSIPIssue.InnerFeature(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MinRegionPocketSidewall(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MaxRegionPocketSidewall(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_SmallWallThicknessIssue.CompareType(aFeature)) {
DFMMachining_SmallWallThicknessIssue aSWTIssue = DFMMachining_SmallWallThicknessIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSWTIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_SmallDepthBlindBoredHoleReliefIssue.CompareType(aFeature))
{
DFMMachining_SmallDepthBlindBoredHoleReliefIssue aBBHRIssue =
DFMMachining_SmallDepthBlindBoredHoleReliefIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aBBHRIssue.BlindBoredHole(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_DeepBoredHoleIssue.CompareType(aFeature))
{
DFMMachining_DeepBoredHoleIssue aISBHIssue = DFMMachining_DeepBoredHoleIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aISBHIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.CompareType(aFeature))
{
DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue aODPRIssue =
DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aODPRIssue.Face(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.CompareType(aFeature))
{
DFMMachining_SmallRadiusTurnedPartInternalCornerIssue aTSICRIssue =
DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aTSICRIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_SquareEndKeywayIssue.CompareType(aFeature))
{
DFMMachining_SquareEndKeywayIssue aSEKIssue = DFMMachining_SquareEndKeywayIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSEKIssue.Keyway().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_NonSymmetricalAxialSlotIssue.CompareType(aFeature))
{
DFMMachining_NonSymmetricalAxialSlotIssue aNSASIssue =
DFMMachining_NonSymmetricalAxialSlotIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aNSASIssue.AxialSlot().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMachining_LargeTurnedPartIssue.CompareType(aFeature))
{
aValue.add(new ShapeIDVector());
}
else if (DFMMachining_LongSlenderTurnedPartIssue.CompareType(aFeature))
{
aValue.add(new ShapeIDVector());
}
else if (DFMMolding_HighRibIssue.CompareType(aFeature))
{
DFMMolding_HighRibIssue aHRIssue = DFMMolding_HighRibIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aHRIssue.Rib().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_HighScrewBossIssue.CompareType(aFeature))
{
DFMMolding_HighScrewBossIssue aHSBIssue = DFMMolding_HighScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aHSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_IrregularCoreDepthScrewBossIssue.CompareType(aFeature))
{
DFMMolding_IrregularCoreDepthScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDepthScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aICDSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_IrregularCoreDiameterScrewBossIssue.CompareType(aFeature))
{
DFMMolding_IrregularCoreDiameterScrewBossIssue aICDSBIssue = DFMMolding_IrregularCoreDiameterScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aICDSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_IrregularWallThicknessScrewBossIssue.CompareType(aFeature))
{
DFMMolding_IrregularWallThicknessScrewBossIssue aIWTSBIssue = DFMMolding_IrregularWallThicknessScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aIWTSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallBaseRadiusRibIssue.CompareType(aFeature))
{
DFMMolding_SmallBaseRadiusRibIssue aSBRRIssue = DFMMolding_SmallBaseRadiusRibIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSBRRIssue.Rib().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallBaseRadiusScrewBossIssue.CompareType(aFeature))
{
DFMMolding_SmallBaseRadiusScrewBossIssue aSBRSBIssue = DFMMolding_SmallBaseRadiusScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSBRSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallDraftAngleRibIssue.CompareType(aFeature))
{
DFMMolding_SmallDraftAngleRibIssue aSMDARIssue = DFMMolding_SmallDraftAngleRibIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSMDARIssue.Rib().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallDistanceBetweenRibsIssue.CompareType(aFeature))
{
DFMMolding_SmallDistanceBetweenRibsIssue aSDBRIssue = DFMMolding_SmallDistanceBetweenRibsIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId (aSDBRIssue.FirstRib().Shape(),
ShapeType.Face, aShapeIdVector);
AddShapesId (aSDBRIssue.SecondRib().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallHoleBaseRadiusScrewBossIssue.CompareType(aFeature))
{
DFMMolding_SmallHoleBaseRadiusScrewBossIssue aSHBRSBIssue = DFMMolding_SmallHoleBaseRadiusScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSHBRSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallDraftAngleWallIssue.CompareType(aFeature))
{
DFMMolding_SmallDraftAngleWallIssue aSDAWIssue = DFMMolding_SmallDraftAngleWallIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSDAWIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_NonChamferedScrewBossIssue.CompareType(aFeature))
{
DFMMolding_NonChamferedScrewBossIssue aWTCSBIssue = DFMMolding_NonChamferedScrewBossIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aWTCSBIssue.ScrewBoss().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_IrregularWallThicknessIssue.CompareType(aFeature))
{
DFMMolding_IrregularWallThicknessIssue aIWTIssue = DFMMolding_IrregularWallThicknessIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aIWTIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_LargeWallThicknessIssue.CompareType(aFeature))
{
DFMMolding_LargeWallThicknessIssue aLWTIssue = DFMMolding_LargeWallThicknessIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aLWTIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallWallThicknessIssue.CompareType(aFeature))
{
DFMMolding_SmallWallThicknessIssue aSWTIssue = DFMMolding_SmallWallThicknessIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSWTIssue.Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMMolding_SmallDistanceBetweenBossesIssue.CompareType(aFeature))
{
DFMMolding_SmallDistanceBetweenBossesIssue aSDBBIssue = DFMMolding_SmallDistanceBetweenBossesIssue.Cast (aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDBBIssue.FirstBoss().Shape(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aSDBBIssue.SecondBoss().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_FlatPatternInterferenceIssue.CompareType(aFeature))
{
DFMSheetMetal_FlatPatternInterferenceIssue aFPIIssue = DFMSheetMetal_FlatPatternInterferenceIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
aShapeIdVector.add(aFPIIssue.FirstFace().Id());
aShapeIdVector.add(aFPIIssue.SecondFace().Id());
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue aICFRNIssue = DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aICFRNIssue.Notch().Shape(),
ShapeType.Edge);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularDepthExtrudedHoleIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularDepthExtrudedHoleIssue aIDEHIssue = DFMSheetMetal_IrregularDepthExtrudedHoleIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aIDEHIssue.Hole().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularRadiusOpenHemBendIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularRadiusOpenHemBendIssue aICFRNIssue = DFMSheetMetal_IrregularRadiusOpenHemBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aICFRNIssue.Bend().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_InconsistentRadiusBendIssue.CompareType(aFeature))
{
DFMSheetMetal_InconsistentRadiusBendIssue aIRBIssue = DFMSheetMetal_InconsistentRadiusBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aIRBIssue.Bend().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularSizeBendReliefIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularSizeBendReliefIssue aISBRIssue = DFMSheetMetal_IrregularSizeBendReliefIssue.Cast(aFeature);
SheetMetal_BendRelief aFirstActualRelief = aISBRIssue.FirstActualRelief();
SheetMetal_BendRelief aSecondActualRelief = aISBRIssue.SecondActualRelief();
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aISBRIssue.Bend().Shape(),
ShapeType.Face, aShapeIdVector);
if (!aFirstActualRelief.IsNull())
{
AddShapesId(aFirstActualRelief.Shape(),
ShapeType.Edge, aShapeIdVector);
}
if (!aSecondActualRelief.IsNull())
{
AddShapesId(aSecondActualRelief.Shape(),
ShapeType.Edge, aShapeIdVector);
}
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularSizeNotchIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularSizeNotchIssue aISNIssue = DFMSheetMetal_IrregularSizeNotchIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aISNIssue.Notch().Shape(),
ShapeType.Edge);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_IrregularSizeTabIssue.CompareType(aFeature))
{
DFMSheetMetal_IrregularSizeTabIssue aISTIssue = DFMSheetMetal_IrregularSizeTabIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aISTIssue.Tab().Shape(),
ShapeType.Edge);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_LargeDepthBeadIssue.CompareType(aFeature))
{
DFMSheetMetal_LargeDepthBeadIssue aLDBIssue = DFMSheetMetal_LargeDepthBeadIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aLDBIssue.Bead().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDepthLouverIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDepthLouverIssue aSDLIssue = DFMSheetMetal_SmallDepthLouverIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSDLIssue.Louver().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_NonStandardSheetSizeIssue.CompareType(aFeature))
{
aValue.add(new ShapeIDVector());
}
else if (DFMSheetMetal_NonStandardSheetThicknessIssue.CompareType(aFeature))
{
aValue.add(new ShapeIDVector());
}
else if (DFMSheetMetal_SmallDiameterHoleIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDiameterHoleIssue aSDHIssue = DFMSheetMetal_SmallDiameterHoleIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSDHIssue.Hole().Shape(),
ShapeType.Edge);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallLengthFlangeIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallLengthFlangeIssue aSLFIssue = DFMSheetMetal_SmallLengthFlangeIssue.Cast(aFeature);
MTKBase_FeatureList aFlange = aSLFIssue.Flange().FeatureList();
ShapeIDVector aShapeIdVector = new ShapeIDVector();
for (long j = 0; j < aFlange.Size(); j++)
{
MTKBase_Feature aFlangeFace = aFlange.Feature(j);
if (MTKBase_ShapeFeature.CompareType(aFlangeFace))
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFlangeFace);
AddShapesId(aShapeFeature.Shape(),
ShapeType.Face, aShapeIdVector);
}
}
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallLengthHemBendFlangeIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallLengthHemBendFlangeIssue aSLHBFIssue = DFMSheetMetal_SmallLengthHemBendFlangeIssue.Cast(aFeature);
MTKBase_FeatureList aFlange = aSLHBFIssue.Flange().FeatureList();
ShapeIDVector aShapeIdVector = new ShapeIDVector();
for (long j = 0; j < aFlange.Size(); j++)
{
MTKBase_Feature aFlangeFace = aFlange.Feature(j);
if (MTKBase_ShapeFeature.CompareType(aFlangeFace))
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFlangeFace);
AddShapesId(aShapeFeature.Shape(),
ShapeType.Face, aShapeIdVector);
}
}
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallRadiusBendIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallRadiusBendIssue aSRBIssue = DFMSheetMetal_SmallRadiusBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = GetShapesId(aSRBIssue.Bend().Shape(),
ShapeType.Face);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Bend().Shape(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Face, aShapeIdVector);
aShapeIdVector.add(aSDIssue.Edge().Id());
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.FirstHole().Shape(),
ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Cutout().Shape(),
ShapeType.Edge, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Edge, aShapeIdVector);
aShapeIdVector.add(aSDIssue.Edge().Id());
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Hole().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Notch().Shape(),
ShapeType.Edge, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenHolesIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenHolesIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenHolesIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.FirstHole().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(),
ShapeType.Edge, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.Notch().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(),
ShapeType.Face, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenNotchesIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenNotchesIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenNotchesIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.FirstNotch().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondNotch().Shape(),
ShapeType.Edge, aShapeIdVector);
aValue.add(aShapeIdVector);
}
else if (DFMSheetMetal_SmallDistanceBetweenTabsIssue.CompareType(aFeature))
{
DFMSheetMetal_SmallDistanceBetweenTabsIssue aSDIssue = DFMSheetMetal_SmallDistanceBetweenTabsIssue.Cast(aFeature);
ShapeIDVector aShapeIdVector = new ShapeIDVector();
AddShapesId(aSDIssue.FirstTab().Shape(),
ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondTab().Shape(),
ShapeType.Edge, aShapeIdVector);
aValue.add(aShapeIdVector);
}
anElement = new CountShapeIDVectorVectorPair(anElement.Count + 1, aValue);
theMap.put(aFeature, anElement);
}
}
private boolean WriteFeatures(JSONWriter theWriter, String theGroupName, String theSubgroupName, MTKBase_FeatureList theFeatures,
String theMessageForEmptyList)
{
theWriter.OpenSection(theSubgroupName);
theWriter.WriteData("name", theGroupName);
if (theFeatures.IsEmpty())
{
theWriter.WriteData("message", theMessageForEmptyList);
}
else
{
MTKConverter_FeatureMap aSortedFeatures = new MTKConverter_FeatureMap();
SortFeatures(theFeatures, aSortedFeatures);
MTKConverter_FeatureGroupManager aFGManager = new MTKConverter_FeatureGroupManager();
for (Map.Entry<MTKBase_Feature, CountShapeIDVectorVectorPair> i : aSortedFeatures.entrySet())
{
MTKBase_Feature aFeature = i.getKey();
long aCount = i.getValue().Count;
ShapeIDVectorVector aShapeIDVec = i.getValue().Vector;
if (MTKBase_ShapeFeature.CompareType(aFeature))
{
AddShapeFeature(aFGManager, MTKBase_ShapeFeature.Cast(aFeature), aCount, aShapeIDVec);
}
else if (DFMMachining_DrillingIssue.CompareType(aFeature))
{
AddDrillingIssue(aFGManager, DFMMachining_DrillingIssue.Cast(aFeature), aCount, aShapeIDVec);
}
else if (DFMMachining_MillingIssue.CompareType(aFeature))
{
AddMillingIssue(aFGManager, DFMMachining_MillingIssue.Cast(aFeature), aCount, aShapeIDVec);
}
else if (DFMSheetMetal_BendIssue.CompareType(aFeature)
|| DFMSheetMetal_FlatPatternInterferenceIssue.CompareType(aFeature)
|| DFMSheetMetal_HoleIssue.CompareType(aFeature)
|| DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.CompareType(aFeature)
|| DFMSheetMetal_IrregularDepthExtrudedHoleIssue.CompareType(aFeature)
|| DFMSheetMetal_IrregularSizeNotchIssue.CompareType(aFeature)
|| DFMSheetMetal_IrregularSizeTabIssue.CompareType(aFeature)
|| DFMSheetMetal_LargeDepthBeadIssue.CompareType(aFeature)
|| DFMSheetMetal_SmallDepthLouverIssue.CompareType(aFeature)
|| DFMSheetMetal_NonStandardSheetSizeIssue.CompareType(aFeature)
|| DFMSheetMetal_NonStandardSheetThicknessIssue.CompareType(aFeature)
|| DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.CompareType(aFeature))
{
AddSheetMetalIssue(aFGManager, DFMBase_Issue.Cast(aFeature), aCount, aShapeIDVec);
}
else if (DFMMolding_HighRibIssue.CompareType(aFeature)
|| DFMMolding_HighScrewBossIssue.CompareType(aFeature)
|| DFMMolding_IrregularCoreDepthScrewBossIssue.CompareType(aFeature)
|| DFMMolding_IrregularCoreDiameterScrewBossIssue.CompareType(aFeature)
|| DFMMolding_IrregularWallThicknessScrewBossIssue.CompareType(aFeature)
|| DFMMolding_SmallBaseRadiusRibIssue.CompareType(aFeature)
|| DFMMolding_SmallBaseRadiusScrewBossIssue.CompareType(aFeature)
|| DFMMolding_IrregularWallThicknessIssue.CompareType(aFeature)
|| DFMMolding_LargeWallThicknessIssue.CompareType(aFeature)
|| DFMMolding_SmallDraftAngleRibIssue.CompareType(aFeature)
|| DFMMolding_SmallDistanceBetweenRibsIssue.CompareType(aFeature)
|| DFMMolding_SmallHoleBaseRadiusScrewBossIssue.CompareType(aFeature)
|| DFMMolding_SmallDraftAngleWallIssue.CompareType(aFeature)
|| DFMMolding_NonChamferedScrewBossIssue.CompareType(aFeature)
|| DFMMolding_SmallWallThicknessIssue.CompareType(aFeature)
|| DFMMolding_SmallDistanceBetweenBossesIssue.CompareType(aFeature))
{
AddMoldingIssue(aFGManager, DFMBase_Issue.Cast(aFeature), aCount, aShapeIDVec);
}
else if (DFMBase_Issue.CompareType(aFeature))
{
AddTurningIssue(aFGManager, DFMBase_Issue.Cast(aFeature), aCount, aShapeIDVec);
}
}
theWriter.WriteData("totalFeatureCount", aFGManager.TotalFeatureCount());
theWriter.OpenArraySection("featureGroups");
aFGManager.Write(theWriter);
theWriter.CloseArraySection();
}
theWriter.CloseSection();
return true;
}
private String MachiningProcessName(Machining_OperationType theOperation)
{
switch (theOperation)
{
default:
break;
}
return "CNC Machining";
}
private boolean HasShapes(
cadex.Collections.BodyList theBodies, ShapeType theType)
{
for (Body aBody : theBodies) {
ShapeIterator aShapeIt = new ShapeIterator(aBody, theType);
if (aShapeIt.HasNext()) {
return true;
}
}
return false;
}
private void WriteThicknessNode(JSONWriter theWriter, String theParamName, double theParamValue,
PointPair thePoints, String theNodeName)
{
Point aFirstPoint = thePoints.First;
Point aSecondPoint = thePoints.Second;
theWriter.OpenSection(theNodeName);
theWriter.WriteData("name", theParamName);
theWriter.WriteData("units", "mm");
theWriter.WriteData("value", theParamValue);
theWriter.WriteData("firstPoint", new MTKConverter_Point(aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z()));
theWriter.WriteData("secondPoint", new MTKConverter_Point(aSecondPoint.X(), aSecondPoint.Y(), aSecondPoint.Z()));
theWriter.CloseSection();
}
private void WriteUnfoldedPartFeatures(JSONWriter theWriter, MTKConverter_UnfoldedPartData theData)
{
theWriter.OpenSection("featureRecognitionUnfolded");
theWriter.WriteData("name", "Feature Recognition");
if (theData.IsInit())
{
StringWriter aStrWriter = new StringWriter();
PrintWriter aStream = new PrintWriter(aStrWriter);
JSONWriter aWriter = new JSONWriter(aStream, 4);
aWriter.WriteData("parametersCount", 3);
aWriter.OpenArraySection("parameters");
SheetMetal_FlatPattern 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(aStrWriter.toString());
}
else
{
theWriter.WriteData("message", "Unfolded part wasn't generated.");
}
theWriter.CloseSection();
}
private void WritePartProcessData(JSONWriter theWriter, MTKConverter_ProcessData theProcessData)
{
boolean aRes = false;
theWriter.WriteData("partId", theProcessData.myPart.Uuid());
String anErrorMsg = "An error occurred while processing the part.";
if (theProcessData instanceof MTKConverter_MachiningData)
{
MTKConverter_MachiningData aMD = (MTKConverter_MachiningData)theProcessData;
theWriter.WriteData("process", MachiningProcessName(aMD.myOperation));
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 (!HasShapes(aMD.myPart.Bodies(),
ShapeType.Solid))
{
anErrorMsg = "The part can't be analyzed due to lack of: BRep representation or solids in BRep representation.";
}
}
else if (theProcessData instanceof MTKConverter_MoldingData)
{
MTKConverter_MoldingData aMoldingData = (MTKConverter_MoldingData)theProcessData;
theWriter.WriteData("process", "Molding Analysis");
if (!aMoldingData.myFeatureList.IsEmpty())
{
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 (!HasShapes(aMoldingData.myPart.Bodies(),
ShapeType.Solid))
{
anErrorMsg = "The part can't be analyzed due to lack of: " +
"BRep representation, solids in BRep representation or Poly representations.";
}
}
else if (theProcessData instanceof MTKConverter_SheetMetalData)
{
MTKConverter_SheetMetalData aSMD = (MTKConverter_SheetMetalData)theProcessData;
theWriter.WriteData("process", "Sheet Metal");
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.");
MTKConverter_UnfoldedPartData 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 (!HasShapes(aSMD.myPart.Bodies(),
ShapeType.Solid)
&& !HasShapes(aSMD.myPart.Bodies(),
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 if (theProcessData instanceof MTKConverter_WallThicknessData)
{
MTKConverter_WallThicknessData aWTD = (MTKConverter_WallThicknessData)theProcessData;
theWriter.WriteData("process", "Wall Thickness Analysis");
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 (!HasShapes(aWTD.myPart.Bodies(),
ShapeType.Solid))
{
anErrorMsg = "The part can't be analyzed due to lack of: " +
"BRep representation, solids in BRep representation.";
}
}
else
{
anErrorMsg = "Unrecognized process";
}
if (!aRes)
{
theWriter.WriteData("error", anErrorMsg);
}
}
private ArrayList<MTKConverter_ProcessData> myData;
}
Defines a 3D Direction.
Definition Direction.hxx:34
Direction()
Constructor.
Definition Direction.cxx:38
Defines classes, types, enums, and functions related to geometric entities.
@ Machining_OT_Milling
Milling operation type.
Definition Machining_OperationType.hxx:29
@ Machining_OT_LatheMilling
Lathe + Milling operation type.
Definition Machining_OperationType.hxx:30
Machining_HoleType
Defines a hole type in machining.
Definition Machining_HoleType.hxx:28
@ Machining_HT_Partial
Partial hole type.
Definition Machining_HoleType.hxx:32
@ Machining_HT_Through
Through hole type.
Definition Machining_HoleType.hxx:29
@ Machining_HT_FlatBottom
Flat Bottom hole type.
Definition Machining_HoleType.hxx:30
@ Machining_HT_Blind
Blind hole type.
Definition Machining_HoleType.hxx:31
Machining_FaceType
Describes a face produced by a specified machining operation.
Definition Machining_FaceType.hxx:28
@ Machining_FT_Deburr
Deburr face type.
Definition Machining_FaceType.hxx:34
@ Machining_FT_FlatFaceMilled
Flat Face Milled face type.
Definition Machining_FaceType.hxx:35
@ Machining_FT_TurnDiameter
Turn Diameter face type.
Definition Machining_FaceType.hxx:38
@ Machining_FT_Bore
Bore face type.
Definition Machining_FaceType.hxx:29
@ Machining_FT_TurnForm
Turn Form face type.
Definition Machining_FaceType.hxx:40
@ Machining_FT_ConvexProfileEdgeMilling
Convex Profile Edge Milling face type.
Definition Machining_FaceType.hxx:32
@ Machining_FT_FlatMilled
Flat Milled face type.
Definition Machining_FaceType.hxx:36
@ Machining_FT_FlatSideMilled
Flat Side Milled face type.
Definition Machining_FaceType.hxx:37
@ Machining_FT_ConcaveFilletEdgeMilling
Concave Fillet Edge Milling face type.
Definition Machining_FaceType.hxx:31
@ Machining_FT_TurnFace
Turn Face face type.
Definition Machining_FaceType.hxx:39
@ Machining_FT_CurvedMilled
Curved Milled face type.
Definition Machining_FaceType.hxx:33
@ Machining_FT_CircularMilled
Circular Milled face type.
Definition Machining_FaceType.hxx:30
SheetMetal_HemBendType
Defines a hem bend type in sheet metal.
Definition SheetMetal_HemBendType.hxx:28
@ SheetMetal_HBT_Rope
Rope hem bend type.
Definition SheetMetal_HemBendType.hxx:32
@ SheetMetal_HBT_Flattened
Flattened hem bend type.
Definition SheetMetal_HemBendType.hxx:29
@ SheetMetal_HBT_Rolled
Rolled hem bend type.
Definition SheetMetal_HemBendType.hxx:33
@ SheetMetal_HBT_Open
Open hem bend type.
Definition SheetMetal_HemBendType.hxx:30
@ SheetMetal_HBT_Teardrop
Teardrop hem bend type.
Definition SheetMetal_HemBendType.hxx:31