import java.util.*;
public class poly_projector {
static {
try {
System.loadLibrary("CadExMTK");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String[] args) {
String aKey = MTKLicenseKey.Value();
if (!LicenseManager.Activate(aKey)) {
System.out.println("Failed to activate Manufacturing Toolkit license.");
System.exit(1);
}
if (args.length != 1) {
System.out.println("Usage: " + " <input_file>, where:");
System.out.println(" <input_file> is a name of the file to be read");
System.exit(1);
}
String aSource = args[0];
Model aModel = new Model();
ModelReader aReader = new ModelReader();
if (!aReader.Read(new UTF16String(aSource), aModel)) {
System.out.println("Failed to read the file " + aSource);
System.exit(1);
}
System.out.format("Model: %s\n\n", aModel.Name());
ModelPolyProjector aProjector =
new ModelPolyProjector(
cadex.
Geom.Direction.YDir());
aModel.Accept(aProjector);
}
}
class ModelPolyProjector extends ModelElementVoidVisitor
{
public ModelPolyProjector(
cadex.
Geom.Direction theDirection)
{
myDirection = theDirection;
}
@Override
public void Apply(Part thePart)
{
Projector_PolyData aData = myProjector.Perform(thePart, myDirection);
System.out.println("Part projection [" + thePart.Name() + "] has:");
System.out.println(" area = " + aData.ProjectionArea() + " mm");
}
private cadex.Geom.Direction myDirection;
private Projector_PolyProjector myProjector = new Projector_PolyProjector();
}
Contains classes, types, enums, and functions related to geometric entities.
Defines classes, types, enums, and functions related to topological entities and scene graph elements...
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.