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-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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(ModelData_Part thePart)
{
myPart = thePart;
}
public ModelData_Part myPart;
}
abstract class MTKConverter_PartProcessor : ModelData_Model.VoidElementVisitor
{
protected MTKConverter_PartProcessor()
{
myData = new List<MTKConverter_ProcessData>();
}
public List<MTKConverter_ProcessData> myData;
public override void Apply(ModelData_Part thePart)
{
var aBRep = thePart.BRepRepresentation();
var aPolyRep = thePart.PolyRepresentation(ModelData_RepresentationMask.ModelData_RM_Poly);
if (aBRep != null)
{
ModelData_BodyList aBodyList = aBRep.Get();
for (uint i = 0; i < aBodyList.Size(); ++i)
{
ModelData_Body aBody = aBodyList.Element(i);
var aShapeIt = new ModelData_Shape.Iterator(aBody);
while (aShapeIt.HasNext())
{
var aShape = aShapeIt.Next();
if (aShape.Type() == ModelData_ShapeType.ModelData_ST_Solid)
{
ProcessSolid(thePart, ModelData_Solid.Cast(aShape));
}
else if (aShape.Type() == ModelData_ShapeType.ModelData_ST_Shell)
{
ProcessShell(thePart, ModelData_Shell.Cast(aShape));
}
}
}
}
else if (aPolyRep != null)
{
var aPolyList = aPolyRep.Get();
for (uint i = 0; i < aPolyList.Size(); ++i)
{
var aPVS = aPolyList.Element(i);
if (aPVS.TypeId() == ModelData_IndexedTriangleSet.GetTypeId())
{
ProcessMesh(thePart, ModelData_IndexedTriangleSet.Cast(aPVS));
}
}
}
PostPartProcess(thePart);
}
public abstract void ProcessSolid(ModelData_Part thePart, ModelData_Solid theSolid);
public abstract void ProcessShell(ModelData_Part thePart, ModelData_Shell theShell);
public abstract void ProcessMesh(ModelData_Part thePart, ModelData_IndexedTriangleSet theMesh);
public abstract void PostPartProcess(ModelData_Part thePart);
}
class MTKConverter_VoidPartProcessor : MTKConverter_PartProcessor
{
public MTKConverter_VoidPartProcessor() : base() { }
public override void ProcessSolid(ModelData_Part thePart, ModelData_Solid theSolid) { }
public override void ProcessShell(ModelData_Part thePart, ModelData_Shell theShell) { }
public override void ProcessMesh(ModelData_Part thePart, ModelData_IndexedTriangleSet theMesh) { }
public override void PostPartProcess(ModelData_Part thePart) { }
}
}
Defines a root topological shape that can be owned by B-Rep representation.
Definition: ModelData_Body.hxx:28
Defines a list of bodies.
Definition: ModelData_BodyList.hxx:31
const ModelData_Body & Element(SizeType theIndex) const
Definition: ModelData_BodyList.cxx:177
Defines a polygonal shape consisting of triangles.
Definition: ModelData_IndexedTriangleSet.hxx:35
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
ModelData_PolyRepresentation PolyRepresentation(ModelData_RepresentationMask theRepresentationMask) const
Definition: ModelData_Part.cxx:371
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
Defines a connected set of faces.
Definition: ModelData_Shell.hxx:31
Defines a topological solid.
Definition: ModelData_Solid.hxx:31
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
ModelData_RepresentationMask
Defines a mask to filter part representations.
Definition: ModelData_RepresentationMask.hxx:25
ModelData_ShapeType
Defines shape type.
Definition: ModelData_ShapeType.hxx:25

MTKConverter_WallThicknessProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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 PointPairType = System.Collections.Generic.KeyValuePair<cadex.ModelData_Point, cadex.ModelData_Point>;
namespace mtkconverter
{
class MTKConverter_WallThicknessData : MTKConverter_ProcessData
{
public MTKConverter_WallThicknessData(ModelData_Part thePart) : base(thePart)
{
myMinThicknessPoints = new PointPairType(new ModelData_Point(), new ModelData_Point());
myMaxThicknessPoints = new PointPairType(new ModelData_Point(), new ModelData_Point());
}
public bool myIsInit = false;
public double myMinThickness = double.MaxValue;
public double myMaxThickness = -double.MaxValue;
public PointPairType myMinThicknessPoints;
public PointPairType myMaxThicknessPoints;
}
class MTKConverter_WallThicknessProcessor : MTKConverter_VoidPartProcessor
{
public MTKConverter_WallThicknessProcessor(uint theResolution) : base()
{
myAnalyzer = new WallThickness_Analyzer();
myResolution = theResolution;
}
private WallThickness_Analyzer myAnalyzer;
private uint myResolution = 1000;
public override void ProcessSolid(ModelData_Part thePart, ModelData_Solid theSolid)
{
WallThickness_Data aWTData = myAnalyzer.Perform(theSolid, myResolution);
UpdateProcessData(aWTData, thePart);
}
public override void ProcessMesh(ModelData_Part thePart, ModelData_IndexedTriangleSet theMesh)
{
WallThickness_Data aWTData = myAnalyzer.Perform(theMesh, myResolution);
UpdateProcessData(aWTData, thePart);
}
public void UpdateProcessData(WallThickness_Data theData, ModelData_Part thePart)
{
MTKConverter_WallThicknessData aWTData = new MTKConverter_WallThicknessData(thePart);
myData.Add(aWTData);
if (theData.IsEmpty())
{
return;
}
aWTData.myIsInit = true;
if (aWTData.myMinThickness > theData.MinThickness())
{
aWTData.myMinThickness = theData.MinThickness();
ModelData_Point aFirstPoint = new ModelData_Point();
ModelData_Point aSecondPoint = new ModelData_Point();
theData.PointsOfMinThickness(aFirstPoint, aSecondPoint);
aWTData.myMinThicknessPoints = new PointPairType(aFirstPoint, aSecondPoint);
}
if (aWTData.myMaxThickness < theData.MaxThickness())
{
aWTData.myMaxThickness = theData.MaxThickness();
ModelData_Point aFirstPoint = new ModelData_Point();
ModelData_Point aSecondPoint = new ModelData_Point();
theData.PointsOfMaxThickness(aFirstPoint, aSecondPoint);
aWTData.myMaxThicknessPoints = new PointPairType(aFirstPoint, aSecondPoint);
}
}
}
}
Defines a 3D point.
Definition: ModelData_Point.hxx:295
The wall thickness analyzing tool.
Definition: WallThickness_Analyzer.hxx:42
WallThickness_Data Perform(const ModelData_Solid &theSolid, size_t theResolution, const cadex::Base_ProgressStatus &theProgressStatus=cadex::Base_ProgressStatus())
Runs analyzing process for ModelData_Solid object.
Definition: WallThickness_Analyzer.cxx:785
Contains information about minimum and maximum wall thicknesses.
Definition: WallThickness_Data.hxx:39
double MaxThickness() const
Returns the maximum wall thickness in mm.
Definition: WallThickness_Data.cxx:69
bool IsEmpty() const
Returns true if WallThickness_Data is empty.
Definition: WallThickness_Data.cxx:97
double MinThickness() const
Returns the minimum wall thickness in mm.
Definition: WallThickness_Data.cxx:63
void PointsOfMaxThickness(ModelData_Point &theFirstPoint, ModelData_Point &theSecondPoint) const
Returns points of maximum thickness.
Definition: WallThickness_Data.cxx:90
void PointsOfMinThickness(ModelData_Point &theFirstPoint, ModelData_Point &theSecondPoint) const
Returns points of minimum thickness.
Definition: WallThickness_Data.cxx:79

