Hide menu
Loading...
Searching...
No Matches
MTKConverter/Program.cs

Refer to the MTK Converter Example

MTKConverter_PartProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
using System.Collections.Generic;
namespace mtkconverter
{
class MTKConverter_ProcessData
{
protected MTKConverter_ProcessData(Part thePart)
{
myPart = thePart;
}
public Part myPart;
}
abstract class MTKConverter_PartProcessor : ModelElementVoidVisitor
{
protected MTKConverter_PartProcessor()
{
myData = new List<MTKConverter_ProcessData>();
}
public List<MTKConverter_ProcessData> myData;
public override void Apply(Part thePart)
{
cadex.Collections.BodyList aBodyList = thePart.Bodies();
for (int i = 0; i < aBodyList.Count; ++i)
{
Body aBody = aBodyList[i];
var aShapeIt = new ShapeIterator(aBody);
while (aShapeIt.HasNext())
{
var aShape = aShapeIt.Next();
if (aShape.Type() == ShapeType.Solid)
{
ProcessSolid(thePart, Solid.Cast(aShape));
}
else if (aShape.Type() == ShapeType.Shell)
{
ProcessShell(thePart, Shell.Cast(aShape));
}
}
}
PostPartProcess(thePart);
}
public abstract void ProcessSolid(Part thePart, Solid theSolid);
public abstract void ProcessShell(Part thePart, Shell theShell);
public abstract void PostPartProcess(Part thePart);
}
class MTKConverter_VoidPartProcessor : MTKConverter_PartProcessor
{
public MTKConverter_VoidPartProcessor() : base() { }
public override void ProcessSolid(Part thePart, Solid theSolid) { }
public override void ProcessShell(Part thePart, Shell theShell) { }
public override void PostPartProcess(Part thePart) { }
}
}
Element visitor with empty implementation.
Definition ModelElementVisitor.hxx:64
Defines a leaf node in the scene graph hiearchy.
Definition Part.hxx:34
Iterates over subshapes in a shape.
Definition ShapeIterator.hxx:32
Defines a connected set of faces.
Definition Shell.hxx:32
Defines a topological solid.
Definition Solid.hxx:32
Defines classes, types, enums, and functions related to topological entities and scene graph elements...
ShapeType
Defines shape type.
Definition ShapeType.hxx:27
Defines classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30

