Hide menu
Loading...
Searching...
No Matches
sheet_metal/dfm_analyzer/Program.cs

Refer to the Sheet Metal DFM Analyzer Example

feature_group.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 FeatureMapType = System.Collections.Generic.SortedDictionary<cadex.MTKBase_Feature, uint>;
namespace feature_group
{
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;
}
}
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() => $"{First} x {Second}";
}
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() => $"{L} x {W} x {D}";
}
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);
}
}
class FeatureGroupManager
{
public FeatureGroupManager()
{
myGroups = new List<FeatureGroup>();
}
private class FeatureGroup
{
public FeatureGroup(string theName, string theSubgroupName, bool theHasParameters)
{
myName = theName;
mySubgroupName = theSubgroupName;
myHasParameters = theHasParameters;
myFeatureSubgroups = new FeatureMapType(new FeatureComparer());
}
public uint FeatureCount()
{
uint aCount = 0;
foreach (var i in myFeatureSubgroups)
{
aCount += i.Value;
}
return aCount;
}
public string myName;
public string mySubgroupName;
public bool myHasParameters;
public FeatureMapType myFeatureSubgroups;
}
private class FeatureGroupComparer : IComparer<FeatureGroup>
{
public int Compare(FeatureGroup theA, FeatureGroup theB)
{
string anAName = theA.myName;
string aBName = theB.myName;
if (anAName == aBName)
{
return 0;
}
FeatureMapType anAFeatureSubgroups = theA.myFeatureSubgroups;
FeatureMapType aBFeatureSubgroups = theB.myFeatureSubgroups;
if (anAFeatureSubgroups.Count == 0 || aBFeatureSubgroups.Count == 0)
{
return anAName.CompareTo(aBName);
}
MTKBase_Feature anAFeature = new MTKBase_Feature();
MTKBase_Feature aBFeature = new MTKBase_Feature();
foreach (var i in anAFeatureSubgroups)
{
anAFeature = i.Key;
break;
}
foreach (var i in aBFeatureSubgroups)
{
aBFeature = i.Key;
break;
}
FeatureComparer aFeatureComparator = new FeatureComparer();
return aFeatureComparator.Compare(anAFeature, aBFeature);
}
}
private List<FeatureGroup> myGroups;
public void AddFeature(string theGroupName, string theSubgroupName, bool theHasParameters, MTKBase_Feature theFeature)
{
//find or create
int aRes = myGroups.FindIndex(theGroup => theGroup.myName == theGroupName);
if (aRes == -1)
{
myGroups.Add(new FeatureGroup(theGroupName, theSubgroupName, theHasParameters));
aRes = myGroups.Count - 1;
}
//update
FeatureGroup aGroup = myGroups[aRes];
FeatureMapType aSubgroups = aGroup.myFeatureSubgroups;
if (aSubgroups.ContainsKey(theFeature))
{
++aSubgroups[theFeature];
}
else
{
aSubgroups[theFeature] = 1;
}
}
public void Print(string theFeatureType, Action<MTKBase_Feature> thePrintFeatureParameters)
{
myGroups.Sort(new FeatureGroupComparer());
uint aTotalCount = 0;
foreach (var i in myGroups)
{
uint aFeatureCount = i.FeatureCount();
aTotalCount += aFeatureCount;
Console.WriteLine($" {i.myName}: {aFeatureCount}");
if (!i.myHasParameters)
{
continue;
}
string aSubgroupName = i.mySubgroupName;
foreach (var j in i.myFeatureSubgroups)
{
Console.WriteLine($" {j.Value} {aSubgroupName} with");
thePrintFeatureParameters(j.Key);
}
}
Console.WriteLine($"\n Total {theFeatureType}: {aTotalCount}\n");
}
public static void PrintFeatureParameter<T>(string theName, T theValue, string theUnits)
{
Console.WriteLine($" {theName}: {theValue} {theUnits}");
}
}
}
Provides possibility to compare MTK based features depending on their type and parameters.
Definition: MTKBase_FeatureComparator.hxx:29
Describes a base class of MTK based features.
Definition: MTKBase_Feature.hxx:34
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22

