using System;
namespace analyzer
{
class Program
{
static int Main(string[] args)
{
cadex.helpers.LoadLibrarySearchDirectory.SetupDllDirectory();
string aKey = LicenseKey.Value();
string anMTKKey = MTKLicenseKey.Value();
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 || args.Length > 2)
{
Console.WriteLine("Usage: " +
$"{System.Reflection.Assembly.GetExecutingAssembly().Location} <input_file> <input_resolution>, where:");
Console.WriteLine($" <input_file> is a name of the file to be read");
Console.WriteLine($" <input_resolution> is an optional argument that determine accuracy of wall thickness calculation." +
$" The larger the value, the higher the accuracy of the calculations," +
$" but greatly increase computation time and memory usage. Should be at least 100.");
return 1;
}
string aSource = args[0];
uint aResolution = 1000;
if (args.Length == 2)
{
aResolution = uint.Parse(args[1]);
}
if (aResolution < 100)
{
Console.WriteLine($"WARNING: Input resolution \"{aResolution}\" < 100. Will be used default resolution.\n");
aResolution = 1000;
}
Console.WriteLine($"Failed to read the file {aSource}");
return 1;
}
Console.WriteLine($"Model: {aModel.Name()}\n");
var aPartProcessor = new PartProcessor();
aPartProcessor.Resolution = aResolution;
return 0;
}
{
public PartProcessor()
{
}
{
if (aBRep != null)
{
for (uint i = 0; i < aBodyList.
Size(); ++i)
{
while (aShapeIt.HasNext())
{
var aShape = aShapeIt.
Next();
{
Console.Write($"Part #{myPartIndex} [\"{aPartName}\"] - solid #{i} has:\n");
}
}
}
}
else if (aPolyRep != null)
{
var aPolyList = aPolyRep.Get();
for (uint i = 0; i < aPolyList.Size(); ++i)
{
var aPVS = aPolyList.Element(i);
{
Console.Write($"Part #{myPartIndex} [\"{aPartName}\"] - mesh #{i} has:\n");
}
}
}
++myPartIndex;
}
{
var aWTData = myAnalyzer.Perform(theSolid, Resolution);
PrintWTData(aWTData);
}
{
var aWTData = myAnalyzer.Perform (theMesh, Resolution);
PrintWTData(aWTData);
}
{
{
Console.WriteLine($" Min thickness = {theData.MinThickness()} mm");
Console.WriteLine($" Max thickness = {theData.MaxThickness()} mm");
}
else
{
Console.WriteLine(" Failed to analyze the wall thickness of this entity.");
}
}
public uint Resolution { get; set; } = 1000;
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
Defines a polygonal shape consisting of triangles.
Definition: ModelData_IndexedTriangleSet.hxx:35
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
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
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
Defines a visitor that visits each unique element only once.
Definition: ModelData_SceneGraphElementUniqueVisitor.hxx:33
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
Defines a topological solid.
Definition: ModelData_Solid.hxx:31
The wall thickness analyzing tool.
Definition: WallThickness_Analyzer.hxx:42
Contains information about minimum and maximum wall thicknesses.
Definition: WallThickness_Data.hxx:39
bool IsEmpty() const
Returns true if WallThickness_Data is empty.
Definition: WallThickness_Data.cxx:97
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