using System;
using System.Collections.Generic;
namespace poly_projector
{
class Program
{
static int Main(string[] args)
{
string aKey = MTKLicenseKey.Value();
{
Console.WriteLine("Failed to activate Manufacturing Toolkit license.");
return 1;
}
if (args.Length != 2)
{
Console.WriteLine("Usage: poly_projector <input_file> <output_folder>, where:");
Console.WriteLine(" <input_file> is a name of the file to be read");
Console.WriteLine(" <output_folder> is a folder to save projections to (must end with '/' or '\\\\')");
return 1;
}
string anOutFolder = args[1];
if (!aReader.
Read(aSource, aModel))
{
Console.WriteLine("Failed to read the file " + args[0]);
return 1;
}
Console.WriteLine(
"Model: " + aModel.
Name());
Console.WriteLine("");
{
Console.WriteLine("Failed to write X projection.");
return 1;
}
{
Console.WriteLine("Failed to write Y projection.");
return 1;
}
{
Console.WriteLine("Failed to write Z projection.");
return 1;
}
Console.WriteLine("Output written:");
Console.WriteLine(" " + anOutX);
Console.WriteLine(" " + anOutY);
Console.WriteLine(" " + anOutZ);
return 0;
}
static void PrintProjectionInfo(
Part thePart,
{
Console.WriteLine(
"Part [" + thePart.
Name() +
"], projection " + theDirectionName +
":");
Console.WriteLine(
" area = " + theProjection.
Area() +
" mm");
Console.WriteLine(
" outer perimeter = " + theProjection.
OuterPerimeter() +
" mm");
Console.WriteLine("");
}
{
public ProjectionComputer(
Direction theDirection,
{
myDirection = theDirection;
myDirectionName = theDirectionName;
}
{
{
aPart.AddBody(aMeshBody);
}
return aWriter.
Write(anOutModel, theFileName);
}
public override void Apply(
Part thePart)
{
PrintProjectionInfo(thePart, myDirectionName, aProjection);
myPartProjections.Add(aProjection);
}
private List<Projector_Projection> myPartProjections = new List<Projector_Projection>();
}
static bool ComputeProjection(
Model theModel,
{
ProjectionComputer aComputer = new ProjectionComputer(theDirection, theDirectionName);
return aComputer.SaveProjection(theOutFileName);
}
}
}
Defines a 3D Direction.
Definition Direction.cs:17
Activates the license key.
Definition LicenseManager.cs:48
Defines a body that represents a polygonal mesh (faceted or tessellated).
Definition MeshBody.cs:19
cadex.UTF16String Name()
Returns empty string if the model element has no name (by default).
Definition ModelElement.cs:67
Element visitor with empty implementation.
Definition ModelElementVoidVisitor.cs:20
Provides MTK data model.
Definition Model.cs:31
void Accept(cadex.ModelData.ModelElementVisitor theVisitor)
Accepts a visitor.
Definition Model.cs:176
void AddRoot(cadex.ModelData.ModelElement theElement)
This function adds theElement as a root element in the model.
Definition Model.cs:133
cadex.UTF16String Name()
Returns empty string if the model has no name (by default).
Definition Model.cs:90
Reads supported formats, see Import section.
Definition ModelReader.cs:17
bool Read(cadex.UTF16String theFilePath, cadex.ModelData.Model theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cs:82
Writes supported formats, see Import and Export section.
Definition ModelWriter.cs:17
bool Write(cadex.ModelData.Model theModel, cadex.UTF16String theFilePath)
Writes the specified model to the file at the specified path.
Definition ModelWriter.cs:73
Defines a leaf node in the scene graph hierarchy.
Definition Part.cs:23
The poly projection tool.
Definition Projector_PolyProjector.cs:22
Provides a computed projection results.
Definition Projector_Projection.cs:21
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition UTF16String.cs:17
Contains classes, types, enums, and functions related to geometric entities.
Definition Axis1d.cs:12
Defines classes, types, enums, and functions related to topological entities and scene graph elements...
Definition AngleUnit.cs:12
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12