shape_processor.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 shape_processor
{
abstract class ShapeProcessor : ModelData_Model.VoidElementVisitor
{
public override void Apply(ModelData_Part thePart)
{
var aPartName = thePart.Name().IsEmpty() ? new Base_UTF16String("noname") : thePart.Name();
var aBRep = thePart.BRepRepresentation();
if (aBRep != null)
{
// Looking for a suitable body
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)
{
Console.Write($"Part #{myPartIndex} [\"{aPartName}\"] - solid #{i} has:\n");
ProcessSolid(ModelData_Solid.Cast(aShape));
}
else if (aShape.Type() == ModelData_ShapeType.ModelData_ST_Shell)
{
Console.Write($"Part #{myPartIndex} [\"{aPartName}\"] - shell #{i} has:\n");
ProcessShell(ModelData_Shell.Cast(aShape));
}
}
++myPartIndex;
}
}
}
public abstract void ProcessSolid(ModelData_Solid theSolid);
public abstract void ProcessShell(ModelData_Shell theShell);
private uint myPartIndex = 0;
}
abstract class SolidProcessor : ModelData_Model.VoidElementVisitor
{
public override void Apply(ModelData_Part thePart)
{
var aPartName = thePart.Name().IsEmpty() ? new Base_UTF16String ("noname") : thePart.Name();
var aBRep = thePart.BRepRepresentation();
if (aBRep != null)
{
// Looking for a suitable body
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)
{
Console.Write ($"Part #{myPartIndex} [\"{aPartName}\"] - solid #{i} has:\n");
ProcessSolid(ModelData_Solid.Cast(aShape));
}
}
++myPartIndex;
}
}
}
public abstract void ProcessSolid(ModelData_Solid theSolid);
private uint myPartIndex = 0;
}
}
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition: Base_UTF16String.hxx:34
bool IsEmpty() const
Returns true if the string is empty.
Definition: Base_UTF16String.cxx:233
Base_UTF16String Name() const
Definition: ModelData_BaseObject.cxx:218
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
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
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
ModelData_ShapeType
Defines shape type.
Definition: ModelData_ShapeType.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 feature_group;
using shape_processor;
using System;
namespace dfm_analyzer
{
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;
}
if (args.Length != 1)
{
Console.WriteLine("Usage: " +
$"{System.Reflection.Assembly.GetExecutingAssembly().Location} <input_file>, where:");
Console.WriteLine($" <input_file> is a name of the file to be read");
return 1;
}
string aSource = args[0];
var aModel = new ModelData_Model();
var aReader = new ModelData_ModelReader();
// Reading the file
if (!aReader.Read(new Base_UTF16String(aSource), aModel))
{
Console.WriteLine($"Failed to read the file {aSource}");
return 1;
}
Console.WriteLine($"Model: {aModel.Name()}\n");
var aPartProcessor = new PartProcessor();
var aVisitor = new ModelData_SceneGraphElementUniqueVisitor(aPartProcessor);
aModel.Accept(aVisitor);
return 0;
}
class PartProcessor : ShapeProcessor
{
public PartProcessor()
{
myAnalyzer = new DFMSheetMetal_Analyzer();
}
public override void ProcessSolid(ModelData_Solid theSolid)
{
double aThickness = CalculateInitialThicknessValue(theSolid);
var anIssueList = myAnalyzer.Perform(theSolid, aThickness);
PrintIssues(anIssueList);
}
public override void ProcessShell(ModelData_Shell theShell)
{
var anIssueList = myAnalyzer.Perform(theShell);
PrintIssues(anIssueList);
}
private DFMSheetMetal_Analyzer myAnalyzer;
}
static void PrintIssues(MTKBase_FeatureList theIssueList)
{
FeatureGroupManager aManager = new FeatureGroupManager();
//group by parameters to provide more compact information about issues
for (uint i = 0; i < theIssueList.Size(); ++i)
{
MTKBase_Feature anIssue = theIssueList.Feature(i);
{
aManager.AddFeature("Small Radius Bend Issue(s)", "Bend(s)", true, anIssue);
}
{
aManager.AddFeature("Small Diameter Hole Issue(s)", "Hole(s)", true, anIssue);
}
{
aManager.AddFeature("Flat Pattern Interference Issue(s)", "", false, anIssue);
}
{
aManager.AddFeature("Irregular Corner Fillet Radius Notch Issue(s)", "Notch(es)", true, anIssue);
}
{
aManager.AddFeature("Irregular Depth Extruded Hole Issue(s)", "Hole(s)", true, anIssue);
}
{
aManager.AddFeature("Irregular Radius Open Hem Bend Issue(s)", "Bend(s)", true, anIssue);
}
{
aManager.AddFeature("Irregular Size Bend Relief Issue(s)", "Bend(s)", true, anIssue);
}
{
aManager.AddFeature("Large Depth Bead Issue(s)", "Bead(s)", true, anIssue);
}
{
aManager.AddFeature("Small Depth Louver Issue(s)", "Louver(s)", true, anIssue);
}
{
aManager.AddFeature("Inconsistent Radius Bend Issue(s)", "Bend(s)", true, anIssue);
}
{
aManager.AddFeature("Small Length Flange Issue(s)", "Flange(s)", true, anIssue);
}
{
aManager.AddFeature("Small Length Hem Bend Flange Issue(s)", "Flange(s)", true, anIssue);
}
{
aManager.AddFeature("Irregular Size Notch Issue(s)", "Notch(s)", true, anIssue);
}
{
aManager.AddFeature("Irregular Size Tab Issue(s)", "Tab(s)", true, anIssue);
}
{
aManager.AddFeature(SmallDistanceIssueName(aSDBFIssue), "Distance(s)", true, anIssue);
}
{
aManager.AddFeature("Non Standard Sheet Thickness Issue(s)", "Sheet Thickness(s)", true, anIssue);
}
{
aManager.AddFeature("Non Standard Sheet Size Issue(s)", "Sheet Size(s)", true, anIssue);
}
}
//print
Action<MTKBase_Feature> PrintFeatureParameters = theIssue =>
{
{
FeatureGroupManager.PrintFeatureParameter("expected min radius", aSRBIssue.ExpectedMinRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aSRBIssue.ActualRadius(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min diameter", aSDHIssue.ExpectedMinDiameter(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual diameter", aSDHIssue.ActualDiameter(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min distance", aSDBFIssue.ExpectedMinDistanceBetweenFeatures(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual distance", aSDBFIssue.ActualDistanceBetweenFeatures(), "mm");
}
{
//no parameters
}
{
FeatureGroupManager.PrintFeatureParameter("expected corner fillet radius", aICFRNIssue.ExpectedCornerFilletRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual corner fillet radius", aICFRNIssue.ActualCornerFilletRadius(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min extruded height", aIDEHIssue.ExpectedMinExtrudedHeight(), "mm");
FeatureGroupManager.PrintFeatureParameter("expected max extruded height", aIDEHIssue.ExpectedMaxExtrudedHeight(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual extruded height", aIDEHIssue.ActualExtrudedHeight(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected radius", aIROHBIssue.ExpectedRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aIROHBIssue.ActualRadius(), "mm");
}
{
SheetMetal_BendRelief anExpectedRelief = aISBRIssue.ExpectedMinBendRelief();
SheetMetal_BendRelief aFirstActualRelief = aISBRIssue.FirstActualRelief();
SheetMetal_BendRelief aSecondActualRelief = aISBRIssue.SecondActualRelief();
FeatureGroupManager.PrintFeatureParameter(
"expected min relief size (LxW)",
new Pair(anExpectedRelief.Length(), anExpectedRelief.Width()),
"mm");
if (!aFirstActualRelief.IsNull() && !aSecondActualRelief.IsNull())
{
FeatureGroupManager.PrintFeatureParameter(
"first actual relief size (LxW)",
new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"second actual relief size (LxW)",
new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
}
else if (aFirstActualRelief.IsNull())
{
FeatureGroupManager.PrintFeatureParameter(
"actual relief size (LxW)",
new Pair(aSecondActualRelief.Length(), aSecondActualRelief.Width()),
"mm");
}
else
{
FeatureGroupManager.PrintFeatureParameter(
"actual relief size (LxW)",
new Pair(aFirstActualRelief.Length(), aFirstActualRelief.Width()),
"mm");
}
}
{
FeatureGroupManager.PrintFeatureParameter("expected max depth", aLDBIssue.ExpectedMaxDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual depth", aLDBIssue.ActualDepth(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min depth", aSDLIssue.ExpectedMinDepth(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual depth", aSDLIssue.ActualDepth(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected max radius", aIRBIssue.ExpectedRadius(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual radius", aIRBIssue.ActualRadius(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min length", aSLFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual length", aSLFIssue.ActualLength(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter("expected min length", aSLHBFIssue.ExpectedMinLength(), "mm");
FeatureGroupManager.PrintFeatureParameter("actual length", aSLHBFIssue.ActualLength(), "mm");
}
{
FeatureGroupManager.PrintFeatureParameter(
"expected size (LxW)",
new Pair(aISNIssue.ExpectedLength(), aISNIssue.ExpectedWidth()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual size (LxW)",
new Pair(aISNIssue.ActualLength(), aISNIssue.ActualWidth()),
"mm");
}
{
FeatureGroupManager.PrintFeatureParameter(
"expected size (LxW)",
new Pair(aISTIssue.ExpectedLength(), aISTIssue.ExpectedWidth()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual size (LxW)",
new Pair(aISTIssue.ActualLength(), aISTIssue.ActualWidth()),
"mm");
}
{
FeatureGroupManager.PrintFeatureParameter(
"nearest standard sheet thickness", aNSSTIssue.NearestStandardSheetThickness(), "mm");
FeatureGroupManager.PrintFeatureParameter(
"actual sheet thickness", aNSSTIssue.ActualSheetThickness(), "mm");
}
{
DFMSheetMetal_SheetSize aNearestStandardSize = aNSSSIssue.NearestStandardSheetSize();
DFMSheetMetal_SheetSize anActualSize = aNSSSIssue.ActualSheetSize();
FeatureGroupManager.PrintFeatureParameter(
"nearest standard sheet size (LxW)",
new Pair(aNearestStandardSize.Length(), aNearestStandardSize.Width()),
"mm");
FeatureGroupManager.PrintFeatureParameter(
"actual sheet size (LxW)",
new Pair(anActualSize.Length(), anActualSize.Width()),
"mm");
}
};
aManager.Print("issues", PrintFeatureParameters);
}
static string SmallDistanceIssueName(DFMSheetMetal_SmallDistanceBetweenFeaturesIssue theIssue)
{
{
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)";
}
//Compute approximate thickness value, which can be used as the input thickness value for DFMSheetMetal_Analyzer.
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;
}
static double ToDegrees(double theAngleRad)
{
return theAngleRad * 180 / Math.PI;
}
}
}
Provides an interface to run DFM Sheet Metal analysis.
Definition: DFMSheetMetal_Analyzer.hxx:45
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 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
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
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
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
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
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
const DFMSheetMetal_SheetSize & ActualSheetSize() const
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.cxx:87
const DFMSheetMetal_SheetSize & NearestStandardSheetSize() const
Definition: DFMSheetMetal_NonStandardSheetSizeIssue.cxx:69
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
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
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
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
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
Describes small distance detween extruded hole and edge issues found during sheet metal design analys...
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHoleAndEdgeIssue.hxx:34
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
Describes small distance between extruded holes issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenExtrudedHolesIssue.hxx:33
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
Describes small distance between hole and cutout issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndCutoutIssue.hxx:34
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
Describes small distance between hole and louver issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenHoleAndLouverIssue.hxx:34
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
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
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
Describes small distance detween notch and bend issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallDistanceBetweenNotchAndBendIssue.hxx:34
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
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
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
Describes small length flange issues found during sheet metal design analysis.
Definition: DFMSheetMetal_SmallLengthFlangeIssue.hxx:34
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
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
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
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
Reads any format that CAD Exchanger can import.
Definition: ModelData_ModelReader.hxx:33
Defines a visitor that visits each unique element only once.
Definition: ModelData_SceneGraphElementUniqueVisitor.hxx:33
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
double Width() const
Definition: SheetMetal_BendRelief.cxx:67