using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace brepresentation
{
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
static int Main(string[] args)
{
SetDllDirectory("../../../../../../win64/vc14.1/bin");
string aKey = LicenseKey.Value();
if (!LicenseManager.Activate(aKey))
{
Console.WriteLine("Failed to activate CAD Exchanger 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 XML file to be read");
return 1;
}
string aSource = args[0];
{
Console.WriteLine("Failed to read the file " + aSource);
return 1;
}
PartBRepVisitor aVisitor = new PartBRepVisitor();
aVisitor.PrintUniqueShapesCount();
return 0;
}
}
{
public PartBRepVisitor()
{
myNestingLevel = 0;
}
public void PrintUniqueShapesCount()
{
Console.WriteLine();
Console.WriteLine("Total unique shapes count: " + myShapeSet.Count);
}
{
if (aBRep != null)
{
ExploreBRep(aBRep);
}
}
{
for (uint i = 0; i < aBodyList.
Size(); ++i)
{
Console.WriteLine("Body " + i + ": -type " + PrintBodyType(aBody));
ExploreShape(aBody);
}
}
{
myShapeSet.Add(theShape);
++myNestingLevel;
while (aShapeIt.
HasNext())
{
PrintShapeInfo(aShape);
ExploreShape(aShape);
}
--myNestingLevel;
}
{
{
}
return "Undefined";
}
{
PrintTabulation();
{
Console.Write("Wire");
break;
Console.Write("Face");
break;
Console.Write("Edge");
break;
Console.Write("Vertex");
break;
default: Console.Write("Undefined"); break;
}
Console.WriteLine();
}
{
Console.Write(". Orientation: ");
{
default:
break;
}
}
{
++myNestingLevel;
PrintOrientationInfo(theWire);
--myNestingLevel;
}
{
++myNestingLevel;
PrintOrientationInfo(theFace);
Console.WriteLine();
PrintTabulation();
Console.Write("Surface: " + PrintSurfaceType(aSurface));
--myNestingLevel;
}
{
switch (theSurface.
Type())
{
default:
break;
}
return "Undefined";
}
{
++myNestingLevel;
{
Console.Write("(Degenerated)");
}
PrintOrientationInfo(theEdge);
Console.Write(
". Tolerance " + theEdge.
Tolerance());
{
Console.WriteLine();
double aParamFirst = 0.0, aParamLast = 0.0;
PrintTabulation();
Console.Write("Curve: " + PrintCurveType(aCurve));
}
--myNestingLevel;
}
{
{
default:
break;
}
return "Undefined";
}
{
PrintOrientationInfo(theVertex);
Console.Write(
". Tolerance " + theVertex.
Tolerance());
}
private void PrintTabulation()
{
for (int i = 0; i < myNestingLevel; ++i)
{
Console.Write("- ");
}
}
private int myNestingLevel;
}
}
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition: Base_UTF16String.hxx:34
Defines precise Boundary Representation of part.
Definition: ModelData_BRepRepresentation.hxx:39
const ModelData_BodyList & Get() const
Returns an associated topological object.
Definition: ModelData_BRepRepresentation.cxx:626
Defines a root topological shape that can be owned by B-Rep representation.
Definition: ModelData_Body.hxx:28
ModelData_BodyType BodyType() const
Returns a body type.
Definition: ModelData_Body.cxx:139
Defines a list of bodies.
Definition: ModelData_BodyList.hxx:31
Base class for 3D curves.
Definition: ModelData_Curve.hxx:44
ModelData_CurveType Type() const
Returns a curve type.
Definition: ModelData_Curve.cxx:205
Defines an edge.
Definition: ModelData_Edge.hxx:36
static const ModelData_Edge & Cast(const ModelData_Shape &theShape)
Casts a base class object to ModelData_Edge.
Definition: ModelData_Edge.cxx:688
bool IsDegenerated() const
Returns true if the edge is degenerated.
Definition: ModelData_Edge.cxx:671
double Tolerance() const
Returns edge tolerance.
Definition: ModelData_Edge.cxx:664
ModelData_Curve Curve(double &theFirstParameter, double &theLastParameter) const
Returns edge 3D curve and its limits.
Definition: ModelData_Edge.cxx:632
Defines a topological face.
Definition: ModelData_Face.hxx:32
ModelData_Surface Surface() const
Returns underlying surface.
Definition: ModelData_Face.cxx:253
static const ModelData_Face & Cast(const ModelData_Shape &theShape)
Cast operator.
Definition: ModelData_Face.cxx:282
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
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
ModelData_ShapeType Type() const
Returns a shape type.
Definition: ModelData_Shape.cxx:358
ModelData_ShapeOrientation Orientation() const
Returns orientation flag.
Definition: ModelData_Shape.cxx:392
Base class for geometrical surfaces.
Definition: ModelData_Surface.hxx:44
ModelData_SurfaceType Type() const
Returns a surface type.
Definition: ModelData_Surface.cxx:195
Hasher for ModelData_Shape using 'IsSame' relationship.
Definition: ModelData_Shape.hxx:110
Defines topological vertex.
Definition: ModelData_Vertex.hxx:31
double Tolerance() const
Returns vertex tolerance.
Definition: ModelData_Vertex.cxx:89
Defines a connected set of edges.
Definition: ModelData_Wire.hxx:31
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
ModelData_CurveType
Defines curve type.
Definition: ModelData_CurveType.hxx:25
ModelData_ShapeOrientation
Defines shape orientation.
Definition: ModelData_ShapeOrientation.hxx:25
ModelData_SurfaceType
Defines surface type.
Definition: ModelData_SurfaceType.hxx:25
ModelData_ShapeType
Defines shape type.
Definition: ModelData_ShapeType.hxx:25
ModelData_BodyType
Defines a body type.
Definition: ModelData_BodyType.hxx:25