MTKConverter_MachiningProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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(ModelData_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(ModelData_Part thePart, ModelData_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::Base_ProgressStatus &theProgressStatus=cadex::Base_ProgressStatus())
Runs analyzing process.
Definition: DFMMachining_Analyzer.cxx:112
Describes deep pocket issue found during cnc machining milling design analysis.
Definition: DFMMachining_DeepPocketIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm deep pocket issue.
Definition: DFMMachining_DeepPocketIssue.cxx:143
Defines parameters used in cnc machining drilling design analysis.
Definition: DFMMachining_DrillingAnalyzerParameters.hxx:33
Defines parameters used in cnc machining milling design analysis.
Definition: DFMMachining_MillingAnalyzerParameters.hxx:35
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:34
Defines a list of features.
Definition: MTKBase_FeatureList.hxx:37
size_t Size() const
Returns the number of elements in the list.
Definition: MTKBase_FeatureList.cxx:87
const MTKBase_Feature & Feature(size_t theIndex) const
Access specified element.
Definition: MTKBase_FeatureList.cxx:68
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::Base_ProgressStatus &theProgressStatus=cadex::Base_ProgressStatus())
Runs the analyzing process.
Definition: Machining_Analyzer.cxx:79
void AddTool(const Machining_AnalyzerTool &theTool)
Adds additional tool to run during analyzing process.
Definition: Machining_Analyzer.cxx:99
Defines data used in Machining analysis.
Definition: Machining_Data.hxx:39
bool IsEmpty() const
Returns true if the data is empty.
Definition: Machining_Data.cxx:55
const MTKBase_FeatureList & FeatureList() const
Definition: Machining_Data.cxx:49
Provides an interface to recognizing machining features tool.
Definition: Machining_FeatureRecognizer.hxx:43
const Machining_FeatureRecognizerParameters & Parameters() const
Returns parameters.
Definition: Machining_FeatureRecognizer.cxx:287
void SetOperation(Machining_OperationType theOperation)
Definition: Machining_FeatureRecognizerParameters.cxx:205
Machining_OperationType
Defines an operation type in machining.
Definition: Machining_OperationType.hxx:29