MTKConverter_MachiningProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
namespace mtkconverter
{
class MTKConverter_MachiningData : MTKConverter_ProcessData
{
public MTKConverter_MachiningData(Part thePart) : base(thePart)
{
myFeatureList = new MTKBase_FeatureList();
myIssueList = new MTKBase_FeatureList();
}
public MTKBase_FeatureList myFeatureList;
public MTKBase_FeatureList myIssueList;
public Machining_OperationType myOperation;
}
class MTKConverter_MachiningProcessor : MTKConverter_VoidPartProcessor
{
public MTKConverter_MachiningProcessor(Machining_OperationType theOperation) : base()
{
myOperation = theOperation;
}
private Machining_OperationType myOperation;
public override void ProcessSolid(Part thePart, Solid theSolid)
{
MTKConverter_MachiningData aMachiningData = new MTKConverter_MachiningData(thePart);
myData.Add(aMachiningData);
aMachiningData.myOperation = myOperation;
aFeatureRecognizer.Parameters().SetOperation(myOperation);
anAnalyzer.AddTool(aFeatureRecognizer);
Machining_Data aData = anAnalyzer.Perform(theSolid);
if (aData.IsEmpty())
{
return;
}
//features
aMachiningData.myFeatureList = aData.FeatureList();
//issues
DFMMachining_Analyzer aDrillingAnalyzer = new DFMMachining_Analyzer(aDrillingParameters);
aMachiningData.myIssueList = aDrillingAnalyzer.Perform(theSolid, aData);
DFMMachining_Analyzer aMillingAnalyzer = new DFMMachining_Analyzer(aMillingParameters);
MTKBase_FeatureList aMillingIssueList = aMillingAnalyzer.Perform(theSolid, aData);
for (uint i = 0; i < aMillingIssueList.Size(); ++i)
{
MTKBase_Feature anIssue = aMillingIssueList.Feature(i);
if (myOperation == Machining_OperationType.Machining_OT_LatheMilling
{
continue;
}
aMachiningData.myIssueList.Append(anIssue);
}
if (myOperation == Machining_OperationType.Machining_OT_LatheMilling)
{
DFMMachining_Analyzer aTurningAnalyzer = new DFMMachining_Analyzer(aTurninigParameters);
MTKBase_FeatureList aTurningIssueList = aTurningAnalyzer.Perform(theSolid, aData);
for (uint i = 0; i < aTurningIssueList.Size(); ++i)
{
MTKBase_Feature anIssue = aTurningIssueList.Feature(i);
aMachiningData.myIssueList.Append(anIssue);
}
}
}
}
}
Provides an interface to run DFM Machining analysis.
Definition DFMMachining_Analyzer.hxx:43
MTKBase_FeatureList Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Runs analyzing process.
Definition DFMMachining_Analyzer.cxx:112
Describes deep pocket issue found during cnc machining milling design analysis.
Definition DFMMachining_DeepPocketIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm deep pocket issue.
Definition DFMMachining_DeepPocketIssue.cxx:142
Defines parameters used in cnc machining drilling design analysis.
Definition DFMMachining_DrillingAnalyzerParameters.hxx:31
Defines parameters used in cnc machining milling design analysis.
Definition DFMMachining_MillingAnalyzerParameters.hxx:36
Defines parameters used in cnc machining turning design analysis.
Definition DFMMachining_TurningAnalyzerParameters.hxx:35
Describes a base class of MTK based features.
Definition MTKBase_Feature.hxx:33
Defines a list of features.
Definition MTKBase_FeatureList.hxx:36
size_t Size() const
Returns the number of elements in the list.
Definition MTKBase_FeatureList.cxx:88
const MTKBase_Feature & Feature(size_t theIndex) const
Access specified element.
Definition MTKBase_FeatureList.cxx:69
Provides an interface to run several analyzer tools for different types of machining processing.
Definition Machining_Analyzer.hxx:42
Machining_Data Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Runs the analyzing process.
Definition Machining_Analyzer.cxx:81
void AddTool(const Machining_AnalyzerTool &theTool)
Adds additional tool to run during analyzing process.
Definition Machining_Analyzer.cxx:101
Defines data used in Machining analysis.
Definition Machining_Data.hxx:36
bool IsEmpty() const
Returns true if the data is empty.
Definition Machining_Data.cxx:54
const MTKBase_FeatureList & FeatureList() const
Definition Machining_Data.cxx:48
Provides an interface to recognizing machining features tool.
Definition Machining_FeatureRecognizer.hxx:45
const Machining_FeatureRecognizerParameters & Parameters() const
Returns parameters.
Definition Machining_FeatureRecognizer.cxx:304
void SetOperation(Machining_OperationType theOperation)
Definition Machining_FeatureRecognizerParameters.cxx:205
Machining_OperationType
Defines an operation type in machining.
Definition Machining_OperationType.hxx:28

MTKConverter_SheetMetalProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
using System;
using System.Collections.Generic;
namespace mtkconverter
{
class MTKConverter_UnfoldedPartData
{
public MTKConverter_UnfoldedPartData()
{
myIssueList = new MTKBase_FeatureList();
}
public bool IsInit() { return myFlatPattern != null; }
public SheetMetal_FlatPattern myFlatPattern;
public MTKBase_FeatureList myIssueList;
}
class MTKConverter_SheetMetalData : MTKConverter_ProcessData
{
public MTKConverter_SheetMetalData(Part thePart) : base(thePart)
{
myFeatureList = new MTKBase_FeatureList();
myIssueList = new MTKBase_FeatureList();
myUnfoldedPartData = new MTKConverter_UnfoldedPartData();
}
public bool myIsSheetMetalPart = true;
public MTKBase_FeatureList myFeatureList;
public MTKBase_FeatureList myIssueList;
public MTKConverter_UnfoldedPartData myUnfoldedPartData;
}
class MTKConverter_SheetMetalProcessor : MTKConverter_VoidPartProcessor
{
public MTKConverter_SheetMetalProcessor(Model theUnfoldedModel) : base()
{
myAnalyzer = new SheetMetal_Analyzer();
myAnalyzer.AddTool(new SheetMetal_FeatureRecognizer());
myAnalyzer.AddTool(new SheetMetal_Unfolder());
myUnfoldedModel = theUnfoldedModel;
myCurrentUnfoldedBody = new SheetBody();
}
private SheetMetal_Analyzer myAnalyzer;
private Model myUnfoldedModel;
private SheetBody myCurrentUnfoldedBody;
public override void ProcessSolid(Part thePart, Solid theSolid)
{
SheetMetal_Data anSMData = myAnalyzer.Perform(theSolid);
UpdateProcessData(anSMData, thePart);
}
public override void ProcessShell(Part thePart, Shell theShell)
{
SheetMetal_Data anSMData = myAnalyzer.Perform(theShell);
UpdateProcessData(anSMData, thePart);
}
public override void PostPartProcess(Part thePart)
{
if (myCurrentUnfoldedBody.Shapes().Count == 0)
{
return;
}
Part anUnfoldedPart = new Part(thePart.Name());
anUnfoldedPart.SetUuid(thePart.Uuid());
anUnfoldedPart.AddBody(myCurrentUnfoldedBody);
myUnfoldedModel.AddRoot(anUnfoldedPart);
myCurrentUnfoldedBody = new SheetBody();
}
public void UpdateProcessData(SheetMetal_Data theData, Part thePart)
{
MTKConverter_SheetMetalData anSMData = new MTKConverter_SheetMetalData(thePart);
myData.Add(anSMData);
if (theData.IsEmpty())
{
anSMData.myIsSheetMetalPart = false;
return;
}
anSMData.myFeatureList = theData.FeatureList();
SheetMetal_FlatPattern aFlatPattern = theData.FlatPattern();
Shell anUnfoldedShell = !aFlatPattern.IsNull() ? aFlatPattern.UnfoldedShell() : null;
MTKConverter_UnfoldedPartData anUnfoldedData = anSMData.myUnfoldedPartData;
if (anUnfoldedShell != null)
{
myCurrentUnfoldedBody.Append(anUnfoldedShell);
anUnfoldedData.myFlatPattern = aFlatPattern;
}
MTKBase_FeatureList anIssueList = aDFMAnalyzer.Perform(theData);
for (uint i = 0; i < anIssueList.Size(); ++i)
{
MTKBase_Feature anIssue = anIssueList.Feature(i);
if (anUnfoldedData.IsInit()
{
anUnfoldedData.myIssueList.Append(anIssue);
}
else
{
anSMData.myIssueList.Append(anIssue);
}
}
}
}
}
Provides an interface to run DFM Sheet Metal analysis.
Definition DFMSheetMetal_Analyzer.hxx:44
MTKBase_FeatureList Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Definition DFMSheetMetal_Analyzer.cxx:1565
Describes interference issue for flat pattern found during sheet metal design analysis.
Definition DFMSheetMetal_FlatPatternInterferenceIssue.hxx:32
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a flat pattern inteference issue.
Definition DFMSheetMetal_FlatPatternInterferenceIssue.cxx:123
Describes non standard sheet size issue found during sheet metal design analysis.
Definition DFMSheetMetal_NonStandardSheetSizeIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non standard sheet thickness issue.
Definition DFMSheetMetal_NonStandardSheetSizeIssue.cxx:101
Describes non standard sheet thickness issue found during sheet metal design analysis.
Definition DFMSheetMetal_NonStandardSheetThicknessIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non standard sheet thickness issue.
Definition DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:106
UTF16String Name() const
Returns a name.
Definition ModelElement.cxx:55
cadex::Uuid Uuid() const
Returns an object uuid.
Definition ModelElement.cxx:76
void SetUuid(const Uuid &theUuid)
Sets an object uuid.
Definition ModelElement.cxx:67
Provides MTK data model.
Definition Model.hxx:40
void AddRoot(const ModelElement &theElement)
Adds a root element to the model.
Definition Model.cxx:213
void AddBody(const Body &theBody)
Adds a body.
Definition Part.cxx:63
Provides a sheet body composed of faces and shells.
Definition SheetBody.hxx:34
Provides an interface to run several analyzer tools.
Definition SheetMetal_Analyzer.hxx:42
SheetMetal_Data Perform(const ModelData::Solid &theSolid, const cadex::ProgressStatus &theProgressStatus=cadex::ProgressStatus())
Runs analyzing process.
Definition SheetMetal_Analyzer.cxx:145
Contains specific information for sheet metal tools.
Definition SheetMetal_Data.hxx:36
bool IsEmpty() const
Returns true if the data is empty.
Definition SheetMetal_Data.cxx:83
const SheetMetal_FlatPattern & FlatPattern() const
Definition SheetMetal_Data.cxx:77
const MTKBase_FeatureList & FeatureList() const
Definition SheetMetal_Data.cxx:68
Provides an interface to recognizing sheet metal features tool. Is used for recognition of features s...
Definition SheetMetal_FeatureRecognizer.hxx:38
Describes a flat pattern for sheet metal models.
Definition SheetMetal_FlatPattern.hxx:42
ModelData::Shell UnfoldedShell() const
Returns the unfolded shell for flat pattern.
Definition SheetMetal_FlatPattern.cxx:200
bool IsNull() const
Returns true if the flat pattern is null.
Definition SheetMetal_FlatPattern.cxx:262
Is used to unfold sheet metal models.
Definition SheetMetal_Unfolder.hxx:39

MTKConverter_Report.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
using System;
using System.Collections.Generic;
using System.IO;
using ShapeIDVectorType = System.Collections.Generic.List<uint>;
using ShapeIDVectorVectorType = System.Collections.Generic.List<System.Collections.Generic.List<uint>>;
using FeatureMapType = System.Collections.Generic.SortedDictionary<cadex.MTKBase_Feature,
System.Collections.Generic.KeyValuePair<uint, System.Collections.Generic.List<System.Collections.Generic.List<uint>>>>;
using PointPairType = System.Collections.Generic.KeyValuePair<cadex.Geom.Point, cadex.Geom.Point>;
namespace mtkconverter
{
public struct Pair
{
public Pair(double theFirst, double theSecond)
{
First = theFirst;
Second = theSecond;
}
public double First { get; }
public double Second { get; }
public override string ToString() => $"{FormattedString(First)} x {FormattedString(Second)}";
private string FormattedString(double theValue)
{
System.Globalization.CultureInfo aCI = new System.Globalization.CultureInfo("en-US");
return string.Format(aCI, "{0:0.00}", theValue);
}
}
public struct Dimension
{
public Dimension(double theL, double theW, double theD)
{
L = theL;
W = theW;
D = theD;
}
public double L { get; }
public double W { get; }
public double D { get; }
public override string ToString() => $"{FormattedString(L)} x {FormattedString(W)} x {FormattedString(D)}";
private string FormattedString(double theValue)
{
System.Globalization.CultureInfo aCI = new System.Globalization.CultureInfo("en-US");
return string.Format(aCI, "{0:0.00}", theValue);
}
}
public struct Direction
{
public Direction(double theX, double theY, double theZ)
{
X = theX;
Y = theY;
Z = theZ;
}
public double X { get; }
public double Y { get; }
public double Z { get; }
public override string ToString() => $"({FormattedString(X)}, {FormattedString(Y)}, {FormattedString(Z)})";
private string FormattedString(double theValue)
{
System.Globalization.CultureInfo aCI = new System.Globalization.CultureInfo("en-US");
return string.Format(aCI, "{0:0.00}", theValue);
}
}
public struct Point
{
public Point(double theX, double theY, double theZ)
{
X = theX;
Y = theY;
Z = theZ;
}
public double X { get; }
public double Y { get; }
public double Z { get; }
public override string ToString() => $"({FormattedString(X)}, {FormattedString(Y)}, {FormattedString(Z)})";
private string FormattedString(double theValue)
{
System.Globalization.CultureInfo aCI = new System.Globalization.CultureInfo("en-US");
return string.Format(aCI, "{0:0.00}", theValue);
}
}
class FeatureComparer : IComparer<MTKBase_Feature>
{
public int Compare(MTKBase_Feature theA, MTKBase_Feature theB)
{
bool anALessThanB = aComparator.Apply(theA, theB);
if (anALessThanB)
{
return -1;
}
bool aBLessThanA = aComparator.Apply(theB, theA);
if (aBLessThanA)
{
return 1;
}
return 0;
}
}
class JSONWriter
{
public JSONWriter(TextWriter theStream, int theStartNestingLevel = 0)
{
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 void WriteData<T>(string theParamName, T theValue)
{
System.Globalization.CultureInfo aCI = new System.Globalization.CultureInfo ("en-US");
string aValueString = theValue is double ? string.Format(aCI, "{0:0.00}", theValue) : theValue.ToString();
Stream().Write("\"" + theParamName + "\": \"" + aValueString + "\"");
}
public 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)
{
TextWriter aStream = Stream();
if (theName.Length > 0)
{
aStream.Write("\"" + theName + "\": ");
}
aStream.Write(theOpenBracketSymbol);
++myNestingLevel;
}
private void DoCloseSection(char theCloseBracketSymbol)
{
--myNestingLevel;
Stream().Write(theCloseBracketSymbol);
}
private void PrepareStream()
{
if (myNestingLevel == myPrevNestingLevel)
{
myStream.Write(",");
}
myPrevNestingLevel = myNestingLevel;
if (myIsInit)
{
myStream.WriteLine();
}
myIsInit = true;
}
private TextWriter Stream()
{
PrepareStream();
for (int i = 0; i < myNestingLevel; ++i)
{
myStream.Write(" ");
}
return myStream;
}
private TextWriter myStream;
private bool myIsInit = false;
private int myNestingLevel;
private int myPrevNestingLevel;
}
class FeatureGroupManager
{
public FeatureGroupManager()
{
myGroups = new List<FeatureGroup>();
}
private class FeatureGroup
{
public FeatureGroup(string theName, string theColor)
{
myName = theName;
myColor = theColor;
myFeatureData = new List<string>();
}
public string myName;
public string myColor;
public List<string> myFeatureData;
public uint myFeatureCount = 0;
}
private List<FeatureGroup> myGroups;
public void AddGroupData(string theGroupName, string theGroupColor, string theFeatureData, uint theFeatureNb)
{
//find or create
int aRes = myGroups.FindIndex(theGroup => theGroup.myName == theGroupName);
if (aRes == -1)
{
myGroups.Add(new FeatureGroup(theGroupName, theGroupColor));
aRes = myGroups.Count - 1;
}
//update
FeatureGroup aGroup = myGroups[aRes];
aGroup.myFeatureData.Add(theFeatureData);
aGroup.myFeatureCount += theFeatureNb;
}
public uint TotalFeatureCount()
{
uint aTotalFeatureCount = 0;
foreach (FeatureGroup aGroup in myGroups)
{
aTotalFeatureCount += aGroup.myFeatureCount;
}
return aTotalFeatureCount;
}
public void Write(JSONWriter theWriter)
{
foreach(FeatureGroup aGroup in myGroups)
{
theWriter.OpenSection();
theWriter.WriteData("name", aGroup.myName);
theWriter.WriteData("color", aGroup.myColor);
theWriter.WriteData("totalGroupFeatureCount", aGroup.myFeatureCount);
List<string> aFeatureData = aGroup.myFeatureData;
if (aFeatureData.Count !=0 )
{
bool aHasParams = aFeatureData[0].IndexOf("parameters") != -1;
if (aHasParams)
{
theWriter.WriteData("subGroupCount", aFeatureData.Count);
theWriter.OpenArraySection("subGroups");
foreach (string j in aFeatureData)
{
theWriter.WriteRawData(j);
}
theWriter.CloseArraySection();
}
else
{
foreach (string j in aFeatureData)
{
theWriter.WriteRawData(j);
}
}
}
theWriter.CloseSection();
}
}
}
class MTKConverter_Report
{
public MTKConverter_Report()
{
myData = new List<MTKConverter_ProcessData>();
}
private List<MTKConverter_ProcessData> myData;
public void AddData(MTKConverter_ProcessData theData)
{
myData.Add(theData);
}
public bool WriteToJSON(UTF16String thePath)
{
string aPath = thePath.ToString();
if (File.Exists(aPath))
{
File.Delete(aPath);
}
try
{
using (StreamWriter aStream = File.CreateText(aPath))
{
JSONWriter aWriter = new JSONWriter(aStream);
aWriter.OpenSection();
aWriter.WriteData("version", "1");
if (myData.Count == 0)
{
aWriter.WriteData("error", "The model doesn't contain any parts.");
}
else
{
aWriter.OpenArraySection("parts");
foreach (MTKConverter_ProcessData aProcessData in myData)
{
aWriter.OpenSection();
WritePartProcessData(aWriter, aProcessData);
aWriter.CloseSection();
}
aWriter.CloseArraySection();
}
aWriter.CloseSection();
}
}
catch
{
return false;
}
return true;
}
private void WriteParameter<T>(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, ShapeIDVectorVectorType theVector)
{
if (theVector.Count == 0)
{
return;
}
theWriter.WriteData("featureCount", theVector.Count);
theWriter.OpenArraySection("features");
foreach (ShapeIDVectorType aShapeIDVector in theVector) {
theWriter.OpenSection();
theWriter.WriteData("shapeIDCount", aShapeIDVector.Count);
if (aShapeIDVector.Count == 0)
{
theWriter.WriteEmptyArray("shapeIDs");
}
else
{
theWriter.OpenArraySection("shapeIDs");
foreach (uint aShapeID in aShapeIDVector)
{
theWriter.OpenSection();
theWriter.WriteData("id", aShapeID);
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
theWriter.CloseSection();
}
theWriter.CloseArraySection();
}
private string DoWriteFeatureDataToString(Action<JSONWriter> theFunc, int theParamCount, ShapeIDVectorVectorType theVector)
{
StringWriter aStream = new StringWriter();
JSONWriter aWriter = new JSONWriter(aStream, 7);
aWriter.OpenSection();
aWriter.WriteData("parametersCount", theParamCount);
aWriter.OpenArraySection("parameters");
theFunc(aWriter);
aWriter.CloseArraySection();
WriteShapeIDs(aWriter, theVector);
aWriter.CloseSection();
return aStream.ToString();
}
private string WriteFeatureDataToString(ShapeIDVectorVectorType theVector)
{
StringWriter aStream = new StringWriter();
JSONWriter aWriter = new JSONWriter(aStream, 6);
WriteShapeIDs(aWriter, theVector);
return aStream.ToString();
}
private string WriteFeatureDataToString<T>(string theParamName, string theParamUnits,
T theParamValue, ShapeIDVectorVectorType theVector)
{
Action<JSONWriter> WriteParams = theWriter => WriteParameter(theWriter, theParamName, theParamUnits, theParamValue);
return DoWriteFeatureDataToString(WriteParams, 1, theVector);
}
private string WriteFeatureDataToString<T1, T2>(string theParamName1, string theParamUnits1, T1 theParamValue1,
string theParamName2, string theParamUnits2, T2 theParamValue2, ShapeIDVectorVectorType theVector)
{
Action<JSONWriter> WriteParams = theWriter =>
{
WriteParameter(theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter(theWriter, theParamName2, theParamUnits2, theParamValue2);
};
return DoWriteFeatureDataToString(WriteParams, 2, theVector);
}
private string WriteFeatureDataToString<T1, T2, T3>(string theParamName1, string theParamUnits1, T1 theParamValue1,
string theParamName2, string theParamUnits2, T2 theParamValue2,
string theParamName3, string theParamUnits3, T3 theParamValue3, ShapeIDVectorVectorType theVector)
{
Action<JSONWriter> WriteParams = theWriter =>
{
WriteParameter(theWriter, theParamName1, theParamUnits1, theParamValue1);
WriteParameter(theWriter, theParamName2, theParamUnits2, theParamValue2);
WriteParameter(theWriter, theParamName3, theParamUnits3, theParamValue3);
};
return DoWriteFeatureDataToString(WriteParams, 3, theVector);
}
private string WriteFeatureDataToString<T1, T2, T3, T4>(string theParamName1, string theParamUnits1, T1 theParamValue1,
string theParamName2, string theParamUnits2, T2 theParamValue2,
string theParamName3, string theParamUnits3, T3 theParamValue3,
string theParamName4, string theParamUnits4, T4 theParamValue4, ShapeIDVectorVectorType theVector)
{
Action<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)
{
case Machining_FaceType.Machining_FT_FlatFaceMilled: return "Flat Face Milled Face(s)";
case Machining_FaceType.Machining_FT_FlatSideMilled: return "Flat Side Milled Face(s)";
case Machining_FaceType.Machining_FT_CurvedMilled: return "Curved Milled Face(s)";
case Machining_FaceType.Machining_FT_CircularMilled: return "Circular Milled Face(s)";
case Machining_FaceType.Machining_FT_Deburr: return "Deburr Face(s)";
case Machining_FaceType.Machining_FT_ConvexProfileEdgeMilling: return "Convex Profile Edge Milling Face(s)";
case Machining_FaceType.Machining_FT_ConcaveFilletEdgeMilling: return "Concave Fillet Edge Milling Face(s)";
case Machining_FaceType.Machining_FT_FlatMilled: return "Flat Milled Face(s)";
case Machining_FaceType.Machining_FT_TurnDiameter: return "Turn Diameter Face(s)";
case Machining_FaceType.Machining_FT_TurnForm: return "Turn Form Face(s)";
case Machining_FaceType.Machining_FT_TurnFace: return "Turn Face Face(s)";
case Machining_FaceType.Machining_FT_Bore: return "Bore Face(s)";
default:
break;
}
return "Face(s)";
}
private string MachiningFaceColor(Machining_FaceType theType)
{
switch (theType)
{
case Machining_FaceType.Machining_FT_FlatFaceMilled: return "(115, 251, 253)";
case Machining_FaceType.Machining_FT_FlatSideMilled: return "(0, 35, 245)";
case Machining_FaceType.Machining_FT_CurvedMilled: return "(22, 65, 124)";
case Machining_FaceType.Machining_FT_CircularMilled: return "(255, 254, 145)";
case Machining_FaceType.Machining_FT_Deburr: return "(0, 0, 0)";
case Machining_FaceType.Machining_FT_ConvexProfileEdgeMilling: return "(240, 155, 89)";
case Machining_FaceType.Machining_FT_ConcaveFilletEdgeMilling: return "(129, 127, 38)";
case Machining_FaceType.Machining_FT_FlatMilled: return "(115, 43, 245)";
case Machining_FaceType.Machining_FT_TurnDiameter: return "(88, 19, 94)";
case Machining_FaceType.Machining_FT_TurnForm: return "(161, 251, 142)";
case Machining_FaceType.Machining_FT_TurnFace: return "(239, 136, 190)";
case Machining_FaceType.Machining_FT_Bore: return "(127, 130, 187)";
default:
break;
}
return "(0, 0, 0)";
}
private string MachiningHoleTypeToString(Machining_HoleType theType)
{
switch (theType)
{
case Machining_HoleType.Machining_HT_Through: return "Through Hole(s)";
case Machining_HoleType.Machining_HT_FlatBottom: return "Flat Bottom Hole(s)";
case Machining_HoleType.Machining_HT_Blind: return "Blind Hole(s)";
case Machining_HoleType.Machining_HT_Partial: return "Partial Hole(s)";
default:
break;
}
return "Hole(s)";
}
private string MachiningHoleColor(Machining_HoleType theType)
{
switch (theType)
{
case Machining_HoleType.Machining_HT_Through: return "(240, 135, 132)";
case Machining_HoleType.Machining_HT_FlatBottom: return "(235, 51, 36)";
case Machining_HoleType.Machining_HT_Blind: return "(142, 64, 58)";
case Machining_HoleType.Machining_HT_Partial: return "(58, 6, 3)";
default:
break;
}
return "(0, 0, 0)";
}
private string MachiningPocketTypeToString(Machining_PocketType theType)
{
switch (theType)
{
case Machining_PocketType.Machining_PT_Closed: return "Closed Pocket(s)";
case Machining_PocketType.Machining_PT_Open: return "Open Pocket(s)";
case Machining_PocketType.Machining_PT_Through: return "Through Pocket(s)";
default:
break;
}
return "Pocket(s)";
}
private string MachiningPocketColor(Machining_PocketType theType)
{
switch (theType)
{
case Machining_PocketType.Machining_PT_Closed: return "(81, 20, 0)";
case Machining_PocketType.Machining_PT_Open: return "(189, 103, 37)";
case Machining_PocketType.Machining_PT_Through: return "(255, 217, 188)";
default:
break;
}
return "(0, 0, 0)";
}
private string HemTypeToString(SheetMetal_HemBendType theType)
{
switch (theType) {
case SheetMetal_HemBendType.SheetMetal_HBT_Flattened: return "Flattened Hem Bend(s)";
case SheetMetal_HemBendType.SheetMetal_HBT_Open: return "Open Hem Bend(s)";
case SheetMetal_HemBendType.SheetMetal_HBT_Teardrop: return "Teardrop Hem Bend(s)";
case SheetMetal_HemBendType.SheetMetal_HBT_Rope: return "Rope Hem Bend(s)";
case SheetMetal_HemBendType.SheetMetal_HBT_Rolled: return "Rolled Hem Bend(s)";
default:
break;
}
return "Hem Bend(s)";
}
private string BendName(SheetMetal_Bend theBend)
{
{
SheetMetal_HemBend aHemBend = SheetMetal_HemBend.Cast(theBend);
return HemTypeToString(aHemBend.Type());
}
{
return "Curved Bend(s)";
}
return "Bend(s)";
}
private string BendColor(SheetMetal_Bend theBend)
{
{
switch (aType) {
case SheetMetal_HemBendType.SheetMetal_HBT_Flattened: return "(22, 65, 124)";
case SheetMetal_HemBendType.SheetMetal_HBT_Open: return "(42, 85, 144)";
case SheetMetal_HemBendType.SheetMetal_HBT_Teardrop: return "(62, 105, 164)";
case SheetMetal_HemBendType.SheetMetal_HBT_Rope: return "(82, 125, 184)";
case SheetMetal_HemBendType.SheetMetal_HBT_Rolled: return "(102, 145, 204)";
default:
break;
}
return "(0, 0, 0)";
}
{
return "(255, 254, 145)";
}
return "(0, 35, 245)";
}
private string SheetMetalHoleName(SheetMetal_Hole theHole)
{
{
return "Complex Hole(s)";
}
return "Hole(s)";
}
private string SheetMetalHoleColor(SheetMetal_Hole theHole)
{
{
return "(115, 43, 245)";
}
return "(129, 127, 38)";
}
private string SmallDistanceIssueName(DFMSheetMetal_SmallDistanceBetweenFeaturesIssue theIssue)
{
{
return "Small Distance Between Bend And Louver Issue(s)";
}
{
return "Small Distance Between Extruded Hole And Bend Issue(s)";
}
{
return "Small Distance Between Extruded Hole And Edge Issue(s)";
}
{
return "Small Distance Between Extruded Holes Issue(s)";
}
{
return "Small Distance Between Hole And Bend Issue(s)";
}
{
return "Small Distance Between Hole And Cutout Issue(s)";
}
{
return "Small Distance Between Hole And Edge Issue(s)";
}
{
return "Small Distance Between Hole And Louver Issue(s)";
}
{
return "Small Distance Between Hole And Notch Issue(s)";
}
{
return "Small Distance Between Holes Issue(s)";
}
{
return "Small Distance Between Notch And Bend Issue(s)";
}
{
return "Small Distance Between Notches Issue(s)";
}
{
return "Small Distance Between Tabs Issue(s)";
}
return "Small Distance Between Feature(s)";
}
private string SmallDistanceIssueColor(DFMSheetMetal_SmallDistanceBetweenFeaturesIssue theIssue)
{
{
return "(195, 56, 19)";
}
{
return "(212, 75, 90)";
}
{
return "(198, 75, 105)";
}
{
return "(170, 65, 120)";
}
{
return "(239, 136, 190)";
}
{
return "(127, 130, 187)";
}
{
return "(240, 135, 132)";
}
{
return "(15, 5, 129)";
}
{
return "(235, 51, 36)";
}
{
return "(142, 64, 58)";
}
{
return "(58, 6, 3)";
}
{
return "(0, 215, 3)";
}
{
return "(157, 160, 207)";
}
return "(0, 0, 0)";
}
private void AddShapeFeature(FeatureGroupManager theManager, MTKBase_ShapeFeature theFeature,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
MTKBase_ShapeFeature aFeature = theFeature;
//machining
{
Machining_TurningFace aTurningFace = Machining_TurningFace.Cast(aFeature);
Machining_FaceType aType = aTurningFace.Type();
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);
Machining_FaceType aType = aFace.Type();
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);
cadex.Geom.Direction aDir = aCountersink.Axis().Axis();
string aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aCountersink.Radius(),
"Depth", "mm", aCountersink.Depth(),
"Axis", "", new 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);
cadex.Geom.Direction aDir = aHole.Axis().Axis();
Machining_HoleType aType = aHole.Type();
string aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", new 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);
cadex.Geom.Direction aDir = aPocket.Axis().Direction();
Machining_PocketType aType = aPocket.Type();
string aFeatureData = WriteFeatureDataToString(
"Length", "mm", aPocket.Length(),
"Width", "mm", aPocket.Width(),
"Depth", "mm", aPocket.Depth(),
"Axis", "", new Direction(aDir.X(), aDir.Y(), aDir.Z()),
theShapeIdVector);
theManager.AddGroupData(MachiningPocketTypeToString(aType), MachiningPocketColor(aType), aFeatureData, theCount);
}
//molding
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);
}
//sheet metal
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);
cadex.Geom.Direction aDir = aHole.Axis().Axis();
string aFeatureData = WriteFeatureDataToString(
"Radius", "mm", aHole.Radius(),
"Depth", "mm", aHole.Depth(),
"Axis", "", new 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);
{
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(FeatureGroupManager theManager, DFMMachining_DrillingIssue theIssue,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Flat Bottom Hole(s)", "(240, 155, 89)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Perpendicular Hole(s)", "(129, 127, 38)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Intersecting Cavity Hole(s)", "(115, 43, 245)", aFeatureData, theCount);
}
}
private void AddMillingIssue(FeatureGroupManager theManager, DFMMachining_MillingIssue theIssue,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
{
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);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Maximum Size (LxWxH)", "mm",
new Dimension(anExpectedSize.Length(), anExpectedSize.Width(), anExpectedSize.Height()),
"Actual Size (LxWxH)", "mm",
new Dimension(anActualSize.Length(), anActualSize.Width(), anActualSize.Height()),
theShapeIdVector);
theManager.AddGroupData("Large Milled Part(s)", "(17, 37, 205)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Milled Part External Edge Fillet(s)", "(201, 227, 13)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Radius", "mm", anInconsistentRadiusIssue.ExpectedRadius(),
"Actual Radius", "mm", anInconsistentRadiusIssue.ActualRadius(),
theShapeIdVector);
theManager.AddGroupData("Inconsistent Radius Milled Part Floor Fillet Issue(s)", "(180, 15, 190)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
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(FeatureGroupManager theManager, DFMBase_Issue theIssue,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
{
string aFeatureData = WriteFeatureDataToString(
"Expected Maximum Size (LxR)", "mm", new Pair(anExpectedSize.Length(), anExpectedSize.Radius()),
"Actual Size (LxR)", "mm", new Pair(anActualSize.Length(), anActualSize.Radius()),
theShapeIdVector);
theManager.AddGroupData("Large Turned Part(s)", "(195, 195, 195)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Square End Keyway(s)", "(157, 160, 207)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Symmetrical Axial Slot(s)", "(130, 170, 200)", aFeatureData, theCount);
}
}
private void AddMoldingIssue (FeatureGroupManager theManager, DFMBase_Issue theIssue,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Non Chamfered Screw Boss(es)", "(38, 38, 10)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
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(FeatureGroupManager theManager, DFMBase_Issue theIssue,
uint theCount, ShapeIDVectorVectorType theShapeIdVector)
{
{
string aFeatureData = WriteFeatureDataToString(theShapeIdVector);
theManager.AddGroupData("Flat Pattern Interference(s)", "(115, 251, 253)", aFeatureData, theCount);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Min Extruded Height", "mm", aIDEHIssue.ExpectedMinExtrudedHeight(),
"Expected Man Extruded Height", "mm", aIDEHIssue.ExpectedMaxExtrudedHeight(),
"Actual Extruded Height", "mm", aIDEHIssue.ActualExtrudedHeight(),
theShapeIdVector);
theManager.AddGroupData("Irregular Depth Extruded Hole(s)", "(50, 120, 210)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
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 Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"First Actual Relief Size (LxW)", "mm", new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"Second Actual Relief Size (LxW)", "mm", new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
}
else if (aFirstActualRelief.IsNull())
{
aFeatureData = WriteFeatureDataToString(
"Expected Minimum Relief Size (LxW)", "mm", new Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
theShapeIdVector);
}
else
{
aFeatureData = WriteFeatureDataToString(
"Expected Minimum Relief Size (LxW)", "mm", new Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"Actual Relief Size (LxW)", "mm", new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
theShapeIdVector);
}
theManager.AddGroupData("Irregular Size Bend Relief(s)", "(22, 65, 124)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Size (LxW)", "mm", new Pair(aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", new Pair(aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData("Irregular Size Notch(s)", "(255, 254, 145)", aFeatureData, theCount);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Size (LxW)", "mm", new Pair(aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"Actual Size (LxW)", "mm", new Pair(aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
theShapeIdVector);
theManager.AddGroupData("Irregular Size Tab(s)", "(240, 155, 89)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
DFMSheetMetal_SheetSize aNesrestStandardSize = aNSSSIssue.NearestStandardSheetSize();
DFMSheetMetal_SheetSize anActualSize = aNSSSIssue.ActualSheetSize();
string aFeatureData = WriteFeatureDataToString(
"Nearest Standard Size (LxW)", "mm", new Pair(aNesrestStandardSize.Length(), aNesrestStandardSize.Width()),
"Actual Size (LxW)", "mm", new Pair(anActualSize.Length(), anActualSize.Width()),
theShapeIdVector);
theManager.AddGroupData("Non Standard Sheet Size(s)", "(0, 0, 0)", aFeatureData, theCount);
}
{
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);
}
{
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);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Minimum Length", "mm", aSLHMFIssue.ExpectedMinLength(),
"Actual Length", "mm", aSLHMFIssue.ActualLength(),
theShapeIdVector);
theManager.AddGroupData("Small Length Hem Bend Flange(s)", "(70, 139, 51)", aFeatureData, theCount);
}
{
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);
}
{
string aFeatureData = WriteFeatureDataToString(
"Expected Minimum Distance", "mm", aSDIssue.ExpectedMinDistanceBetweenFeatures(),
"Actual Distance", "mm", aSDIssue.ActualDistanceBetweenFeatures(),
theShapeIdVector);
theManager.AddGroupData(SmallDistanceIssueName(aSDIssue), SmallDistanceIssueColor(aSDIssue), aFeatureData, theCount);
}
}
private ShapeIDVectorType GetShapesId(Shape theShape, ShapeType theType)
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
var 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, ShapeIDVectorType theShapesIdVec)
{
var aShapeIt = new ShapeIterator(theShape, theType);
while (aShapeIt.HasNext())
{
Shape aShape = aShapeIt.Next();
theShapesIdVec.Add(aShape.Id());
}
}
private void SortFeatures(MTKBase_FeatureList theFeatures, FeatureMapType theMap)
{
for (uint i = 0; i < theFeatures.Size(); i++)
{
MTKBase_Feature aFeature = theFeatures.Feature(i);
{
MTKBase_CompositeFeature aCompositeFeature = MTKBase_CompositeFeature.Cast(aFeature);
SortFeatures(aCompositeFeature.FeatureList(), theMap);
continue;
}
KeyValuePair<uint, ShapeIDVectorVectorType> anElement;
if (theMap.ContainsKey(aFeature))
{
anElement = theMap[aFeature];
}
else
{
anElement = new KeyValuePair<uint, ShapeIDVectorVectorType>(0, new ShapeIDVectorVectorType());
}
var aValue = anElement.Value;
//features
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFeature);
ShapeType aShapeType = ShapeType.Face;
{
aShapeType = ShapeType.Edge;
}
ShapeIDVectorType aShapeIdVector = GetShapesId(aShapeFeature.Shape(), aShapeType);
aValue.Add(aShapeIdVector);
}
//dfm machining drilling
{
ShapeIDVectorType aShapeIdVector = GetShapesId(anIssue.Hole().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
//dfm machining milling
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aNSRMPFFIssue.FloorFillet(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aDCIssue.Pocket().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aHBIssue.Boss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aMSICRIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
DFMMachining_NonPerpendicularMilledPartShapeIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = GetShapesId (aNPMPSIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aMPEEFIssue.Fillet(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIRMPFFIssue.FloorFillet(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aNRIPIssue.InnerFeature(), ShapeType.Face, aShapeIdVector);
AddShapesId(aNRIPIssue.NarrowRegionSidewall(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aLDRSIPIssue.InnerFeature(), ShapeType.Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MinRegionPocketSidewall(), ShapeType.Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MaxRegionPocketSidewall(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector = GetShapesId(aSWTIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
//dfm machining turning
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aBBHRIssue.BlindBoredHole(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISBHIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aODPRIssue.Face(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aTSICRIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSEKIssue.Keyway().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aNSASIssue.AxialSlot().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
aValue.Add(new ShapeIDVectorType());
}
//dfm molding
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aHRIssue.Rib().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aHSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICDSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICDSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aITRIssue.Rib().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIWTSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSBRRIssue.Rib().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSBRSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSMDARIssue.Rib().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId (aSDBRIssue.FirstRib().Shape(), ShapeType.Face, aShapeIdVector);
AddShapesId (aSDBRIssue.SecondRib().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSHBRSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aWTCSBIssue.ScrewBoss().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
DFMMolding_IrregularWallThicknessIssue aIWTIssue = DFMMolding_IrregularWallThicknessIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = GetShapesId(aIWTIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
DFMMolding_LargeWallThicknessIssue aLWTIssue = DFMMolding_LargeWallThicknessIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = GetShapesId(aLWTIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
DFMMolding_SmallWallThicknessIssue aSWTIssue = DFMMolding_SmallWallThicknessIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = GetShapesId(aSWTIssue.Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
DFMMolding_SmallDistanceBetweenBossesIssue aSDBBIssue = DFMMolding_SmallDistanceBetweenBossesIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDBBIssue.FirstBoss().Shape(), ShapeType.Face, aShapeIdVector);
AddShapesId(aSDBBIssue.SecondBoss().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
//dfm sheet metal
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType { aFPIIssue.FirstFace().Id(),
aFPIIssue.SecondFace().Id() };
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICFRNIssue.Notch().Shape(), ShapeType.Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICFRNIssue.Bend().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIDEHIssue.Hole().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIRBIssue.Bend().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
SheetMetal_BendRelief aFirstActualRelief = aISBRIssue.FirstActualRelief();
SheetMetal_BendRelief aSecondActualRelief = aISBRIssue.SecondActualRelief();
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
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);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISNIssue.Notch().Shape(), ShapeType.Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISTIssue.Tab().Shape(), ShapeType.Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aLDBIssue.Bead().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSDLIssue.Louver().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
aValue.Add(new ShapeIDVectorType());
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSDHIssue.Hole().Shape(), ShapeType.Edge);
aValue.Add(aShapeIdVector);
}
{
MTKBase_FeatureList aFlange = aSLFIssue.Flange().FeatureList();
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
for (uint j = 0; j < aFlange.Size(); j++)
{
MTKBase_Feature aFlangeFace = aFlange.Feature(j);
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFlangeFace);
AddShapesId(aShapeFeature.Shape(), ShapeType.Face, aShapeIdVector);
}
}
aValue.Add(aShapeIdVector);
}
{
MTKBase_FeatureList aFlange = aSLHBFIssue.Flange().FeatureList();
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
for (uint j = 0; j < aFlange.Size(); j++)
{
MTKBase_Feature aFlangeFace = aFlange.Feature(j);
{
MTKBase_ShapeFeature aShapeFeature = MTKBase_ShapeFeature.Cast(aFlangeFace);
AddShapesId(aShapeFeature.Shape(), ShapeType.Face, aShapeIdVector);
}
}
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSRBIssue.Bend().Shape(), ShapeType.Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Bend().Shape(), ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Face, aShapeIdVector);
aShapeIdVector.Add(aSDIssue.Edge().Id());
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstHole().Shape(), ShapeType.Face, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Cutout().Shape(), ShapeType.Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Edge, aShapeIdVector);
aShapeIdVector.Add(aSDIssue.Edge().Id());
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Notch().Shape(), ShapeType.Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstHole().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(), ShapeType.Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Notch().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), ShapeType.Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstNotch().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondNotch().Shape(), ShapeType.Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstTab().Shape(), ShapeType.Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondTab().Shape(), ShapeType.Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
anElement = new KeyValuePair<uint, ShapeIDVectorVectorType>(anElement.Key + 1, aValue);
theMap[aFeature] = anElement;
}
}
private bool 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
{
FeatureMapType aSortedFeatures = new FeatureMapType(new FeatureComparer());
SortFeatures(theFeatures, aSortedFeatures);
FeatureGroupManager aFGManager = new FeatureGroupManager();
foreach (var i in aSortedFeatures) {
MTKBase_Feature aFeature = i.Key;
uint aCount = i.Value.Key;
ShapeIDVectorVectorType aShapeIDVec = i.Value.Value;
{
AddShapeFeature(aFGManager, MTKBase_ShapeFeature.Cast(aFeature), aCount, aShapeIDVec);
}
{
AddDrillingIssue(aFGManager, DFMMachining_DrillingIssue.Cast(aFeature), aCount, aShapeIDVec);
}
{
AddMillingIssue(aFGManager, DFMMachining_MillingIssue.Cast(aFeature), aCount, aShapeIDVec);
}
{
AddSheetMetalIssue(aFGManager, DFMBase_Issue.Cast(aFeature), aCount, aShapeIDVec);
}
{
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)
{
case Machining_OperationType.Machining_OT_Milling: return "CNC Machining Milling";
case Machining_OperationType.Machining_OT_LatheMilling: return "CNC Machining Lathe+Milling";
default:
break;
}
return "CNC Machining";
}
private bool HasShapes(cadex.Collections.BodyList theBodies, ShapeType theType)
{
for (int i = 0, n = theBodies.Count; i < n; ++i)
{
Body aBody = theBodies[i];
var aShapeIt = new ShapeIterator(aBody, theType);
if (aShapeIt.HasNext())
{
return true;
}
}
return false;
}
private void WriteThicknessNode(JSONWriter theWriter, string theParamName, double theParamValue,
PointPairType thePoints, string theNodeName)
{
cadex.Geom.Point aFirstPoint = thePoints.Key;
cadex.Geom.Point aSecondPoint = thePoints.Value;
theWriter.OpenSection(theNodeName);
theWriter.WriteData("name", theParamName);
theWriter.WriteData("units", "mm");
theWriter.WriteData("value", theParamValue);
theWriter.WriteData("firstPoint", new Point (aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z()));
theWriter.WriteData("secondPoint", new 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 aStream = new StringWriter();
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(aStream.ToString());
}
else
{
theWriter.WriteData("message", "Unfolded part wasn't generated.");
}
theWriter.CloseSection();
}
private void WritePartProcessData(JSONWriter theWriter, MTKConverter_ProcessData theProcessData)
{
bool aRes = false;
theWriter.WriteData("partId", theProcessData.myPart.Uuid());
string anErrorMsg = "An error occurred while processing the part.";
if (theProcessData is MTKConverter_MachiningData)
{
MTKConverter_MachiningData aMD = (MTKConverter_MachiningData)theProcessData;
theWriter.WriteData("process", MachiningProcessName(aMD.myOperation));
cadex.Collections.BodyList aBodies = aMD.myPart.Bodies();
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(aBodies, ShapeType.Solid))
{
anErrorMsg = "The part can't be analyzed due to lack of: BRep representation or solids in BRep representation.";
}
}
else if (theProcessData is MTKConverter_MoldingData)
{
MTKConverter_MoldingData aMoldingData = (MTKConverter_MoldingData)theProcessData;
theWriter.WriteData("process", "Molding Analysis");
cadex.Collections.BodyList aBodies = aMoldingData.myPart.Bodies();
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(aBodies, 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 is MTKConverter_SheetMetalData)
{
MTKConverter_SheetMetalData aSMD = (MTKConverter_SheetMetalData)theProcessData;
theWriter.WriteData("process", "Sheet Metal");
cadex.Collections.BodyList aBodies = aSMD.myPart.Bodies();
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(aBodies, ShapeType.Solid) && !HasShapes(aBodies, 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 is MTKConverter_WallThicknessData)
{
MTKConverter_WallThicknessData aWTD = (MTKConverter_WallThicknessData)theProcessData;
theWriter.WriteData("process", "Wall Thickness Analysis");
cadex.Collections.BodyList aBodies = aWTD.myPart.Bodies();
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(aBodies, 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);
}
}
}
}
size_t Id() const
Return unique identifier of public object.
Definition BaseObject.cxx:46
const MTKBase_Hole & Hole() const
Definition DFMBase_HoleIssue.cxx:50
Describes a base class for issues found during design for manufacturing (DFM) analysis.
Definition DFMBase_Issue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm issue.
Definition DFMBase_Issue.cxx:36
Describes deep bored hole issue found during cnc machining turning design analysis.
Definition DFMMachining_DeepBoredHoleIssue.hxx:33
double ActualDiameter() const
Definition DFMMachining_DeepBoredHoleIssue.cxx:130
const ModelData::Shell & Shape() const
Definition DFMMachining_DeepBoredHoleIssue.cxx:150
double ActualDepth() const
Definition DFMMachining_DeepBoredHoleIssue.cxx:110
double ExpectedMaxDepth() const
Definition DFMMachining_DeepBoredHoleIssue.cxx:100
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm deep bored hole issue.
Definition DFMMachining_DeepBoredHoleIssue.cxx:165
Describes deep hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_DeepHoleIssue.hxx:29
double ExpectedMaxDepth() const
Definition DFMMachining_DeepHoleIssue.cxx:111
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining deep hole issue.
Definition DFMMachining_DeepHoleIssue.cxx:126
double ActualDepth() const
Definition DFMMachining_DeepHoleIssue.cxx:120
double ExpectedMaxDepth() const
Definition DFMMachining_DeepPocketIssue.cxx:100
const Machining_Pocket & Pocket() const
Definition DFMMachining_DeepPocketIssue.cxx:127
double ActualDepth() const
Definition DFMMachining_DeepPocketIssue.cxx:109
Describes a base class for drilling issues found during cnc machining drilling design analysis.
Definition DFMMachining_DrillingIssue.hxx:36
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining drilling issue.
Definition DFMMachining_DrillingIssue.cxx:65
Describes flat bottom hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_FlatBottomHoleIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining flat bottom hole issue.
Definition DFMMachining_FlatBottomHoleIssue.cxx:66
Describes high boss issues found during cnc machining milling design analysis.
Definition DFMMachining_HighBossIssue.hxx:30
double ActualHeight() const
Definition DFMMachining_HighBossIssue.cxx:116
double ExpectedMaxHeight() const
Definition DFMMachining_HighBossIssue.cxx:104
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theIssue is a dfm high boss issue.
Definition DFMMachining_HighBossIssue.cxx:143
const MTKBase_Boss & Boss() const
Definition DFMMachining_HighBossIssue.cxx:128
Describes inconsistent radius milled part floor fillet issue found during cnc machining milling desig...
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.hxx:33
const ModelData::Shell & FloorFillet() const
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:99
double ActualRadius() const
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:79
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining inconsistent radius milled part floor fillet issue.
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:114
double ExpectedRadius() const
Definition DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:59
Describes intersecting cavity hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_IntersectingCavityHoleIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining intersecting cavity hole issue.
Definition DFMMachining_IntersectingCavityHoleIssue.cxx:68
Describes irregular outer diameter profile relief found during cnc machining turning design analysis.
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.hxx:33
double ExpectedMaxFaceInclineAngle() const
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:68
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm irregular outer diameter profile relief issue.
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:124
const ModelData::Face & Face() const
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:109
double ActualFaceInclineAngle() const
Definition DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:89
Described the Narrow Pocket maximum to minimum sizes ratio issue found during cnc machining milling d...
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.hxx:35
const ModelData::Shell & MinRegionPocketSidewall() const
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:191
const ModelData::Shell & MaxRegionPocketSidewall() const
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:173
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm large difference regions size in pocket issue.
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:206
const ModelData::Shell & InnerFeature() const
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:155
double ActualMaxRegionsMaxToMinSizeRatio() const
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:126
double ExpectedMaxRegionsMaxToMinSizeRatio() const
Definition DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:66
Describes large milled part issue found during cnc machining milling design analysis.
Definition DFMMachining_LargeMilledPartIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining large milled part issue.
Definition DFMMachining_LargeMilledPartIssue.cxx:105
const DFMMachining_MilledPartSize & ExpectedMaxMilledPartSize() const
Definition DFMMachining_LargeMilledPartIssue.cxx:72
const DFMMachining_MilledPartSize & ActualMilledPartSize() const
Definition DFMMachining_LargeMilledPartIssue.cxx:90
Describes large turned part issue found during cnc machining turning design analysis.
Definition DFMMachining_LargeTurnedPartIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining large turned part issue.
Definition DFMMachining_LargeTurnedPartIssue.cxx:104
const DFMMachining_TurnedPartSize & ExpectedMaxTurnedPartSize() const
Definition DFMMachining_LargeTurnedPartIssue.cxx:71
const DFMMachining_TurnedPartSize & ActualTurnedPartSize() const
Definition DFMMachining_LargeTurnedPartIssue.cxx:89
Describes long-slender turned part issue found during cnc machining turning design analysis.
Definition DFMMachining_LongSlenderTurnedPartIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining long-slender turned part issue.
Definition DFMMachining_LongSlenderTurnedPartIssue.cxx:146
double ActualLength() const
Definition DFMMachining_LongSlenderTurnedPartIssue.cxx:109
double ExpectedMaxLength() const
Definition DFMMachining_LongSlenderTurnedPartIssue.cxx:100
double ActualMinDiameter() const
Definition DFMMachining_LongSlenderTurnedPartIssue.cxx:129
Describes external edge fillet issue found during cnc machining milling design analysis.
Definition DFMMachining_MilledPartExternalEdgeFilletIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm milled part external edge fillet issue.
Definition DFMMachining_MilledPartExternalEdgeFilletIssue.cxx:74
const ModelData::Shell & Fillet() const
Definition DFMMachining_MilledPartExternalEdgeFilletIssue.cxx:59
Describes milled part size used in cnc machining milling design analysis.
Definition DFMMachining_MilledPartSize.hxx:34
double Width() const
Definition DFMMachining_MilledPartSize.cxx:59
double Length() const
Definition DFMMachining_MilledPartSize.cxx:79
double Height() const
Definition DFMMachining_MilledPartSize.cxx:99
Describes a base class for milling issues found during cnc machining milling design analysis.
Definition DFMMachining_MillingIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theIssue is a dfm machining milling issue.
Definition DFMMachining_MillingIssue.cxx:37
Described the Narrow Pocket minimum size issue found during DFM analysis for Machining Milling operat...
Definition DFMMachining_NarrowRegionInPocketIssue.hxx:33
const ModelData::Shell & InnerFeature() const
Definition DFMMachining_NarrowRegionInPocketIssue.cxx:124
double ActualRegionSize() const
Definition DFMMachining_NarrowRegionInPocketIssue.cxx:86
double ExpectedMinRegionSize() const
Definition DFMMachining_NarrowRegionInPocketIssue.cxx:66
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm narrow regions distance issue.
Definition DFMMachining_NarrowRegionInPocketIssue.cxx:157
const ModelData::Shell & NarrowRegionSidewall() const
Definition DFMMachining_NarrowRegionInPocketIssue.cxx:142
Describes non perpendicular hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_NonPerpendicularHoleIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non perpendicular hole issue.
Definition DFMMachining_NonPerpendicularHoleIssue.cxx:64
Describes non perpendicular milled part shape issue found during cnc machining milling design analysi...
Definition DFMMachining_NonPerpendicularMilledPartShapeIssue.hxx:33
const ModelData::Shell & Shape() const
Definition DFMMachining_NonPerpendicularMilledPartShapeIssue.cxx:78
double ActualAngle() const
Definition DFMMachining_NonPerpendicularMilledPartShapeIssue.cxx:58
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non perpendicular milled part shape issue.
Definition DFMMachining_NonPerpendicularMilledPartShapeIssue.cxx:93
Describes non standard diameter hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_NonStandardDiameterHoleIssue.hxx:29
double NearestStandardDiameter() const
Definition DFMMachining_NonStandardDiameterHoleIssue.cxx:71
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non standard diameter hole issue.
Definition DFMMachining_NonStandardDiameterHoleIssue.cxx:97
double ActualDiameter() const
Definition DFMMachining_NonStandardDiameterHoleIssue.cxx:91
Describes non standard drill point angle blind hole issues found during cnc machining drilling design...
Definition DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.hxx:29
double NearestStandardAngle() const
Definition DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.cxx:69
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non standard drill point angle blind hole issue.
Definition DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.cxx:107
double ActualAngle() const
Definition DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.cxx:90
Describes non standard radius milled part floor fillet issue found during cnc machining milling desig...
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.hxx:33
const ModelData::Shell & FloorFillet() const
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:98
double NearestStandardRadius() const
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:58
double ActualRadius() const
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:78
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non standard radius milled part floor fillet issue.
Definition DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:113
Describes asymmetric axial slot issue found during cnc machining turning design analysis.
Definition DFMMachining_NonSymmetricalAxialSlotIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non-symmetrical axial slot issue.
Definition DFMMachining_NonSymmetricalAxialSlotIssue.cxx:83
const Machining_Pocket & AxialSlot() const
Definition DFMMachining_NonSymmetricalAxialSlotIssue.cxx:68
Describes partial hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_PartialHoleIssue.hxx:28
double ActualMaterialPercent() const
Definition DFMMachining_PartialHoleIssue.cxx:98
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining partial hole issue.
Definition DFMMachining_PartialHoleIssue.cxx:115
double ExpectedMinMaterialPercent() const
Definition DFMMachining_PartialHoleIssue.cxx:78
Describes small depth blind bored hole relief found during cnc machining turning design analysis.
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.hxx:32
double ActualDiameter() const
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:134
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm small depth blind bored hole relief issue.
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:169
double ExpectedMinReliefDepth() const
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:104
double ActualReliefDepth() const
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:114
const ModelData::Shell & BlindBoredHole() const
Definition DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:154
Describes small diameter hole issues found during cnc machining drilling design analysis.
Definition DFMMachining_SmallDiameterHoleIssue.hxx:29
double ActualDiameter() const
Definition DFMMachining_SmallDiameterHoleIssue.cxx:99
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining small diameter hole issue.
Definition DFMMachining_SmallDiameterHoleIssue.cxx:105
double ExpectedMinDiameter() const
Definition DFMMachining_SmallDiameterHoleIssue.cxx:79
Describes internal corner radius issues found during cnc machining milling design analysis.
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.hxx:33
double ExpectedMinRadius() const
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:102
const ModelData::Shell & Shape() const
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:154
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theIssue is a dfm small radius milled part internal corner issue.
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:169
double ActualRadius() const
Definition DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:112
Describes internal corner radius issues found during cnc machining turning design analysis.
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.hxx:33
double ActualRadius() const
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:88
double ExpectedMinRadius() const
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:68
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm small radius turned part internal corner issue.
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:125
const ModelData::Shell & Shape() const
Definition DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:110
Describes wall with small thickness issues found during cnc machining milling design analysis.
Definition DFMMachining_SmallWallThicknessIssue.hxx:33
double ActualThickness() const
Definition DFMMachining_SmallWallThicknessIssue.cxx:85
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining small wall thickness issue.
Definition DFMMachining_SmallWallThicknessIssue.cxx:121
double ExpectedMinThickness() const
Definition DFMMachining_SmallWallThicknessIssue.cxx:65
ModelData::Shell Shape() const
Definition DFMMachining_SmallWallThicknessIssue.cxx:103
Describes square form keyway issue found during cnc machining turning design analysis.
Definition DFMMachining_SquareEndKeywayIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm square-end keyway issue.
Definition DFMMachining_SquareEndKeywayIssue.cxx:85
const Machining_Pocket & Keyway() const
Definition DFMMachining_SquareEndKeywayIssue.cxx:70
Describes turned part size used in cnc machining turning design analysis.
Definition DFMMachining_TurnedPartSize.hxx:33
double Radius() const
Definition DFMMachining_TurnedPartSize.cxx:61
double Length() const
Definition DFMMachining_TurnedPartSize.cxx:81
Describes large height rib issues found during injection molding design analysis.
Definition DFMMolding_HighRibIssue.hxx:28
double ExpectedMaxHeight() const
Definition DFMMolding_HighRibIssue.cxx:97
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding high rib issue.
Definition DFMMolding_HighRibIssue.cxx:112
double ActualHeight() const
Definition DFMMolding_HighRibIssue.cxx:106
Describes high screw boss issues found during injection molding design analysis.
Definition DFMMolding_HighScrewBossIssue.hxx:34
double ActualHeight() const
Definition DFMMolding_HighScrewBossIssue.cxx:107
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding boss outer diameter issue.
Definition DFMMolding_HighScrewBossIssue.cxx:113
double ExpectedMaxHeight() const
Definition DFMMolding_HighScrewBossIssue.cxx:98
Describes irregular core depth screw boss issues found during injection molding design analysis.
Definition DFMMolding_IrregularCoreDepthScrewBossIssue.hxx:34
double ActualCoreDepth() const
Definition DFMMolding_IrregularCoreDepthScrewBossIssue.cxx:88
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding boss core depth issue.
Definition DFMMolding_IrregularCoreDepthScrewBossIssue.cxx:94
double ActualHeight() const
Definition DFMMolding_IrregularCoreDepthScrewBossIssue.cxx:79
Describes irregular screw boss core diameter issues found during injection molding design analysis.
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding irregular core diameter screw boss issue.
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.cxx:144
double ExpectedMinCoreDiameter() const
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.cxx:120
double ExpectedMaxCoreDiameter() const
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.cxx:129
double ActualCoreDiameter() const
Definition DFMMolding_IrregularCoreDiameterScrewBossIssue.cxx:138
Describes irregular thickness rib issues found during injection molding design analysis.
Definition DFMMolding_IrregularThicknessRibIssue.hxx:28
double ExpectedMaxThickness() const
Definition DFMMolding_IrregularThicknessRibIssue.cxx:141
double ExpectedMinThickness() const
Definition DFMMolding_IrregularThicknessRibIssue.cxx:121
double ActualThickness() const
Definition DFMMolding_IrregularThicknessRibIssue.cxx:161
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding irregular thickness rib issue.
Definition DFMMolding_IrregularThicknessRibIssue.cxx:167
Describes wall with irregular thickness issues found during molding design analysis.
Definition DFMMolding_IrregularWallThicknessIssue.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding irregular wall thickness issue.
Definition DFMMolding_IrregularWallThicknessIssue.cxx:147
double ExpectedMaxThickness() const
Definition DFMMolding_IrregularWallThicknessIssue.cxx:110
double ExpectedMinThickness() const
Definition DFMMolding_IrregularWallThicknessIssue.cxx:130
Describes irregular wall thickness screw boss issues found during injection molding design analysis.
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding irregular wall thickness issue.
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.cxx:168
double ExpectedMaxThickness() const
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.cxx:122
double ExpectedMinThickness() const
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.cxx:142
double ActualThickness() const
Definition DFMMolding_IrregularWallThicknessScrewBossIssue.cxx:162
Describes wall with large thickness issues found during molding design analysis.
Definition DFMMolding_LargeWallThicknessIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding large wall thickness issue.
Definition DFMMolding_LargeWallThicknessIssue.cxx:96
double ExpectedMaxThickness() const
Definition DFMMolding_LargeWallThicknessIssue.cxx:79
Describes screw boss without top chamfer issues found during injection molding design analysis.
Definition DFMMolding_NonChamferedScrewBossIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding non chamfered screw boss issue.
Definition DFMMolding_NonChamferedScrewBossIssue.cxx:63
const Molding_Rib & Rib() const
Definition DFMMolding_RibIssue.cxx:52
const Molding_ScrewBoss & ScrewBoss() const
Definition DFMMolding_ScrewBossIssue.cxx:51
Describes small rib base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallBaseRadiusRibIssue.hxx:28
double ExpectedMinBaseRadius() const
Definition DFMMolding_SmallBaseRadiusRibIssue.cxx:99
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small base radius rib issue.
Definition DFMMolding_SmallBaseRadiusRibIssue.cxx:136
double ActualBaseRadius() const
Definition DFMMolding_SmallBaseRadiusRibIssue.cxx:119
Describes small screw boss base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallBaseRadiusScrewBossIssue.hxx:28
double ActualBaseRadius() const
Definition DFMMolding_SmallBaseRadiusScrewBossIssue.cxx:119
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small base radius screw boss issue.
Definition DFMMolding_SmallBaseRadiusScrewBossIssue.cxx:136
double ExpectedMinBaseRadius() const
Definition DFMMolding_SmallBaseRadiusScrewBossIssue.cxx:99
Describes a base class for small distance between bosses issues found during molding design analysis.
Definition DFMMolding_SmallDistanceBetweenBossesIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm molding small distance between bosses issue.
Definition DFMMolding_SmallDistanceBetweenBossesIssue.cxx:174
double ExpectedMinDistanceBetweenBosses() const
Definition DFMMolding_SmallDistanceBetweenBossesIssue.cxx:100
const MTKBase_Boss & SecondBoss() const
Definition DFMMolding_SmallDistanceBetweenBossesIssue.cxx:159
double ActualDistanceBetweenBosses() const
Definition DFMMolding_SmallDistanceBetweenBossesIssue.cxx:121
const MTKBase_Boss & FirstBoss() const
Definition DFMMolding_SmallDistanceBetweenBossesIssue.cxx:141
Describes a class for small distance between ribs issues found during molding design analysis.
Definition DFMMolding_SmallDistanceBetweenRibsIssue.hxx:30
double ActualDistanceBetweenRibs() const
Definition DFMMolding_SmallDistanceBetweenRibsIssue.cxx:120
double ExpectedMinDistanceBetweenRibs() const
Definition DFMMolding_SmallDistanceBetweenRibsIssue.cxx:100
const Molding_Rib & SecondRib() const
Definition DFMMolding_SmallDistanceBetweenRibsIssue.cxx:161
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small distance between ribs issue.
Definition DFMMolding_SmallDistanceBetweenRibsIssue.cxx:167
const Molding_Rib & FirstRib() const
Definition DFMMolding_SmallDistanceBetweenRibsIssue.cxx:152
Describes small draft angle rib issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleRibIssue.hxx:28
double ExpectedMinDraftAngle() const
Definition DFMMolding_SmallDraftAngleRibIssue.cxx:77
double ActualDraftAngle() const
Definition DFMMolding_SmallDraftAngleRibIssue.cxx:97
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small draft angle rib issue.
Definition DFMMolding_SmallDraftAngleRibIssue.cxx:103
Describes small screw boss draft angle issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleScrewBossIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small draft angle screw boss issue.
Definition DFMMolding_SmallDraftAngleScrewBossIssue.cxx:102
double ExpectedMinDraftAngle() const
Definition DFMMolding_SmallDraftAngleScrewBossIssue.cxx:76
double ActualDraftAngle() const
Definition DFMMolding_SmallDraftAngleScrewBossIssue.cxx:96
Describes small wall draft angle issues found during injection molding design analysis.
Definition DFMMolding_SmallDraftAngleWallIssue.hxx:30
double ExpectedMinDraftAngle() const
Definition DFMMolding_SmallDraftAngleWallIssue.cxx:75
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small draft angle wall issue.
Definition DFMMolding_SmallDraftAngleWallIssue.cxx:131
double ActualDraftAngle() const
Definition DFMMolding_SmallDraftAngleWallIssue.cxx:93
Describes small screw boss hole base radius issues found during injection molding design analysis.
Definition DFMMolding_SmallHoleBaseRadiusScrewBossIssue.hxx:28
double ActualHoleBaseRadius() const
Definition DFMMolding_SmallHoleBaseRadiusScrewBossIssue.cxx:118
double ExpectedMinHoleBaseRadius() const
Definition DFMMolding_SmallHoleBaseRadiusScrewBossIssue.cxx:98
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small hole base radius screw boss issue.
Definition DFMMolding_SmallHoleBaseRadiusScrewBossIssue.cxx:135
Describes wall with small thickness issues found during molding design analysis.
Definition DFMMolding_SmallWallThicknessIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm molding small wall thickness issue.
Definition DFMMolding_SmallWallThicknessIssue.cxx:96
double ExpectedMinThickness() const
Definition DFMMolding_SmallWallThicknessIssue.cxx:79
Describes a base class for bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_BendIssue.hxx:34
const SheetMetal_Bend & Bend() const
Definition DFMSheetMetal_BendIssue.cxx:53
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal bend issue.
Definition DFMSheetMetal_BendIssue.cxx:88
const ModelData::Face & SecondFace() const
Definition DFMSheetMetal_FlatPatternInterferenceIssue.cxx:90
const ModelData::Face & FirstFace() const
Definition DFMSheetMetal_FlatPatternInterferenceIssue.cxx:72
Describes a base class for hole issues found during sheet metal design analysis.
Definition DFMSheetMetal_HoleIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal hole issue.
Definition DFMSheetMetal_HoleIssue.cxx:78
Describes inconsistent radius bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_InconsistentRadiusBendIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal inconsistent radius bend issue.
Definition DFMSheetMetal_InconsistentRadiusBendIssue.cxx:98
double ActualRadius() const
Returns the actual bend radius in mm .
Definition DFMSheetMetal_InconsistentRadiusBendIssue.cxx:92
double ExpectedRadius() const
Definition DFMSheetMetal_InconsistentRadiusBendIssue.cxx:75
Describes irregular notch corner fillet radius issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.hxx:31
const SheetMetal_StraightNotch & Notch() const
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.cxx:78
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal irregular corner fillet radius notch issue.
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.cxx:164
double ExpectedCornerFilletRadius() const
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.cxx:129
double ActualCornerFilletRadius() const
Definition DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.cxx:138
Describes irregular depth extruded hole issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.hxx:30
double ActualExtrudedHeight() const
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:171
double ExpectedMinExtrudedHeight() const
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:142
double ExpectedMaxExtrudedHeight() const
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:162
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a irregular depth extruded hole issue.
Definition DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:177
Describes irregular open hem bend radius issue found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularRadiusOpenHemBendIssue.hxx:30
double ExpectedRadius() const
Definition DFMSheetMetal_IrregularRadiusOpenHemBendIssue.cxx:107
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal irregular open hem bend radius issue.
Definition DFMSheetMetal_IrregularRadiusOpenHemBendIssue.cxx:122
double ActualRadius() const
Definition DFMSheetMetal_IrregularRadiusOpenHemBendIssue.cxx:116
Describes irregular size bend relief issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal irregular size bend relief issue.
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:154
SheetMetal_BendRelief SecondActualRelief() const
Returns the second relief of the bend if the bend relief issue was detected. Otherwise returns empty ...
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:143
SheetMetal_BendRelief ExpectedMinBendRelief() const
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:123
SheetMetal_BendRelief FirstActualRelief() const
Returns the first relief of the bend if the bend relief issue was detected. Otherwise returns empty b...
Definition DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:132
Describes irregular size notch issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeNotchIssue.hxx:31
double ActualLength() const
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:187
double ExpectedLength() const
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:149
double ExpectedWidth() const
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:130
const SheetMetal_Notch & Notch() const
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:82
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal irregular size notch issue.
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:193
double ActualWidth() const
Definition DFMSheetMetal_IrregularSizeNotchIssue.cxx:178
Describes irregular size tab issues found during sheet metal design analysis.
Definition DFMSheetMetal_IrregularSizeTabIssue.hxx:31
const SheetMetal_Tab & Tab() const
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:82
double ExpectedWidth() const
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:130
double ExpectedLength() const
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:149
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal irregular size tab issue.
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:193
double ActualLength() const
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:187
double ActualWidth() const
Definition DFMSheetMetal_IrregularSizeTabIssue.cxx:178
Describes large depth bead issue found during sheet metal design analysis.
Definition DFMSheetMetal_LargeDepthBeadIssue.hxx:30
const SheetMetal_Bead & Bead() const
Definition DFMSheetMetal_LargeDepthBeadIssue.cxx:78
double ExpectedMaxDepth() const
Definition DFMSheetMetal_LargeDepthBeadIssue.cxx:127
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a large depth bead issue.
Definition DFMSheetMetal_LargeDepthBeadIssue.cxx:162
double ActualDepth() const
Definition DFMSheetMetal_LargeDepthBeadIssue.cxx:136
const DFMSheetMetal_SheetSize & ActualSheetSize() const
Definition DFMSheetMetal_NonStandardSheetSizeIssue.cxx:86
const DFMSheetMetal_SheetSize & NearestStandardSheetSize() const
Definition DFMSheetMetal_NonStandardSheetSizeIssue.cxx:68
double NearestStandardSheetThickness() const
Definition DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:69
double ActualSheetThickness() const
Definition DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:89
Describes sheet size of flat pattern used in DFM analysis.
Definition DFMSheetMetal_SheetSize.hxx:33
double Width() const
Definition DFMSheetMetal_SheetSize.cxx:56
double Length() const
Definition DFMSheetMetal_SheetSize.cxx:76
Describes small depth louver issue found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDepthLouverIssue.hxx:30
double ExpectedMinDepth() const
Definition DFMSheetMetal_SmallDepthLouverIssue.cxx:127
double ActualDepth() const
Definition DFMSheetMetal_SmallDepthLouverIssue.cxx:136
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small depth louver issue.
Definition DFMSheetMetal_SmallDepthLouverIssue.cxx:162
const SheetMetal_Louver & Louver() const
Definition DFMSheetMetal_SmallDepthLouverIssue.cxx:78
Describes small diameter hole issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDiameterHoleIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal small hole issue.
Definition DFMSheetMetal_SmallDiameterHoleIssue.cxx:127
double ExpectedMinDiameter() const
Definition DFMSheetMetal_SmallDiameterHoleIssue.cxx:112
double ActualDiameter() const
Definition DFMSheetMetal_SmallDiameterHoleIssue.cxx:121
Describes small distance between bend and louver issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.hxx:31
SheetMetal_Bend Bend() const
Definition DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:87
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between bend and louver issue.
Definition DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:128
SheetMetal_Louver Louver() const
Definition DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:109
Describes small distance between complex hole and bend issues found during sheet metal design analysi...
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between extruded hole and bend issue.
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.cxx:129
SheetMetal_ComplexHole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.cxx:88
SheetMetal_Bend Bend() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.cxx:110
Describes small distance detween extruded hole and edge issues found during sheet metal design analys...
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.hxx:34
ModelData::Edge Edge() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.cxx:113
SheetMetal_ComplexHole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.cxx:91
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between extruded hole and edge issue.
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.cxx:136
Describes small distance between extruded holes issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.hxx:30
SheetMetal_ComplexHole SecondHole() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:111
SheetMetal_ComplexHole FirstHole() const
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:89
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between extruded holes issue.
Definition DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:130
Describes a base class for small distance issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal small distance issue.
Definition DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:188
double ExpectedMinDistanceBetweenFeatures() const
Definition DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:105
double ActualDistanceBetweenFeatures() const
Definition DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:115
Describes small distance between hole and bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and bend issue.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:129
SheetMetal_Bend Bend() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:110
SheetMetal_Hole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:88
Describes small distance between hole and cutout issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.hxx:31
SheetMetal_Cutout Cutout() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:110
SheetMetal_Hole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:88
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and cutout issue.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:129
Describes small distance detween hole and edge issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and edge issue.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.cxx:137
SheetMetal_Hole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.cxx:92
ModelData::Edge Edge() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.cxx:114
Describes small distance between hole and louver issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.hxx:31
SheetMetal_Hole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:84
SheetMetal_Louver Louver() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:106
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and louver issue.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:125
Describes small distance detween hole and notch issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.hxx:31
SheetMetal_Hole Hole() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:89
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and notch issue.
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:130
SheetMetal_Notch Notch() const
Definition DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:111
Describes small distance detween holes issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenHolesIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between holes issue.
Definition DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:130
SheetMetal_Hole FirstHole() const
Definition DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:89
SheetMetal_Hole SecondHole() const
Definition DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:111
Describes small distance detween notch and bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.hxx:31
SheetMetal_Bend Bend() const
Definition DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:108
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between notch and bend issue.
Definition DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:127
SheetMetal_Notch Notch() const
Definition DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:86
Describes small distance between notches issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenNotchesIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between notches issue.
Definition DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:124
SheetMetal_Notch FirstNotch() const
Definition DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:83
SheetMetal_Notch SecondNotch() const
Definition DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:105
Describes small distance between tabs issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallDistanceBetweenTabsIssue.hxx:30
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between tabs issue.
Definition DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:126
SheetMetal_Tab SecondTab() const
Definition DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:107
SheetMetal_Tab FirstTab() const
Definition DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:85
Describes small length flange issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallLengthFlangeIssue.hxx:31
const MTKBase_CompositeFeature & Flange() const
Definition DFMSheetMetal_SmallLengthFlangeIssue.cxx:111
double ActualLength() const
Definition DFMSheetMetal_SmallLengthFlangeIssue.cxx:180
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small length flange issue.
Definition DFMSheetMetal_SmallLengthFlangeIssue.cxx:197
double ExpectedMinLength() const
Definition DFMSheetMetal_SmallLengthFlangeIssue.cxx:171
Describes small length hem bend flange issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.hxx:30
double ExpectedMinLength() const
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:180
const MTKBase_CompositeFeature & Flange() const
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:121
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small length hem bend flange issue.
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:206
double ActualLength() const
Definition DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:189
Describes small radius bend issues found during sheet metal design analysis.
Definition DFMSheetMetal_SmallRadiusBendIssue.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal small radius bend issue.
Definition DFMSheetMetal_SmallRadiusBendIssue.cxx:129
double ExpectedMinRadius() const
Definition DFMSheetMetal_SmallRadiusBendIssue.cxx:114
double ActualRadius() const
Definition DFMSheetMetal_SmallRadiusBendIssue.cxx:123
const Geom::Direction & Direction() const
Returns a direction value.
Definition Axis1d.cxx:67
const Direction & Axis() const
Returns a Z-direction of the axis.
Definition Axis3d.cxx:110
Defines a 3D Direction.
Definition Direction.hxx:34
Defines a 3D point.
Definition Point.hxx:35
Describes a boss. In CNC Machining a boss is a protrusion or raised area on a workpiece that is creat...
Definition MTKBase_Boss.hxx:31
double Length() const
Definition MTKBase_Boss.cxx:94
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a Boss.
Definition MTKBase_Boss.cxx:131
double Width() const
Definition MTKBase_Boss.cxx:74
double Height() const
Definition MTKBase_Boss.cxx:114
Describeas a base class for composite features.
Definition MTKBase_CompositeFeature.hxx:34
const MTKBase_FeatureList & FeatureList() const
Returns the feature references list.
Definition MTKBase_CompositeFeature.cxx:93
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a composite feature.
Definition MTKBase_CompositeFeature.cxx:99
Provides possibility to compare MTK based features depending on their type and parameters.
Definition MTKBase_FeatureComparator.hxx:29
bool IsEmpty() const
Definition MTKBase_FeatureList.hxx:50
const Geom::Axis3d & Axis() const
Definition MTKBase_Hole.cxx:128
double Depth() const
Definition MTKBase_Hole.cxx:99
double Radius() const
Definition MTKBase_Hole.cxx:79
Describes a feature with assigned shape.
Definition MTKBase_ShapeFeature.hxx:36
const ModelData::Shape & Shape() const
Definition MTKBase_ShapeFeature.cxx:63
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a shape feature.
Definition MTKBase_ShapeFeature.cxx:78
Describes a machining countersink.
Definition Machining_Countersink.hxx:33
const Geom::Axis3d & Axis() const
Definition Machining_Countersink.cxx:134
double Radius() const
Definition Machining_Countersink.cxx:85
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a machining countersink.
Definition Machining_Countersink.cxx:149
double Depth() const
Definition Machining_Countersink.cxx:105
Describes a face produced by a specified machining operation.
Definition Machining_Face.hxx:38
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a machining face.
Definition Machining_Face.cxx:233
Machining_FaceType Type() const
Definition Machining_Face.cxx:218
Describes a machining hole of a specified type. Hole is a cylindrical feature that can be made by cut...
Definition Machining_Hole.hxx:30
Machining_HoleType Type() const
Definition Machining_Hole.cxx:144
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a machining hole.
Definition Machining_Hole.cxx:159
Describes a machining pocket. A pocket is a feature obtained by milling the material inside an arbitr...
Definition Machining_Pocket.hxx:33
double Width() const
Definition Machining_Pocket.cxx:78
const Geom::Axis1d & Axis() const
Definition Machining_Pocket.cxx:147
Machining_PocketType Type() const
Definition Machining_Pocket.cxx:165
double Depth() const
Definition Machining_Pocket.cxx:118
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a machining Pocket.
Definition Machining_Pocket.cxx:180
double Length() const
Definition Machining_Pocket.cxx:98
Describes a face with radius produced by a specified machining operation. Cutting material from workp...
Definition Machining_TurningFace.hxx:29
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a machining turning face.
Definition Machining_TurningFace.cxx:88
double Radius() const
Definition Machining_TurningFace.cxx:71
Base class of topological shapes.
Definition Shape.hxx:32
Describes a rib.
Definition Molding_Rib.hxx:29
double Thickness() const
Definition Molding_Rib.cxx:83
double Height() const
Definition Molding_Rib.cxx:123
double DraftAngle() const
Definition Molding_Rib.cxx:143
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a Rib.
Definition Molding_Rib.cxx:160
double Length() const
Definition Molding_Rib.cxx:103
Describes a screw boss. In injection molding, the Screw Boss is essentially a cylindrical protrusion ...
Definition Molding_ScrewBoss.hxx:29
double InnerRadius() const
Definition Molding_ScrewBoss.cxx:123
double DraftAngle() const
Definition Molding_ScrewBoss.cxx:143
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a molding Screw Boss.
Definition Molding_ScrewBoss.cxx:189
double OuterRadius() const
Definition Molding_ScrewBoss.cxx:103
Describes a sheet metal bead.
Definition SheetMetal_Bead.hxx:28
double Depth() const
Definition SheetMetal_Bead.cxx:69
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a bead.
Definition SheetMetal_Bead.cxx:86
Describes a bend in sheet metal.
Definition SheetMetal_Bend.hxx:32
double Angle() const
Definition SheetMetal_Bend.cxx:99
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a bend.
Definition SheetMetal_Bend.cxx:142
double Width() const
Definition SheetMetal_Bend.cxx:119
double Radius() const
Definition SheetMetal_Bend.cxx:79
double Length() const
Returns the length of resulting bend (not blank sheet metal model). Length value returns in mm .
Definition SheetMetal_Bend.cxx:136
Describes a sheet metal bend relief.
Definition SheetMetal_BendRelief.hxx:37
bool IsNull() const
Returns true if the object is null.
Definition SheetMetal_BendRelief.cxx:123
double Length() const
Definition SheetMetal_BendRelief.cxx:86
const ModelData::Shape & Shape() const
Definition SheetMetal_BendRelief.cxx:106
double Width() const
Definition SheetMetal_BendRelief.cxx:66
Describes a sheet metal bridge feature.
Definition SheetMetal_Bridge.hxx:28
double Depth() const
Definition SheetMetal_Bridge.cxx:73
double Length() const
Definition SheetMetal_Bridge.cxx:93
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a bridge.
Definition SheetMetal_Bridge.cxx:110
Describes a sheet metal complex hole feature.
Definition SheetMetal_ComplexHole.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a sheet metal complex hole.
Definition SheetMetal_ComplexHole.cxx:78
Describes a sheet metal curved bend feature.
Definition SheetMetal_CurvedBend.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is an curved bend.
Definition SheetMetal_CurvedBend.cxx:60
Describes a cutout in sheet metal.
Definition SheetMetal_Cutout.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a cutout.
Definition SheetMetal_Cutout.cxx:79
double Perimeter() const
Definition SheetMetal_Cutout.cxx:62
double Length() const
Returns length of the unfolded model in mm .
Definition SheetMetal_FlatPattern.cxx:225
double Perimeter() const
Returns perimeter of the unfolded model in mm .
Definition SheetMetal_FlatPattern.cxx:243
double Thickness() const
Returns thickness of the unfolded model in mm .
Definition SheetMetal_FlatPattern.cxx:237
double Width() const
Returns width of the unfolded model in mm .
Definition SheetMetal_FlatPattern.cxx:231
Describes a sheet metal Hem bend feature.
Definition SheetMetal_HemBend.hxx:29
SheetMetal_HemBendType Type() const
Definition SheetMetal_HemBend.cxx:134
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is an hem bend.
Definition SheetMetal_HemBend.cxx:149
Describes a circle hole drilled or punched in sheet metal.
Definition SheetMetal_Hole.hxx:32
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a sheet metal hole.
Definition SheetMetal_Hole.cxx:75
Describes a sheet metal louver feature.
Definition SheetMetal_Louver.hxx:28
double Depth() const
Definition SheetMetal_Louver.cxx:70
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a louver.
Definition SheetMetal_Louver.cxx:87
Describes a sheet metal notch.
Definition SheetMetal_Notch.hxx:32
double Length() const
Definition SheetMetal_Notch.cxx:93
double Width() const
Definition SheetMetal_Notch.cxx:73
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a notch.
Definition SheetMetal_Notch.cxx:130
Describes a sheet metal straight notch.
Definition SheetMetal_StraightNotch.hxx:28
double CornerFilletRadius() const
Definition SheetMetal_StraightNotch.cxx:68
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a straight notch.
Definition SheetMetal_StraightNotch.cxx:87
Describes a sheet metal tab.
Definition SheetMetal_Tab.hxx:28
double Width() const
Definition SheetMetal_Tab.cxx:72
double Length() const
Definition SheetMetal_Tab.cxx:92
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a tab.
Definition SheetMetal_Tab.cxx:109
Describes a sheet metal V-notch.
Definition SheetMetal_VNotch.hxx:28
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a V notch.
Definition SheetMetal_VNotch.cxx:79
double Angle() const
Definition SheetMetal_VNotch.cxx:60
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition UTF16String.hxx:30
Defines classes, types, enums, and functions related to geometric entities.
Machining_HoleType
Defines a hole type in machining.
Definition Machining_HoleType.hxx:28
Machining_FaceType
Describes a face produced by a specified machining operation.
Definition Machining_FaceType.hxx:28
SheetMetal_HemBendType
Defines a hem bend type in sheet metal.
Definition SheetMetal_HemBendType.hxx:28

MTKConverter_Application.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
using System;
using System.Collections.Generic;
using System.IO;
namespace mtkconverter
{
enum MTKConverter_ReturnCode
{
// General codes
MTKConverter_RC_OK = 0,
MTKConverter_RC_UnknownError = 1,
MTKConverter_RC_GeneralException = 2,
MTKConverter_RC_NoValidLicense = 3,
MTKConverter_RC_InvalidArgumentsNumber = 4,
MTKConverter_RC_InvalidArgument = 5,
// Import errors
MTKConverter_RC_UnsupportedVersion = 100,
MTKConverter_RC_UnexpectedFormat = 101,
MTKConverter_RC_UnsupportedFileVariant = 102,
MTKConverter_RC_ImportError = 103,
// Process errors
MTKConverter_RC_ProcessError = 200,
// Export errors
MTKConverter_RC_ExportError = 300,
}
enum MTKConverter_ProcessType
{
MTKConverter_PT_Undefined = -1,
MTKConverter_PT_WallThickness = 0,
MTKConverter_PT_MachiningMilling,
MTKConverter_PT_MachiningTurning,
MTKConverter_PT_Molding,
MTKConverter_PT_SheetMetal
}
//parse and execute command line
enum Mode { NeutralMode, ImportMode, ProcessMode, ExportMode }
class MTKConverter_Application
{
public MTKConverter_Application()
{
}
public MTKConverter_ReturnCode Run (string[] args)
{
if (args.Length == 0 ||
(args[0] == "-?") || (args[0] == "/?") ||
(args[0] == "-h") || (args[0] == "--help"))
{
PrintUsage();
return MTKConverter_ReturnCode.MTKConverter_RC_OK;
}
if (args.Length < 6)
{
Console.WriteLine("Invalid number of arguments. Please use \"-h\" or \"--help\" for usage information.");
return MTKConverter_ReturnCode.MTKConverter_RC_InvalidArgumentsNumber;
}
Model aModel = new Model();
Model aProcessModel = new Model();
Mode aMode = Mode.NeutralMode;
MTKConverter_Report aReport = new MTKConverter_Report();
MTKConverter_ReturnCode aRes = MTKConverter_ReturnCode.MTKConverter_RC_OK;
for (int i = 0; (i < args.Length) && (aRes == MTKConverter_ReturnCode.MTKConverter_RC_OK); ++i) {
string anArgument = args[i];
if (anArgument == "-i") {
aMode = Mode.ImportMode;
} else if (anArgument == "-p") {
aMode = Mode.ProcessMode;
} else if (anArgument == "-e") {
aMode = Mode.ExportMode;
} else {
try
{
if (aMode == Mode.ImportMode)
{
aRes = Import(anArgument, aModel);
}
else if (aMode == Mode.ProcessMode)
{
aRes = Process(anArgument, aModel, aReport, aProcessModel);
}
else if (aMode == Mode.ExportMode)
{
aRes = Export(anArgument, aModel, aReport, aProcessModel);
}
else
{
Console.WriteLine($"ERROR!: Invalid argument {anArgument}. Exiting");
Console.WriteLine($"Type {System.Reflection.Assembly.GetExecutingAssembly().Location} -h for help.");
return MTKConverter_ReturnCode.MTKConverter_RC_InvalidArgument;
}
Console.WriteLine("Done.");
}
catch(Exception anE)
{
Console.WriteLine($"Failed.\nERROR: {anE.Message}");
return MTKConverter_ReturnCode.MTKConverter_RC_GeneralException;
}
}
}
return aRes;
}
public void PrintUsage()
{
Console.WriteLine("Usage:");
Console.WriteLine("MTKConverter -i <import_file> -p <process> -e <export_folder>\n");
Console.WriteLine("Arguments:");
Console.WriteLine(" <import_file> - import file name");
Console.WriteLine(" <process> - manufacturing process or algorithm name");
Console.WriteLine(" <export_folder> - export folder name");
Console.WriteLine("Example:" );
Console.WriteLine("MTKConverter -i C:\\models\\test.step -p machining_milling -e C:\\models\\test");
Console.WriteLine("\nRecognized processes:");
Console.WriteLine(" wall_thickness :\t Wall Thickness analysis");
Console.WriteLine(" machining_milling:\t CNC Machining Milling feature recognition and dfm analysis");
Console.WriteLine(" machining_turning:\t CNC Machining Lathe+Milling feature recognition and dfm analysis");
Console.WriteLine(" molding :\t Molding feature recognition and dfm analysis");
Console.WriteLine(" sheet_metal :\t Sheet Metal feature recognition, unfolding and dfm analysis");
}
private MTKConverter_ProcessType ProcessType(string theProcessName)
{
var aProcessDictionary = new Dictionary<string, MTKConverter_ProcessType>()
{
{ "wall_thickness", MTKConverter_ProcessType.MTKConverter_PT_WallThickness},
{ "machining_milling", MTKConverter_ProcessType.MTKConverter_PT_MachiningMilling},
{ "machining_turning", MTKConverter_ProcessType.MTKConverter_PT_MachiningTurning},
{ "molding", MTKConverter_ProcessType.MTKConverter_PT_Molding},
{ "sheet_metal", MTKConverter_ProcessType.MTKConverter_PT_SheetMetal}
};
MTKConverter_ProcessType aProcess = MTKConverter_ProcessType.MTKConverter_PT_Undefined;
bool aRes = aProcessDictionary.TryGetValue(theProcessName, out aProcess);
if (aRes)
{
return aProcess;
}
return MTKConverter_ProcessType.MTKConverter_PT_Undefined;
}
private MTKConverter_ReturnCode Import(string theFilePath, Model theModel)
{
UTF16String aFilePath = new UTF16String(theFilePath);
Console.Write($"Importing {theFilePath}...");
ModelReader aReader = new ModelReader();
if (!aReader.Read (aFilePath, theModel)) {
Console.WriteLine($"\nERROR: Failed to import {theFilePath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ImportError;
}
return MTKConverter_ReturnCode.MTKConverter_RC_OK;
}
private void ApplyProcessorToModel(Model theModel, MTKConverter_Report theReport, MTKConverter_PartProcessor theProcessor)
{
theModel.Accept(aVisitor);
foreach (MTKConverter_ProcessData i in theProcessor.myData)
{
theReport.AddData(i);
}
}
private MTKConverter_ReturnCode Process(string theProcess, Model theModel,
MTKConverter_Report theReport, Model theProcessModel)
{
Console.Write($"Processing {theProcess}...");
theModel.AssignUuids();
MTKConverter_ProcessType aProcessType = ProcessType(theProcess);
switch (aProcessType)
{
case MTKConverter_ProcessType.MTKConverter_PT_WallThickness:
{
MTKConverter_WallThicknessProcessor aProcessor = new MTKConverter_WallThicknessProcessor(800);
ApplyProcessorToModel(theModel, theReport, aProcessor);
break;
}
case MTKConverter_ProcessType.MTKConverter_PT_MachiningMilling:
{
MTKConverter_MachiningProcessor aProcessor = new MTKConverter_MachiningProcessor(Machining_OperationType.Machining_OT_Milling);
ApplyProcessorToModel(theModel, theReport, aProcessor);
break;
}
case MTKConverter_ProcessType.MTKConverter_PT_MachiningTurning:
{
MTKConverter_MachiningProcessor aProcessor = new MTKConverter_MachiningProcessor(Machining_OperationType.Machining_OT_LatheMilling);
ApplyProcessorToModel(theModel, theReport, aProcessor);
break;
}
case MTKConverter_ProcessType.MTKConverter_PT_Molding:
{
MTKConverter_MoldingProcessor aProcessor = new MTKConverter_MoldingProcessor();
ApplyProcessorToModel(theModel, theReport, aProcessor);
break;
}
case MTKConverter_ProcessType.MTKConverter_PT_SheetMetal:
{
UTF16String aProcessModelName = new UTF16String(theModel.Name() + "_unfolded");
theProcessModel.SetName(aProcessModelName);
MTKConverter_SheetMetalProcessor aProcessor = new MTKConverter_SheetMetalProcessor(theProcessModel);
ApplyProcessorToModel(theModel, theReport, aProcessor);
break;
}
case MTKConverter_ProcessType.MTKConverter_PT_Undefined:
default: return MTKConverter_ReturnCode.MTKConverter_RC_InvalidArgument;
}
return MTKConverter_ReturnCode.MTKConverter_RC_OK;
}
private MTKConverter_ReturnCode Export(string theFolderPath, Model theModel,
MTKConverter_Report theReport, Model theProcessModel)
{
Console.Write($"Exporting {theFolderPath}...");
UTF16String aModelPath = new UTF16String(theFolderPath + "/" + theModel.Name() + ".mtkweb" + "/scenegraph.mtkweb");
if (!theModel.Save(aModelPath, Model.FileFormatType.MTKWEB))
{
Console.WriteLine($"\nERROR: Failed to export {aModelPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
if (!theProcessModel.IsEmpty())
{
UTF16String aProcessModelPath = new UTF16String(theFolderPath + "/" + theProcessModel.Name() + ".mtkweb" + "/scenegraph.mtkweb");
if (!theProcessModel.Save(aProcessModelPath, Model.FileFormatType.MTKWEB))
{
Console.WriteLine($"\nERROR: Failed to export {aProcessModelPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
}
Directory.CreateDirectory (theFolderPath);
UTF16String aJsonPath = new UTF16String(theFolderPath + "/process_data.json");
if (!theReport.WriteToJSON(aJsonPath))
{
Console.WriteLine($"\nERROR: Failed to create JSON file {aJsonPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
return MTKConverter_ReturnCode.MTKConverter_RC_OK;
}
}
}
Defines a visitor that visits each unique element only once.
Definition ModelElementVisitor.hxx:87
void SetName(const UTF16String &theName)
Sets a model name.
Definition Model.cxx:241
UTF16String Name() const
Returns a model name.
Definition Model.cxx:250
void AssignUuids()
Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned ye...
Definition Model.cxx:264
bool IsEmpty() const
Returns true if the model is empty.
Definition Model.cxx:169
void Accept(ModelElementVisitor &theVisitor) const
Accepts a visitor.
Definition Model.cxx:270
Reads STEP and native format.
Definition ModelReader.hxx:29
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:227

Program.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2025, CADEX. All rights reserved.
//
// This file is part of the Manufacturing Toolkit software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
using cadex;
using System;
namespace mtkconverter
{
class Program
{
static int Main(string[] args)
{
string aKey = MTKLicenseKey.Value();
// Activate the license (aKey should be defined in mtk_license.cs)
if (!LicenseManager.Activate(aKey))
{
Console.WriteLine("Failed to activate Manufacturing Toolkit license.");
return 1;
}
MTKConverter_Application anApp = new MTKConverter_Application();
return (int)anApp.Run(args);
}
}
}