#define __CADEX_PREVIEW_MODEL_CHECK 1
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelAlgo_TopoPrimitives.hxx>
#include <cadex/ModelAlgo_BRepFeatures.hxx>
#include <cadex/ModelCheck_BRepChecker.hxx>
#include <cadex/ModelData_Appearance.hxx>
#include <cadex/ModelData_Assembly.hxx>
#include <cadex/ModelData_Axis2Placement.hxx>
#include <cadex/ModelData_Axis3Placement.hxx>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_Circle.hxx>
#include <cadex/ModelData_Color.hxx>
#include <cadex/ModelData_CylindricalSurface.hxx>
#include <cadex/ModelData_Direction.hxx>
#include <cadex/ModelData_Edge.hxx>
#include <cadex/ModelData_Face.hxx>
#include <cadex/ModelData_Instance.hxx>
#include <cadex/ModelData_Line.hxx>
#include <cadex/ModelData_ModelWriter.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cadex/ModelData_Plane.hxx>
#include <cadex/ModelData_Point.hxx>
#include <cadex/ModelData_RectangularTrimmedSurface.hxx>
#include <cadex/ModelData_Shape.hxx>
#include <cadex/ModelData_Shell.hxx>
#include <cadex/ModelData_Solid.hxx>
#include <cadex/ModelData_Transformation.hxx>
#include <cadex/ModelData_Vector.hxx>
#include <cadex/ModelData_Vertex.hxx>
#include <cadex/ModelData_Wire.hxx>
#include <array>
#include <cmath>
#include <iostream>
#include "../../cadex_license.cxx"
using namespace std;
YDir = ModelData_Direction::YDir(),
ZDir = ModelData_Direction::ZDir(),
{
aFace.Append (aWire);
return aFace;
}
{
aFace.Append (anInner);
aFace.Append (anOuter);
return aFace;
}
{
while (anIt.HasNext()) {
if (aP1 == aP2) {
array<double, 2> aParameters = {{0., M_PI * 2}};
enum {First, Last};
if (aP1.Z() == (theLength * theDir.Z())) {
theTopEdge = anEdge;
theTopPCurve = anEdge.
Curve (aParameters[First], aParameters[Last]);
} else {
theBottomEdge = anEdge;
theBottomPCurve = anEdge.
Curve (aParameters[First], aParameters[Last]);
}
};
}
return aFace;
}
{
double aNutA = theRadius * 2, aNutB = theRadius * 1.5, aHeight = theRadius / 2;
aFace.Append (ModelData_Wire::Cast (anInnerWire.Reversed()));
aBRep.SetAppearance (aNutShape, anApp);
return aNut;
}
{
double aMajorRadius = theRadius * 1.3;
double aLongLength = theRadius * 6;
double aShortLength = theRadius / 2;
ModelData_Edge aTopEdge, aMiddleOuterEdge, aMiddleInnerEdge, aBottomEdge;
ModelData_Curve aTopPCurve, aMiddleOuterPcurve, aMiddleInnerPCurve, aBottomPCurve;
aTopEdge, aMiddleOuterEdge,
aTopPCurve, aMiddleOuterPcurve);
aBottomEdge, aMiddleInnerEdge,
aBottomPCurve, aMiddleOuterPcurve);
ModelData_Edge::Cast (aMiddleInnerEdge.
Reversed()),
ModelData_Edge::Cast (aMiddleOuterEdge.
Reversed()));
cout << "a bolt is valid" << endl;
} else {
cout << "a bolt is invalid" << endl;
}
aBRep.SetAppearance (aSolid, anApp);
return aBolt;
}
aNutBoltAssembly.AddInstance (theNut, aNutTrsf);
aNutBoltAssembly.AddInstance (theBolt, aBoltTrsf);
return aNutBoltAssembly;
}
int main()
{
auto aKey = LicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
double aRadius = 0.8;
array<ModelData_Vector, 3> aPos = {{
}};
ModelData_Assembly aNutBoltAssembly = CreateNutBoltAssembly (aNut, aBolt, -aRadius * 4.5);
for (size_t i = 0; i < aPos.size(); ++i) {
}
aWriter.
Write (aModel,
"assembly.cdx");
return 0;
}
Provides an interface to perform various checks to BRep shape.
Definition: ModelCheck_BRepChecker.hxx:45
bool HasProblems() const
Returns true if last checked shape has problems and false otherwise.
Definition: ModelCheck_BRepChecker.cxx:1042
bool Check(const ModelData_Shape &theShape)
Performs check on the given shape.
Definition: ModelCheck_BRepChecker.cxx:1037
Provides an interface to appearance which is a collection of visual styles.
Definition: ModelData_Appearance.hxx:39
Defines a group of scene graph element.
Definition: ModelData_Assembly.hxx:33
Defines a right-hand axis placement in 3D.
Definition: ModelData_Axis2Placement.hxx:38
Defines a right-handed or left-handed axis placement in 3D.
Definition: ModelData_Axis3Placement.hxx:38
Defines precise Boundary Representation of part.
Definition: ModelData_BRepRepresentation.hxx:39
Defines 3D circle.
Definition: ModelData_Circle.hxx:33
Defines an RGBA color (with alpha channel).
Definition: ModelData_Color.hxx:34
Base class for 3D curves.
Definition: ModelData_Curve.hxx:44
Defines a cylindrical surface.
Definition: ModelData_CylindricalSurface.hxx:32
Defines a 3D direction.
Definition: ModelData_Direction.hxx:180
Defines an edge.
Definition: ModelData_Edge.hxx:36
ModelData_Curve Curve(double &theFirstParameter, double &theLastParameter) const
Returns edge 3D curve and its limits.
Definition: ModelData_Edge.cxx:632
ModelData_Vertex EndVertex() const
Returns a start vertex.
Definition: ModelData_Edge.cxx:622
ModelData_Vertex StartVertex() const
Returns a start vertex.
Definition: ModelData_Edge.cxx:613
Defines a topological face.
Definition: ModelData_Face.hxx:32
Defines an occurrence of assembly or part in a scene graph.
Definition: ModelData_Instance.hxx:34
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
const ModelData_SceneGraphElement & AddRoot(const ModelData_SceneGraphElement &theElement)
Adds new root element into the scene graph.
Definition: ModelData_Model.cxx:781
Writes any format that CAD Exchanger can export.
Definition: ModelData_ModelWriter.hxx:33
bool Write(const ModelData_Model &theModel, const Base_UTF16String &theFilePath)
Writes the specified model to the file at the specified path.
Definition: ModelData_ModelWriter.cxx:134
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
Defines a plane.
Definition: ModelData_Plane.hxx:32
Defines a 3D point.
Definition: ModelData_Point.hxx:295
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
ModelData_Shape Reversed() const
Returns a shape that shares the same geometry and subshape graph but has opposite orientation.
Definition: ModelData_Shape.cxx:402
Defines a connected set of faces.
Definition: ModelData_Shell.hxx:31
bool Append(const ModelData_Face &theFace)
Adds a face to the shell.
Definition: ModelData_Shell.cxx:64
Defines a topological solid.
Definition: ModelData_Solid.hxx:31
Defines a 3D vector.
Definition: ModelData_Vector.hxx:442
ModelData_Point Point() const
Returns a 3D point this vertex resides at.
Definition: ModelData_Vertex.cxx:68
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