MTKConverter_SheetMetalProcessor.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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(ModelData_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(ModelData_Model theUnfoldedModel) : base()
{
myAnalyzer = new SheetMetal_Analyzer();
myAnalyzer.AddTool(new SheetMetal_FeatureRecognizer());
myAnalyzer.AddTool(new SheetMetal_Unfolder());
myUnfoldedModel = theUnfoldedModel;
myCurrentUnfoldedBRep = new ModelData_BRepRepresentation();
}
private SheetMetal_Analyzer myAnalyzer;
private ModelData_Model myUnfoldedModel;
private ModelData_BRepRepresentation myCurrentUnfoldedBRep;
public override void ProcessSolid(ModelData_Part thePart, ModelData_Solid theSolid)
{
SheetMetal_Data anSMData = myAnalyzer.Perform(theSolid, CalculateInitialThicknessValue(theSolid));
UpdateProcessData(anSMData, thePart);
}
public override void ProcessShell(ModelData_Part thePart, ModelData_Shell theShell)
{
SheetMetal_Data anSMData = myAnalyzer.Perform(theShell);
UpdateProcessData(anSMData, thePart);
}
public override void PostPartProcess(ModelData_Part thePart)
{
if (myCurrentUnfoldedBRep == null)
{
return;
}
ModelData_Part anUnfoldedPart = new ModelData_Part(thePart.Name());
anUnfoldedPart.SetUuid(thePart.Uuid());
anUnfoldedPart.AddRepresentation(myCurrentUnfoldedBRep);
aMesher.Compute(anUnfoldedPart);
myUnfoldedModel.AddRoot(anUnfoldedPart);
myCurrentUnfoldedBRep = new ModelData_BRepRepresentation();
}
public void UpdateProcessData(SheetMetal_Data theData, ModelData_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();
ModelData_Shell anUnfoldedShell = !aFlatPattern.IsNull() ? aFlatPattern.UnfoldedShell() : null;
MTKConverter_UnfoldedPartData anUnfoldedData = anSMData.myUnfoldedPartData;
if (anUnfoldedShell != null)
{
myCurrentUnfoldedBRep.Add(anUnfoldedShell);
anUnfoldedData.myBRep = myCurrentUnfoldedBRep;
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);
}
}
}
//Compute approximate thickness value, which can be used as the input thickness
//value for SheetMetal_FeatureRecognizer.
static double CalculateInitialThicknessValue(ModelData_Shape theShape)
{
double aVolume = ModelAlgo_ValidationProperty.ComputeVolume(theShape);
double aSurfaceArea = ModelAlgo_ValidationProperty.ComputeSurfaceArea(theShape);
double aThickness = aVolume / (aSurfaceArea / 2.0);
return aThickness;
}
}
}
Provides an interface to run DFM Sheet Metal analysis.
Definition: DFMSheetMetal_Analyzer.hxx:45
MTKBase_FeatureList Perform(const ModelData_Solid &theSolid, double theThickness, const cadex::Base_ProgressStatus &theProgressStatus=cadex::Base_ProgressStatus())
Definition: DFMSheetMetal_Analyzer.cxx:1565
Describes interference issue for flat pattern found during sheet metal design analysis.
Definition: DFMSheetMetal_FlatPatternInterferenceIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a flat pattern inteference issue.
Definition: DFMSheetMetal_FlatPatternInterferenceIssue.cxx:124
Describes non standard sheet size issue found during sheet metal design analysis.
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non standard sheet thickness issue.
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.cxx:102
Describes non standard sheet thickness issue found during sheet metal design analysis.
Definition: DFMSheetMetal_NonStandardSheetThicknessIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non standard sheet thickness issue.
Definition: DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:107
Computes a polygonal representation from a B-Rep one.
Definition: ModelAlgo_BRepMesher.hxx:48
void Compute(const ModelData_Model &theModel, bool theEnforceAddition=false) const
Computes polygonal representations for all parts in the model.
Definition: ModelAlgo_BRepMesher.cxx:478
Computes validation properties of the objects.
Definition: ModelAlgo_ValidationProperty.hxx:35
static double ComputeSurfaceArea(const ModelData_Model &theModel, bool theUseProperty=false, bool theStoreProperty=false)
Returns a surface area of a scene graph.
Definition: ModelAlgo_ValidationProperty.cxx:362
static double ComputeVolume(const ModelData_Model &theModel, bool theUseProperty=false, bool theStoreProperty=false)
Returns a volume of a scene graph.
Definition: ModelAlgo_ValidationProperty.cxx:402
Defines precise Boundary Representation of part.
Definition: ModelData_BRepRepresentation.hxx:39
ModelData_Shape Add(const ModelData_Shape &theShape)
Adds a root body (or bodies).
Definition: ModelData_BRepRepresentation.cxx:612
Base_Uuid Uuid() const
Definition: ModelData_BaseObject.cxx:240
void SetUuid(const Base_Uuid &theUuid)
Definition: ModelData_BaseObject.cxx:230
Base_UTF16String Name() const
Definition: ModelData_BaseObject.cxx:218
const ModelData_SceneGraphElement & AddRoot(const ModelData_SceneGraphElement &theElement)
Adds new root element into the scene graph.
Definition: ModelData_Model.cxx:830
void AddRepresentation(const ModelData_Representation &theRepresentation)
Adds a representation.
Definition: ModelData_Part.cxx:341
Provides an interface to run several analyzer tools.
Definition: SheetMetal_Analyzer.hxx:43
SheetMetal_Data Perform(const ModelData_Solid &theSolid, double theThickness, const cadex::Base_ProgressStatus &theProgressStatus=cadex::Base_ProgressStatus())
Runs analyzing process.
Definition: SheetMetal_Analyzer.cxx:139
Contains specific information for sheet metal tools.
Definition: SheetMetal_Data.hxx:40
bool IsEmpty() const
Returns true if the data is empty.
Definition: SheetMetal_Data.cxx:104
const SheetMetal_FlatPattern & FlatPattern() const
Definition: SheetMetal_Data.cxx:98
const MTKBase_FeatureList & FeatureList() const
Definition: SheetMetal_Data.cxx:89
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:38
ModelData_Shell UnfoldedShell() const
Returns the unfolded shell for flat pattern.
Definition: SheetMetal_FlatPattern.cxx:115
bool IsNull() const
Returns true if the flat pattern is null.
Definition: SheetMetal_FlatPattern.cxx:170
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-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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<int>;
using ShapeIDVectorVectorType = System.Collections.Generic.List<System.Collections.Generic.List<int>>;
using FeatureMapType = System.Collections.Generic.SortedDictionary<cadex.MTKBase_Feature,
System.Collections.Generic.KeyValuePair<uint, System.Collections.Generic.List<System.Collections.Generic.List<int>>>>;
using PointPairType = System.Collections.Generic.KeyValuePair<cadex.ModelData_Point, cadex.ModelData_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(Base_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 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);
ModelData_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);
ModelData_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);
ModelData_Direction aDir = aPocket.Axis().Direction();
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("Pocket(s)", "(23, 63, 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);
}
//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);
ModelData_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);
}
}
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 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(ModelData_Shape theShape, ModelData_BRepRepresentation theBRep, ModelData_ShapeType theType)
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
var aShapeIt = new ModelData_Shape.Iterator(theShape, theType);
while (aShapeIt.HasNext())
{
ModelData_Shape aShape = aShapeIt.Next();
aShapeIdVector.Add(theBRep.ShapeId(aShape));
}
return aShapeIdVector;
}
private void AddShapesId(ModelData_Shape theShape, ModelData_BRepRepresentation theBRep,
ModelData_ShapeType theType, ShapeIDVectorType theShapesIdVec)
{
var aShapeIt = new ModelData_Shape.Iterator(theShape, theType);
while (aShapeIt.HasNext())
{
ModelData_Shape aShape = aShapeIt.Next();
theShapesIdVec.Add(theBRep.ShapeId(aShape));
}
}
private void SortFeatures(MTKBase_FeatureList theFeatures, ModelData_BRepRepresentation theBRep, 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(), theBRep, 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);
ModelData_ShapeType aShapeType = ModelData_ShapeType.ModelData_ST_Face;
{
aShapeType = ModelData_ShapeType.ModelData_ST_Edge;
}
ShapeIDVectorType aShapeIdVector = GetShapesId(aShapeFeature.Shape(), theBRep, aShapeType);
aValue.Add(aShapeIdVector);
}
//dfm machining drilling
{
ShapeIDVectorType aShapeIdVector = GetShapesId(anIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
//dfm machining milling
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aNSRMPFFIssue.FloorFillet(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aDCIssue.Pocket().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aHBIssue.Boss().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aMSICRIssue.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
DFMMachining_NonPerpendicularMilledPartShapeIssue.Cast (aFeature);
ShapeIDVectorType aShapeIdVector = GetShapesId (aNPMPSIssue.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aMPEEFIssue.Fillet(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIRMPFFIssue.FloorFillet(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aNRIPIssue.InnerFeature(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aNRIPIssue.NarrowRegionSidewall(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aLDRSIPIssue.InnerFeature(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MinRegionPocketSidewall(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aLDRSIPIssue.MaxRegionPocketSidewall(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
//dfm machining turning
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aBBHRIssue.BlindBoredHole(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISBHIssue.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aODPRIssue.Face(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aTSICRIssue.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSEKIssue.Keyway().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aNSASIssue.AxialSlot().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
aValue.Add(new ShapeIDVectorType());
}
//dfm sheet metal
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType { theBRep.ShapeId(aFPIIssue.FirstFace()),
theBRep.ShapeId(aFPIIssue.SecondFace()) };
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICFRNIssue.Notch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aICFRNIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIDEHIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aIRBIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
SheetMetal_BendRelief aFirstActualRelief = aISBRIssue.FirstActualRelief();
SheetMetal_BendRelief aSecondActualRelief = aISBRIssue.SecondActualRelief();
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aISBRIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
if (!aFirstActualRelief.IsNull())
{
AddShapesId(aFirstActualRelief.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
}
if (!aSecondActualRelief.IsNull())
{
AddShapesId(aSecondActualRelief.Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
}
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISNIssue.Notch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aISTIssue.Tab().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aLDBIssue.Bead().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSDLIssue.Louver().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
aValue.Add(new ShapeIDVectorType());
}
{
aValue.Add(new ShapeIDVectorType());
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSDHIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_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(), theBRep, ModelData_ShapeType.ModelData_ST_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(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
}
}
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = GetShapesId(aSRBIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aShapeIdVector.Add(theBRep.ShapeId(aSDIssue.Edge()));
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstHole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.Cutout().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
aShapeIdVector.Add(theBRep.ShapeId(aSDIssue.Edge()));
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.Louver().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Hole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.Notch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstHole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondHole().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.Notch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.Bend().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Face, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstNotch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondNotch().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
aValue.Add(aShapeIdVector);
}
{
ShapeIDVectorType aShapeIdVector = new ShapeIDVectorType();
AddShapesId(aSDIssue.FirstTab().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_Edge, aShapeIdVector);
AddShapesId(aSDIssue.SecondTab().Shape(), theBRep, ModelData_ShapeType.ModelData_ST_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,
ModelData_BRepRepresentation theBRep, 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, theBRep, 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);
}
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(ModelData_BRepRepresentation theBRep, ModelData_ShapeType theType)
{
ModelData_BodyList aBodyList = theBRep.Get();
for (uint i = 0, n = aBodyList.Size(); i < n; ++i)
{
ModelData_Body aBody = aBodyList.Element(i);
var aShapeIt = new ModelData_Shape.Iterator(aBody, theType);
if (aShapeIt.HasNext())
{
return true;
}
}
return false;
}
private void WriteThicknessNode(JSONWriter theWriter, string theParamName, double theParamValue,
PointPairType thePoints, string theNodeName)
{
ModelData_Point aFirstPoint = thePoints.Key;
ModelData_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));
ModelData_BRepRepresentation aBRep = aMD.myPart.BRepRepresentation();
if (!aMD.myFeatureList.IsEmpty())
{
WriteFeatures(theWriter, "Feature Recognition", "featureRecognition", aMD.myFeatureList, aBRep, "");
WriteFeatures(theWriter, "Design for Manufacturing", "dfm", aMD.myIssueList, aBRep,
"Part contains no DFM improvement suggestions.");
aRes = true;
}
else if (aBRep == null || !HasShapes(aBRep, ModelData_ShapeType.ModelData_ST_Solid))
{
anErrorMsg = "The part can't be analyzed due to lack of: BRep representation or solids in BRep representation.";
}
}
else if (theProcessData is MTKConverter_WallThicknessData)
{
MTKConverter_WallThicknessData aWTD = (MTKConverter_WallThicknessData)theProcessData;
theWriter.WriteData("process", "Wall Thickness Analysis");
ModelData_BRepRepresentation aBRep = aWTD.myPart.BRepRepresentation();
ModelData_PolyRepresentation aPoly = aWTD.myPart.PolyRepresentation(ModelData_RepresentationMask.ModelData_RM_Any);
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 ((aBRep == null || !HasShapes(aBRep, ModelData_ShapeType.ModelData_ST_Solid)) && aPoly == null)
{
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");
ModelData_BRepRepresentation aBRep = aSMD.myPart.BRepRepresentation();
if (aSMD.myIsSheetMetalPart)
{
WriteFeatures(theWriter, "Feature Recognition", "featureRecognition", aSMD.myFeatureList, aBRep,
"Part contains no features.");
WriteFeatures(theWriter, "Design for Manufacturing", "dfm", aSMD.myIssueList, aBRep,
"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,
anUnfoldedPartData.myBRep, "Unfolded part contains no DFM improvement suggestions.");
}
aRes = true;
}
else if (aBRep == null
|| (!HasShapes(aBRep, ModelData_ShapeType.ModelData_ST_Solid) && !HasShapes(aBRep, ModelData_ShapeType.ModelData_ST_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
{
anErrorMsg = "Unrecognized process";
}
if (!aRes)
{
theWriter.WriteData("error", anErrorMsg);
}
}
}
}
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition: Base_UTF16String.hxx:34
const MTKBase_Hole & Hole() const
Definition: DFMBase_HoleIssue.cxx:51
Describes a base class for issues found during design for manufacturing (DFM) analysis.
Definition: DFMBase_Issue.hxx:32
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm issue.
Definition: DFMBase_Issue.cxx:35
Describes deep bored hole issue found during cnc machining turning design analysis.
Definition: DFMMachining_DeepBoredHoleIssue.hxx:33
double ActualDiameter() const
Definition: DFMMachining_DeepBoredHoleIssue.cxx:131
const ModelData_Shell & Shape() const
Definition: DFMMachining_DeepBoredHoleIssue.cxx:151
double ActualDepth() const
Definition: DFMMachining_DeepBoredHoleIssue.cxx:111
double ExpectedMaxDepth() const
Definition: DFMMachining_DeepBoredHoleIssue.cxx:101
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm deep bored hole issue.
Definition: DFMMachining_DeepBoredHoleIssue.cxx:166
Describes deep hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_DeepHoleIssue.hxx:31
double ExpectedMaxDepth() const
Definition: DFMMachining_DeepHoleIssue.cxx:112
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining deep hole issue.
Definition: DFMMachining_DeepHoleIssue.cxx:127
double ActualDepth() const
Definition: DFMMachining_DeepHoleIssue.cxx:121
double ExpectedMaxDepth() const
Definition: DFMMachining_DeepPocketIssue.cxx:101
const Machining_Pocket & Pocket() const
Definition: DFMMachining_DeepPocketIssue.cxx:128
double ActualDepth() const
Definition: DFMMachining_DeepPocketIssue.cxx:110
Describes a base class for drilling issues found during cnc machining drilling design analysis.
Definition: DFMMachining_DrillingIssue.hxx:37
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining drilling issue.
Definition: DFMMachining_DrillingIssue.cxx:66
Describes flat bottom hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_FlatBottomHoleIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining flat bottom hole issue.
Definition: DFMMachining_FlatBottomHoleIssue.cxx:67
Describes high boss issues found during cnc machining milling design analysis.
Definition: DFMMachining_HighBossIssue.hxx:32
double ActualHeight() const
Definition: DFMMachining_HighBossIssue.cxx:117
double ExpectedMaxHeight() const
Definition: DFMMachining_HighBossIssue.cxx:105
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theIssue is a dfm high boss issue.
Definition: DFMMachining_HighBossIssue.cxx:144
const MTKBase_Boss & Boss() const
Definition: DFMMachining_HighBossIssue.cxx:129
Describes inconsistent radius milled part floor fillet issue found during cnc machining milling desig...
Definition: DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.hxx:32
double ActualRadius() const
Definition: DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:80
const ModelData_Shell & FloorFillet() const
Definition: DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:100
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:115
double ExpectedRadius() const
Definition: DFMMachining_InconsistentRadiusMilledPartFloorFilletIssue.cxx:60
Describes intersecting cavity hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_IntersectingCavityHoleIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining intersecting cavity hole issue.
Definition: DFMMachining_IntersectingCavityHoleIssue.cxx:69
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:69
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm irregular outer diameter profile relief issue.
Definition: DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:125
double ActualFaceInclineAngle() const
Definition: DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:90
const ModelData_Face & Face() const
Definition: DFMMachining_IrregularTurnedPartOuterDiameterProfileReliefIssue.cxx:110
Described the Narrow Pocket maximum to minimum sizes ratio issue found during cnc machining milling d...
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.hxx:34
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:207
double ActualMaxRegionsMaxToMinSizeRatio() const
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:127
const ModelData_Shell & MaxRegionPocketSidewall() const
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:174
const ModelData_Shell & InnerFeature() const
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:156
double ExpectedMaxRegionsMaxToMinSizeRatio() const
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:67
const ModelData_Shell & MinRegionPocketSidewall() const
Definition: DFMMachining_LargeDifferenceRegionsSizeInPocketIssue.cxx:192
Describes large milled part issue found during cnc machining milling design analysis.
Definition: DFMMachining_LargeMilledPartIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining large milled part issue.
Definition: DFMMachining_LargeMilledPartIssue.cxx:106
const DFMMachining_MilledPartSize & ExpectedMaxMilledPartSize() const
Definition: DFMMachining_LargeMilledPartIssue.cxx:73
const DFMMachining_MilledPartSize & ActualMilledPartSize() const
Definition: DFMMachining_LargeMilledPartIssue.cxx:91
Describes large turned part issue found during cnc machining turning design analysis.
Definition: DFMMachining_LargeTurnedPartIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining large turned part issue.
Definition: DFMMachining_LargeTurnedPartIssue.cxx:105
const DFMMachining_TurnedPartSize & ExpectedMaxTurnedPartSize() const
Definition: DFMMachining_LargeTurnedPartIssue.cxx:72
const DFMMachining_TurnedPartSize & ActualTurnedPartSize() const
Definition: DFMMachining_LargeTurnedPartIssue.cxx:90
Describes long-slender turned part issue found during cnc machining turning design analysis.
Definition: DFMMachining_LongSlenderTurnedPartIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining long-slender turned part issue.
Definition: DFMMachining_LongSlenderTurnedPartIssue.cxx:147
double ActualLength() const
Definition: DFMMachining_LongSlenderTurnedPartIssue.cxx:110
double ExpectedMaxLength() const
Definition: DFMMachining_LongSlenderTurnedPartIssue.cxx:101
double ActualMinDiameter() const
Definition: DFMMachining_LongSlenderTurnedPartIssue.cxx:130
Describes external edge fillet issue found during cnc machining milling design analysis.
Definition: DFMMachining_MilledPartExternalEdgeFilletIssue.hxx:32
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm milled part external edge fillet issue.
Definition: DFMMachining_MilledPartExternalEdgeFilletIssue.cxx:75
const ModelData_Shell & Fillet() const
Definition: DFMMachining_MilledPartExternalEdgeFilletIssue.cxx:60
Describes milled part size used in cnc machining milling design analysis.
Definition: DFMMachining_MilledPartSize.hxx:37
double Width() const
Definition: DFMMachining_MilledPartSize.cxx:60
double Length() const
Definition: DFMMachining_MilledPartSize.cxx:80
double Height() const
Definition: DFMMachining_MilledPartSize.cxx:100
Describes a base class for milling issues found during cnc machining milling design analysis.
Definition: DFMMachining_MillingIssue.hxx:35
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:32
const ModelData_Shell & NarrowRegionSidewall() const
Definition: DFMMachining_NarrowRegionInPocketIssue.cxx:143
double ActualRegionSize() const
Definition: DFMMachining_NarrowRegionInPocketIssue.cxx:87
double ExpectedMinRegionSize() const
Definition: DFMMachining_NarrowRegionInPocketIssue.cxx:67
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm narrow regions distance issue.
Definition: DFMMachining_NarrowRegionInPocketIssue.cxx:158
const ModelData_Shell & InnerFeature() const
Definition: DFMMachining_NarrowRegionInPocketIssue.cxx:125
Describes non perpendicular hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_NonPerpendicularHoleIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non perpendicular hole issue.
Definition: DFMMachining_NonPerpendicularHoleIssue.cxx:65
Describes non perpendicular milled part shape issue found during cnc machining milling design analysi...
Definition: DFMMachining_NonPerpendicularMilledPartShapeIssue.hxx:32
double ActualAngle() const
Definition: DFMMachining_NonPerpendicularMilledPartShapeIssue.cxx:59
const ModelData_Shell & Shape() const
Definition: DFMMachining_NonPerpendicularMilledPartShapeIssue.cxx:79
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:94
Describes non standard diameter hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_NonStandardDiameterHoleIssue.hxx:31
double NearestStandardDiameter() const
Definition: DFMMachining_NonStandardDiameterHoleIssue.cxx:72
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining non standard diameter hole issue.
Definition: DFMMachining_NonStandardDiameterHoleIssue.cxx:98
double ActualDiameter() const
Definition: DFMMachining_NonStandardDiameterHoleIssue.cxx:92
Describes non standard drill point angle blind hole issues found during cnc machining drilling design...
Definition: DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.hxx:31
double NearestStandardAngle() const
Definition: DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.cxx:70
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:108
double ActualAngle() const
Definition: DFMMachining_NonStandardDrillPointAngleBlindHoleIssue.cxx:91
Describes non standard radius milled part floor fillet issue found during cnc machining milling desig...
Definition: DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.hxx:32
double NearestStandardRadius() const
Definition: DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:59
double ActualRadius() const
Definition: DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:79
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:114
const ModelData_Shell & FloorFillet() const
Definition: DFMMachining_NonStandardRadiusMilledPartFloorFilletIssue.cxx:99
Describes asymmetric axial slot issue found during cnc machining turning design analysis.
Definition: DFMMachining_NonSymmetricalAxialSlotIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a non-symmetrical axial slot issue.
Definition: DFMMachining_NonSymmetricalAxialSlotIssue.cxx:84
const Machining_Pocket & AxialSlot() const
Definition: DFMMachining_NonSymmetricalAxialSlotIssue.cxx:69
Describes partial hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_PartialHoleIssue.hxx:31
double ActualMaterialPercent() const
Definition: DFMMachining_PartialHoleIssue.cxx:99
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining partial hole issue.
Definition: DFMMachining_PartialHoleIssue.cxx:116
double ExpectedMinMaterialPercent() const
Definition: DFMMachining_PartialHoleIssue.cxx:79
Describes small depth blind bored hole relief found during cnc machining turning design analysis.
Definition: DFMMachining_SmallDepthBlindBoredHoleReliefIssue.hxx:33
double ActualDiameter() const
Definition: DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:135
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:170
double ExpectedMinReliefDepth() const
Definition: DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:105
const ModelData_Shell & BlindBoredHole() const
Definition: DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:155
double ActualReliefDepth() const
Definition: DFMMachining_SmallDepthBlindBoredHoleReliefIssue.cxx:115
Describes small diameter hole issues found during cnc machining drilling design analysis.
Definition: DFMMachining_SmallDiameterHoleIssue.hxx:31
double ActualDiameter() const
Definition: DFMMachining_SmallDiameterHoleIssue.cxx:100
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm machining small diameter hole issue.
Definition: DFMMachining_SmallDiameterHoleIssue.cxx:106
double ExpectedMinDiameter() const
Definition: DFMMachining_SmallDiameterHoleIssue.cxx:80
Describes internal corner radius issues found during cnc machining milling design analysis.
Definition: DFMMachining_SmallRadiusMilledPartInternalCornerIssue.hxx:32
double ExpectedMinRadius() const
Definition: DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:103
const ModelData_Shell & Shape() const
Definition: DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:155
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:170
double ActualRadius() const
Definition: DFMMachining_SmallRadiusMilledPartInternalCornerIssue.cxx:113
Describes internal corner radius issues found during cnc machining turning design analysis.
Definition: DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.hxx:33
double ActualRadius() const
Definition: DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:89
double ExpectedMinRadius() const
Definition: DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:69
const ModelData_Shell & Shape() const
Definition: DFMMachining_SmallRadiusTurnedPartInternalCornerIssue.cxx:111
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:126
Describes square form keyway issue found during cnc machining turning design analysis.
Definition: DFMMachining_SquareEndKeywayIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm square-end keyway issue.
Definition: DFMMachining_SquareEndKeywayIssue.cxx:86
const Machining_Pocket & Keyway() const
Definition: DFMMachining_SquareEndKeywayIssue.cxx:71
Describes turned part size used in cnc machining turning design analysis.
Definition: DFMMachining_TurnedPartSize.hxx:37
double Radius() const
Definition: DFMMachining_TurnedPartSize.cxx:62
double Length() const
Definition: DFMMachining_TurnedPartSize.cxx:82
Describes a base class for bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_BendIssue.hxx:37
const SheetMetal_Bend & Bend() const
Definition: DFMSheetMetal_BendIssue.cxx:54
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal bend issue.
Definition: DFMSheetMetal_BendIssue.cxx:89
const ModelData_Face & SecondFace() const
Definition: DFMSheetMetal_FlatPatternInterferenceIssue.cxx:91
const ModelData_Face & FirstFace() const
Definition: DFMSheetMetal_FlatPatternInterferenceIssue.cxx:73
Describes a base class for hole issues found during sheet metal design analysis.
Definition: DFMSheetMetal_HoleIssue.hxx:37
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal hole issue.
Definition: DFMSheetMetal_HoleIssue.cxx:79
Describes inconsistent radius bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_InconsistentRadiusBendIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal inconsistent radius bend issue.
Definition: DFMSheetMetal_InconsistentRadiusBendIssue.cxx:99
double ActualRadius() const
Returns the actual bend radius in mm .
Definition: DFMSheetMetal_InconsistentRadiusBendIssue.cxx:93
double ExpectedRadius() const
Definition: DFMSheetMetal_InconsistentRadiusBendIssue.cxx:76
Describes irregular notch corner fillet radius issue found during sheet metal design analysis.
Definition: DFMSheetMetal_IrregularCornerFilletRadiusNotchIssue.hxx:34
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:33
double ActualExtrudedHeight() const
Definition: DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:172
double ExpectedMinExtrudedHeight() const
Definition: DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:143
double ExpectedMaxExtrudedHeight() const
Definition: DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:163
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a irregular depth extruded hole issue.
Definition: DFMSheetMetal_IrregularDepthExtrudedHoleIssue.cxx:178
Describes irregular open hem bend radius issue found during sheet metal design analysis.
Definition: DFMSheetMetal_IrregularRadiusOpenHemBendIssue.hxx:33
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:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal irregular size bend relief issue.
Definition: DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:155
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:144
SheetMetal_BendRelief ExpectedMinBendRelief() const
Definition: DFMSheetMetal_IrregularSizeBendReliefIssue.cxx:124
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:133
Describes irregular size notch issues found during sheet metal design analysis.
Definition: DFMSheetMetal_IrregularSizeNotchIssue.hxx:34
double ActualLength() const
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:188
double ExpectedLength() const
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:150
double ExpectedWidth() const
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:131
const SheetMetal_Notch & Notch() const
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:83
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal irregular size notch issue.
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:194
double ActualWidth() const
Definition: DFMSheetMetal_IrregularSizeNotchIssue.cxx:179
Describes irregular size tab issues found during sheet metal design analysis.
Definition: DFMSheetMetal_IrregularSizeTabIssue.hxx:34
const SheetMetal_Tab & Tab() const
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:83
double ExpectedWidth() const
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:131
double ExpectedLength() const
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:150
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal irregular size tab issue.
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:194
double ActualLength() const
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:188
double ActualWidth() const
Definition: DFMSheetMetal_IrregularSizeTabIssue.cxx:179
Describes large depth bead issue found during sheet metal design analysis.
Definition: DFMSheetMetal_LargeDepthBeadIssue.hxx:33
const SheetMetal_Bead & Bead() const
Definition: DFMSheetMetal_LargeDepthBeadIssue.cxx:79
double ExpectedMaxDepth() const
Definition: DFMSheetMetal_LargeDepthBeadIssue.cxx:128
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a large depth bead issue.
Definition: DFMSheetMetal_LargeDepthBeadIssue.cxx:163
double ActualDepth() const
Definition: DFMSheetMetal_LargeDepthBeadIssue.cxx:137
const DFMSheetMetal_SheetSize & ActualSheetSize() const
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.cxx:87
const DFMSheetMetal_SheetSize & NearestStandardSheetSize() const
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.cxx:69
double NearestStandardSheetThickness() const
Definition: DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:70
double ActualSheetThickness() const
Definition: DFMSheetMetal_NonStandardSheetThicknessIssue.cxx:90
Describes sheet size of flat pattern used in DFM analysis.
Definition: DFMSheetMetal_SheetSize.hxx:37
double Width() const
Definition: DFMSheetMetal_SheetSize.cxx:57
double Length() const
Definition: DFMSheetMetal_SheetSize.cxx:77
Describes small depth louver issue found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDepthLouverIssue.hxx:33
double ExpectedMinDepth() const
Definition: DFMSheetMetal_SmallDepthLouverIssue.cxx:128
double ActualDepth() const
Definition: DFMSheetMetal_SmallDepthLouverIssue.cxx:137
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small depth louver issue.
Definition: DFMSheetMetal_SmallDepthLouverIssue.cxx:163
const SheetMetal_Louver & Louver() const
Definition: DFMSheetMetal_SmallDepthLouverIssue.cxx:79
Describes small diameter hole issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDiameterHoleIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal small hole issue.
Definition: DFMSheetMetal_SmallDiameterHoleIssue.cxx:128
double ExpectedMinDiameter() const
Definition: DFMSheetMetal_SmallDiameterHoleIssue.cxx:113
double ActualDiameter() const
Definition: DFMSheetMetal_SmallDiameterHoleIssue.cxx:122
Describes small distance between bend and louver issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.hxx:34
SheetMetal_Bend Bend() const
Definition: DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:88
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between bend and louver issue.
Definition: DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:129
SheetMetal_Louver Louver() const
Definition: DFMSheetMetal_SmallDistanceBetweenBendAndLouverIssue.cxx:110
Describes small distance between complex hole and bend issues found during sheet metal design analysi...
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.hxx:34
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:130
SheetMetal_ComplexHole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.cxx:89
SheetMetal_Bend Bend() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndBendIssue.cxx:111
Describes small distance detween extruded hole and edge issues found during sheet metal design analys...
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.hxx:34
SheetMetal_ComplexHole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.cxx:92
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:137
ModelData_Edge Edge() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.cxx:114
Describes small distance between extruded holes issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.hxx:33
SheetMetal_ComplexHole SecondHole() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:112
SheetMetal_ComplexHole FirstHole() const
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:90
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between extruded holes issue.
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.cxx:131
Describes a base class for small distance issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.hxx:37
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a dfm sheet metal small distance issue.
Definition: DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:189
double ExpectedMinDistanceBetweenFeatures() const
Definition: DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:106
double ActualDistanceBetweenFeatures() const
Definition: DFMSheetMetal_SmallDistanceBetweenFeaturesIssue.cxx:116
Describes small distance between hole and bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.hxx:34
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and bend issue.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:130
SheetMetal_Bend Bend() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:111
SheetMetal_Hole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndBendIssue.cxx:89
Describes small distance between hole and cutout issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.hxx:34
SheetMetal_Cutout Cutout() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:111
SheetMetal_Hole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:89
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and cutout issue.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.cxx:130
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:138
ModelData_Edge Edge() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.cxx:115
SheetMetal_Hole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndEdgeIssue.cxx:93
Describes small distance between hole and louver issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.hxx:34
SheetMetal_Hole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:85
SheetMetal_Louver Louver() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:107
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and louver issue.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.cxx:126
Describes small distance detween hole and notch issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.hxx:34
SheetMetal_Hole Hole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:90
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between hole and notch issue.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:131
SheetMetal_Notch Notch() const
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndNotchIssue.cxx:112
Describes small distance detween holes issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHolesIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between holes issue.
Definition: DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:131
SheetMetal_Hole FirstHole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:90
SheetMetal_Hole SecondHole() const
Definition: DFMSheetMetal_SmallDistanceBetweenHolesIssue.cxx:112
Describes small distance detween notch and bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.hxx:34
SheetMetal_Bend Bend() const
Definition: DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:109
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between notch and bend issue.
Definition: DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:128
SheetMetal_Notch Notch() const
Definition: DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.cxx:87
Describes small distance between notches issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenNotchesIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between notches issue.
Definition: DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:125
SheetMetal_Notch FirstNotch() const
Definition: DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:84
SheetMetal_Notch SecondNotch() const
Definition: DFMSheetMetal_SmallDistanceBetweenNotchesIssue.cxx:106
Describes small distance between tabs issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenTabsIssue.hxx:33
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small distance between tabs issue.
Definition: DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:127
SheetMetal_Tab SecondTab() const
Definition: DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:108
SheetMetal_Tab FirstTab() const
Definition: DFMSheetMetal_SmallDistanceBetweenTabsIssue.cxx:86
Describes small length flange issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallLengthFlangeIssue.hxx:34
const MTKBase_CompositeFeature & Flange() const
Definition: DFMSheetMetal_SmallLengthFlangeIssue.cxx:112
double ActualLength() const
Definition: DFMSheetMetal_SmallLengthFlangeIssue.cxx:181
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small length flange issue.
Definition: DFMSheetMetal_SmallLengthFlangeIssue.cxx:198
double ExpectedMinLength() const
Definition: DFMSheetMetal_SmallLengthFlangeIssue.cxx:172
Describes small length hem bend flange issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallLengthHemBendFlangeIssue.hxx:33
double ExpectedMinLength() const
Definition: DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:181
const MTKBase_CompositeFeature & Flange() const
Definition: DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:122
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a small length hem bend flange issue.
Definition: DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:207
double ActualLength() const
Definition: DFMSheetMetal_SmallLengthHemBendFlangeIssue.cxx:190
Describes small radius bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallRadiusBendIssue.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a dfm sheet metal small radius bend issue.
Definition: DFMSheetMetal_SmallRadiusBendIssue.cxx:130
double ExpectedMinRadius() const
Definition: DFMSheetMetal_SmallRadiusBendIssue.cxx:115
double ActualRadius() const
Definition: DFMSheetMetal_SmallRadiusBendIssue.cxx:124
Describes a boss. In CNC Machining a boss is a protrusion or raised area on a workpiece that is creat...
Definition: MTKBase_Boss.hxx:27
double Length() const
Definition: MTKBase_Boss.cxx:89
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a Boss.
Definition: MTKBase_Boss.cxx:126
double Width() const
Definition: MTKBase_Boss.cxx:69
double Height() const
Definition: MTKBase_Boss.cxx:109
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:94
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a composite feature.
Definition: MTKBase_CompositeFeature.cxx:100
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:53
const ModelData_Axis3Placement & Axis() const
Definition: MTKBase_Hole.cxx:127
double Depth() const
Definition: MTKBase_Hole.cxx:98
double Radius() const
Definition: MTKBase_Hole.cxx:78
Describes a feature with assigned shape.
Definition: MTKBase_ShapeFeature.hxx:34
const ModelData_Shape & Shape() const
Definition: MTKBase_ShapeFeature.cxx:62
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a shape feature.
Definition: MTKBase_ShapeFeature.cxx:77
Describes a machining countersink.
Definition: Machining_Countersink.hxx:33
double Radius() const
Definition: Machining_Countersink.cxx:83
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a machining countersink.
Definition: Machining_Countersink.cxx:147
const ModelData_Axis3Placement & Axis() const
Definition: Machining_Countersink.cxx:132
double Depth() const
Definition: Machining_Countersink.cxx:103
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:231
Machining_FaceType Type() const
Definition: Machining_Face.cxx:216
Describes a machining hole of a specified type. Hole is a cylindrical feature that can be made by cut...
Definition: Machining_Hole.hxx:32
Machining_HoleType Type() const
Definition: Machining_Hole.cxx:142
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a machining hole.
Definition: Machining_Hole.cxx:157
Describes a machining pocket. A pocket is a feature obtained by milling the material inside an arbitr...
Definition: Machining_Pocket.hxx:32
double Width() const
Definition: Machining_Pocket.cxx:69
double Depth() const
Definition: Machining_Pocket.cxx:109
const ModelData_Axis1Placement & Axis() const
Definition: Machining_Pocket.cxx:138
static bool CompareType(const MTKBase_Feature &theFeature)
Returnstrue if theFeature is a machining Pocket.
Definition: Machining_Pocket.cxx:153
double Length() const
Definition: Machining_Pocket.cxx:89
Describes a face with radius produced by a specified machining operation. Cutting material from workp...
Definition: Machining_TurningFace.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a machining turning face.
Definition: Machining_TurningFace.cxx:87
double Radius() const
Definition: Machining_TurningFace.cxx:70
const ModelData_Direction & Direction() const
Returns a direction value.
Definition: ModelData_Axis1Placement.cxx:75
const ModelData_Direction & Axis() const
Returns a Z-direction of the axis placement.
Definition: ModelData_Axis3Placement.cxx:90
int ShapeId(const ModelData_Shape &theShape) const
Returns an Id of B-Rep shape.
Definition: ModelData_BRepRepresentation.cxx:1021
const ModelData_BodyList & Get() const
Returns an associated topological object.
Definition: ModelData_BRepRepresentation.cxx:626
Defines a 3D direction.
Definition: ModelData_Direction.hxx:180
Defines polygonal (faceted or tessellated) representation of part.
Definition: ModelData_PolyRepresentation.hxx:39
Describes a sheet metal bead.
Definition: SheetMetal_Bead.hxx:31
double Depth() const
Definition: SheetMetal_Bead.cxx:68
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a bead.
Definition: SheetMetal_Bead.cxx:85
Describes a bend in sheet metal.
Definition: SheetMetal_Bend.hxx:35
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:38
bool IsNull() const
Returns true if the object is null.
Definition: SheetMetal_BendRelief.cxx:124
double Length() const
Definition: SheetMetal_BendRelief.cxx:87
const ModelData_Shape & Shape() const
Definition: SheetMetal_BendRelief.cxx:107
double Width() const
Definition: SheetMetal_BendRelief.cxx:67
Describes a sheet metal bridge feature.
Definition: SheetMetal_Bridge.hxx:31
double Depth() const
Definition: SheetMetal_Bridge.cxx:72
double Length() const
Definition: SheetMetal_Bridge.cxx:92
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a bridge.
Definition: SheetMetal_Bridge.cxx:109
Describes a sheet metal complex hole feature.
Definition: SheetMetal_ComplexHole.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a sheet metal complex hole.
Definition: SheetMetal_ComplexHole.cxx:77
Describes a sheet metal curved bend feature.
Definition: SheetMetal_CurvedBend.hxx:31
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is an curved bend.
Definition: SheetMetal_CurvedBend.cxx:59
Describes a cutout in sheet metal.
Definition: SheetMetal_Cutout.hxx:31
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:140
double Perimeter() const
Returns perimeter of the unfolded model in mm .
Definition: SheetMetal_FlatPattern.cxx:158
double Thickness() const
Returns thickness of the unfolded model in mm .
Definition: SheetMetal_FlatPattern.cxx:152
double Width() const
Returns width of the unfolded model in mm .
Definition: SheetMetal_FlatPattern.cxx:146
Describes a sheet metal Hem bend feature.
Definition: SheetMetal_HemBend.hxx:32
SheetMetal_HemBendType Type() const
Definition: SheetMetal_HemBend.cxx:133
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is an hem bend.
Definition: SheetMetal_HemBend.cxx:148
Describes a circle hole drilled or punched in sheet metal.
Definition: SheetMetal_Hole.hxx:35
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a sheet metal hole.
Definition: SheetMetal_Hole.cxx:74
Describes a sheet metal louver feature.
Definition: SheetMetal_Louver.hxx:31
double Depth() const
Definition: SheetMetal_Louver.cxx:69
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a louver.
Definition: SheetMetal_Louver.cxx:86
Describes a sheet metal notch.
Definition: SheetMetal_Notch.hxx:35
double Length() const
Definition: SheetMetal_Notch.cxx:92
double Width() const
Definition: SheetMetal_Notch.cxx:72
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a notch.
Definition: SheetMetal_Notch.cxx:129
Describes a sheet metal straight notch.
Definition: SheetMetal_StraightNotch.hxx:31
double CornerFilletRadius() const
Definition: SheetMetal_StraightNotch.cxx:67
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a straight notch.
Definition: SheetMetal_StraightNotch.cxx:86
Describes a sheet metal tab.
Definition: SheetMetal_Tab.hxx:31
double Width() const
Definition: SheetMetal_Tab.cxx:71
double Length() const
Definition: SheetMetal_Tab.cxx:91
static bool CompareType(const MTKBase_Feature &theFeature)
Returns true if theFeature is a tab.
Definition: SheetMetal_Tab.cxx:108
Describes a sheet metal V-notch.
Definition: SheetMetal_VNotch.hxx:31
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
Machining_HoleType
Defines a hole type in machining.
Definition: Machining_HoleType.hxx:29
Machining_FaceType
Describes a face produced by a specified machining operation.
Definition: Machining_FaceType.hxx:29
SheetMetal_HemBendType
Defines a hem bend type in sheet metal.
Definition: SheetMetal_HemBendType.hxx:29

MTKConverter_Application.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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
{
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_SheetMetal
}
//parse and execute command line
enum Mode { NeutralMode, ImportMode, ProcessMode, ExportMode }
class MTKConverter_Application
{
public MTKConverter_Application()
{
myCDXWEBWriterParameters = new ModelData_WriterParameters();
//setup CDXWEB params
myCDXWEBWriterParameters.SetFileFormat(ModelData_WriterParameters.FileFormatType.CDXWEB);
myCDXWEBWriterParameters.SetWriteBRepRepresentation(true);
myCDXWEBWriterParameters.SetWritePolyRepresentation(true);
myCDXWEBWriterParameters.SetPreferredLOD(ModelData_RepresentationMask.ModelData_RM_Any);
myCDXWEBWriterParameters.SetWriteTextures(true);
myCDXWEBWriterParameters.SetWritePMI(true);
}
public ModelData_WriterParameters myCDXWEBWriterParameters;
public MTKConverter_ReturnCode Run (string[] args)
{
if (args.Length == 1 ||
(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;
}
ModelData_Model aProcessModel = new ModelData_Model();
Mode aMode = Mode.NeutralMode;
MTKConverter_Report aReport = new MTKConverter_Report();
Base_Settings.Default().SetValue(Base_Settings.Id.UseExceptions, true);
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, myCDXWEBWriterParameters, 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.");
}
{
Console.WriteLine($"Failed.\nERROR: {anE.What()}");
return MTKConverter_ReturnCode.MTKConverter_RC_UnsupportedVersion;
}
{
Console.WriteLine($"Failed.\nERROR: {anE.What()}");
return MTKConverter_ReturnCode.MTKConverter_RC_UnexpectedFormat;
}
{
Console.WriteLine($"Failed.\nERROR: {anE.What()}");
return MTKConverter_ReturnCode.MTKConverter_RC_UnsupportedFileVariant;
}
catch(Base_Exception anE)
{
Console.WriteLine($"Failed.\nERROR: {anE.What()}");
return MTKConverter_ReturnCode.MTKConverter_RC_GeneralException;
}
catch
{
Console.WriteLine("Failed.\nERROR: Unhandled exception caught.");
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(" 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},
{ "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, ModelData_Model theModel)
{
Base_UTF16String aFilePath = new Base_UTF16String(theFilePath);
Console.Write($"Importing {theFilePath}...");
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 bool CreateOriginModelThumbnail(Base_UTF16String theFilePath, ModelData_Model theModel)
{
// Setup offscreen viewport with transparent background and perspective camera
aViewPort.Resize(800, 600);
aViewPort.SetCameraProjectionType(ModelPrs_CameraProjectionType.ModelPrs_CPT_Perspective);
aViewPort.SetCameraPositionType(ModelPrs_CameraPositionType.ModelPrs_CMT_Default);
ModelData_Color aBackgroundColor = new ModelData_Color(0x00000000);
ModelPrs_BackgroundStyle aStyle = new ModelPrs_BackgroundStyle(aBackgroundColor);
aViewPort.SetBackgroundStyle(aStyle);
// Create scene and display all entities
ModelPrs_SceneNode aRootNode = aFactory.CreateGraph(theModel, ModelData_RepresentationMask.ModelData_RM_Any);
aRootNode.SetDisplayMode(ModelPrs_DisplayMode.ModelPrs_DM_ShadedWithBoundaries);
aScene.AddRoot(aRootNode);
// Attach viewport to the scene.
if (!aViewPort.AttachToScene(aScene))
{
aScene.Dispose();
return false;
}
// Apply scene changes to viewport and wait until all async operations will be finished
aScene.Update();
aScene.Wait();
// Fit and center model on the image
aViewPort.FitAll();
// Save image
bool aRes = aViewPort.GrabToImage(theFilePath);
aScene.Dispose();
return aRes;
}
private void ApplyProcessorToModel(ModelData_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, ModelData_Model theModel,
MTKConverter_Report theReport, ModelData_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_SheetMetal:
{
Base_UTF16String aProcessModelName = new Base_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, ModelData_WriterParameters theWriterParams,
ModelData_Model theModel, MTKConverter_Report theReport, ModelData_Model theProcessModel)
{
Console.Write($"Exporting {theFolderPath}...");
Base_UTF16String aModelPath = new Base_UTF16String(theFolderPath + "/" + theModel.Name() + ".cdxweb" + "/scenegraph.cdxweb");
if (!theModel.Save(aModelPath, theWriterParams))
{
Console.WriteLine($"\nERROR: Failed to export {aModelPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
Base_UTF16String aThumbnailPath = new Base_UTF16String(theFolderPath + "/thumbnail.png");
if (!CreateOriginModelThumbnail(aThumbnailPath, theModel))
{
Console.WriteLine($"\nERROR: Failed to create thumbnail {aThumbnailPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
if (!theProcessModel.IsEmpty())
{
Base_UTF16String aProcessModelPath = new Base_UTF16String(theFolderPath + "/" + theProcessModel.Name() + ".cdxweb" + "/scenegraph.cdxweb");
if (!theProcessModel.Save(aProcessModelPath, theWriterParams))
{
Console.WriteLine($"\nERROR: Failed to export {aProcessModelPath}. Exiting");
return MTKConverter_ReturnCode.MTKConverter_RC_ExportError;
}
}
Base_UTF16String aJsonPath = new Base_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;
}
}
}
Abstract base class for exceptions thrown from CAD Exchanger.
Definition: Base_Exception.hxx:34
The Base_Settings class defines a container of global CAD Exchanger parameters.
Definition: Base_Settings.hxx:33
static const std::shared_ptr< Base_Settings > & Default()
Returns global settings object.
Definition: Base_Settings.cxx:541
Id
Describes values used to identify CAD Exchanger settings.
Definition: Base_Settings.hxx:36
Indicates that a file's format doesn't match the reader.
Definition: BaseError_UnexpectedFormat.hxx:29
Indicates that a file's variant doesn't match the variants, that reader supports.
Definition: BaseError_UnsupportedFileVariant.hxx:28
Indicates that a file of unsupported version was imported.
Definition: BaseError_UnsupportedVersion.hxx:27
Defines an RGBA color (with alpha channel).
Definition: ModelData_Color.hxx:34
bool Save(const Base_UTF16String &theFileName, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus()) const
Definition: ModelData_Model.cxx:527
const Base_UTF16String & Name() const
Returns a model name.
Definition: ModelData_Model.cxx:358
void AssignUuids()
Definition: ModelData_Model.cxx:820
bool IsEmpty() const
Returns true if the model is empty.
Definition: ModelData_Model.cxx:812
void SetName(const Base_UTF16String &theName)
Sets a model name.
Definition: ModelData_Model.cxx:349
void Accept(ElementVisitor &theVisitor) const
Accepts a visitor.
Definition: ModelData_Model.cxx:882
Reads any format that CAD Exchanger can import.
Definition: ModelData_ModelReader.hxx:33
bool Read(const Base_UTF16String &theFilePath, ModelData_Model &theModel)
Reads the file at the specified path into the specified model.
Definition: ModelData_ModelReader.cxx:182
Defines a visitor that visits each unique element only once.
Definition: ModelData_SceneGraphElementUniqueVisitor.hxx:33
Defines parameters used by the ModelData_Model::Save() function.
Definition: ModelData_WriterParameters.hxx:27
FileFormatType
Definition: ModelData_WriterParameters.hxx:30
Defines background style.
Definition: ModelPrs_BackgroundStyle.hxx:32
Defines a viewport without any visible window (frame).
Definition: ModelPrs_OffscreenViewPort.hxx:50
void SetBackgroundStyle(const ModelPrs_BackgroundStyle &theStyle)
Sets a background style.
Definition: ModelPrs_OffscreenViewPort.cxx:326
void SetCameraProjectionType(ModelPrs_CameraProjectionType theProjectionType)
Sets a camera projection type.
Definition: ModelPrs_OffscreenViewPort.cxx:378
void Resize(unsigned int theWidth, unsigned int theHeight)
Resizes ViewPort.
Definition: ModelPrs_OffscreenViewPort.cxx:264
bool AttachToScene(const ModelPrs_Scene &theScene)
Attaches to ModelPrs_Scene.
Definition: ModelPrs_OffscreenViewPort.cxx:257
void FitAll()
Fit content to ViewPort size.
Definition: ModelPrs_OffscreenViewPort.cxx:300
bool GrabToImage(const Base_UTF16String &thePath) const
Grab to image in specified thePath.
Definition: ModelPrs_OffscreenViewPort.cxx:285
void SetCameraPositionType(ModelPrs_CameraPositionType thePositionType)
Sets a camera position type.
Definition: ModelPrs_OffscreenViewPort.cxx:384
Provides CAD Exchanger visualization structure.
Definition: ModelPrs_Scene.hxx:39
void AddRoot(ModelPrs_SceneNode &theNode)
Adds a root scene node.
Definition: ModelPrs_Scene.cxx:138
void Wait()
Waiting until all changes are applied by Update method.
Definition: ModelPrs_Scene.cxx:207
void Update(const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus())
Applies changes of attached Scene Nodes.
Definition: ModelPrs_Scene.cxx:188
Creates a scene nodes and its children from input data model objects.
Definition: ModelPrs_SceneNodeFactory.hxx:53
ModelPrs_SceneNode CreateGraph(const ModelData_Model &theModel, ModelData_RepresentationMask theRepresentationMask)
Creates scene graph using ModelData_Model.
Definition: ModelPrs_SceneNodeFactory.cxx:735
Represents a node in the visual scene graph.
Definition: ModelPrs_SceneNode.hxx:44
void SetDisplayMode(ModelPrs_DisplayMode theMode)
Sets theMode as display mode.
Definition: ModelPrs_SceneNode.cxx:860
ModelPrs_CameraProjectionType
Defines a camera projection type.
Definition: ModelPrs_CameraProjectionType.hxx:25
ModelPrs_DisplayMode
Defines a display mode of visual objects presented by ModelPrs_SceneNode.
Definition: ModelPrs_DisplayMode.hxx:29
ModelPrs_CameraPositionType
Defines a direction where the camera is located.
Definition: ModelPrs_CameraPositionType.hxx:25

Program.cs

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger 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)
{
// Add runtime path to CAD Exchanger libraries
cadex.helpers.LoadLibrarySearchDirectory.SetupDllDirectory();
string aKey = LicenseKey.Value();
string anMTKKey = MTKLicenseKey.Value();
// Activate the license (aKey must be defined in cadex_license.cs
// and anMTKKey should be defined in mtk_license.cs)
if (!LicenseManager.Activate(aKey))
{
Console.WriteLine("Failed to activate CAD Exchanger license.");
return 1;
}
if (!LicenseManager.Activate(anMTKKey))
{
Console.WriteLine("Failed to activate Manufacturing Toolkit license.");
return 1;
}
MTKConverter_Application anApp = new MTKConverter_Application();
return (int)anApp.Run(args);
}
}
}