Hide menu
Loading...
Searching...
No Matches
modeling/brep/main.cxx

Refer to the B-Rep Geometry Creation Example.

edgeutil.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#ifndef _EdgeUtil_HeaderFile
#define _EdgeUtil_HeaderFile
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/ModelData_Axis2Placement.hxx>
#include <cadex/ModelData_BezierCurve.hxx>
#include <cadex/ModelData_BSplineCurve.hxx>
#include <cadex/ModelData_Circle.hxx>
#include <cadex/ModelData_Curve.hxx>
#include <cadex/ModelData_Direction.hxx>
#include <cadex/ModelData_Edge.hxx>
#include <cadex/ModelData_Ellipse.hxx>
#include <cadex/ModelData_Hyperbola.hxx>
#include <cadex/ModelData_Line.hxx>
#include <cadex/ModelData_OffsetCurve.hxx>
#include <cadex/ModelData_Parabola.hxx>
#include <cadex/ModelData_Point.hxx>
#include <array>
#include <cmath>
using namespace std;
using namespace cadex;
static const ModelData_Axis2Placement a2Axis;
static ModelData_Edge MakeEdgeFromLine()
{
ModelData_Line aCurve (ModelData_Point (0., 0., 0.), ModelData_Direction::XDir());
return ModelData_Edge (aCurve, -2., 2.);
}
static ModelData_Edge MakeEdgeFromCircle()
{
ModelData_Circle aCurve (a2Axis, 5.);
return ModelData_Edge (aCurve, 0., M_PI);
}
static ModelData_Edge MakeEdgeFromEllipse()
{
ModelData_Ellipse aCurve (a2Axis, 7., 3.);
return ModelData_Edge (aCurve, 0., M_PI);
}
static ModelData_Edge MakeEdgeFromParabola()
{
ModelData_Parabola aCurve (a2Axis, 5.);
return ModelData_Edge (aCurve, -2., 2.);
}
static ModelData_Edge MakeEdgeFromHyperbola()
{
ModelData_Hyperbola aCurve (a2Axis, 7., 3.);
return ModelData_Edge (aCurve, -2., 2.);
}
static ModelData_Edge MakeEdgeFromOffSetCurve()
{
ModelData_Circle aBasisCurve (a2Axis, 5.);
ModelData_OffsetCurve aCurve (aBasisCurve, 10., ModelData_Direction::ZDir());
return ModelData_Edge (aCurve, 0., M_PI);
}
static ModelData_Edge MakeEdgeFromBezier()
{
array<ModelData_Point, 4> aPoles = {{
ModelData_Point (-2., 1., 0.),
ModelData_Point (-1., -1., 0.),
ModelData_Point ( 0., 1., 0.),
ModelData_Point ( 1., -1., 0.)
}};
ModelData_BezierCurve aCurve (aPoles.data(), static_cast<int> (aPoles.size()));
return ModelData_Edge (aCurve);
}
static ModelData_Edge MakeEdgeFromBSpline()
{
const array<ModelData_Point, 5> aPoles = {{
ModelData_Point (1., 1., 0.),
ModelData_Point (2., 3., 0.),
ModelData_Point (3., 2., 0.),
ModelData_Point (4., 3., 0.),
ModelData_Point (5., 1., 0.)
}};
const array<double, 4> aKnots = {{
0., 0.25, 0.75, 1.,
}};
const array<int, 4> aMultiplicities = {{3, 1, 1, 3}};
int aDegree = 2;
ModelData_BSplineCurve aCurve (aPoles.data(), static_cast<int> (aPoles.size()),
aKnots.data(), static_cast<int> (aKnots.size()),
aMultiplicities.data(),
aDegree);
return ModelData_Edge (aCurve);
}
#endif
Defines a right-hand axis placement in 3D.
Definition: ModelData_Axis2Placement.hxx:38
Defines 3D B-Spline curve.
Definition: ModelData_BSplineCurve.hxx:34
Defines 3D Bezier curve.
Definition: ModelData_BezierCurve.hxx:36
Defines 3D circle.
Definition: ModelData_Circle.hxx:33
Defines an edge.
Definition: ModelData_Edge.hxx:36
Defines 3D ellipse.
Definition: ModelData_Ellipse.hxx:32
Defines 3D hyperbola.
Definition: ModelData_Hyperbola.hxx:32
Defines 3D line.
Definition: ModelData_Line.hxx:36
Defines 3D offset curve.
Definition: ModelData_OffsetCurve.hxx:33
Defines 3D parabola.
Definition: ModelData_Parabola.hxx:32
Defines a 3D point.
Definition: ModelData_Point.hxx:295
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22

faceutil.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#ifndef _FaceUtil_HeaderFile
#define _FaceUtil_HeaderFile
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/ModelData_Axis2Placement.hxx>
#include <cadex/ModelData_Axis3Placement.hxx>
#include <cadex/ModelData_BezierCurve.hxx>
#include <cadex/ModelData_BezierSurface.hxx>
#include <cadex/ModelData_BSplineSurface.hxx>
#include <cadex/ModelData_Circle.hxx>
#include <cadex/ModelData_ConicalSurface.hxx>
#include <cadex/ModelData_CylindricalSurface.hxx>
#include <cadex/ModelData_Direction.hxx>
#include <cadex/ModelData_Edge.hxx>
#include <cadex/ModelData_Face.hxx>
#include <cadex/ModelData_OffsetSurface.hxx>
#include <cadex/ModelData_Plane.hxx>
#include <cadex/ModelData_Point.hxx>
#include <cadex/ModelData_Shape.hxx>
#include <cadex/ModelData_SphericalSurface.hxx>
#include <cadex/ModelData_SurfaceOfLinearExtrusion.hxx>
#include <cadex/ModelData_SurfaceOfRevolution.hxx>
#include <cadex/ModelData_ToroidalSurface.hxx>
#include <cadex/ModelData_Wire.hxx>
#include <array>
#include <cmath>
using namespace std;
using namespace cadex;
static const ModelData_Axis3Placement a3Axis;
static ModelData_Face MakePlanarFace()
{
ModelData_Plane aSurface (a3Axis);
return ModelData_Face (aSurface, -2., 2., -2., 2.);
}
static ModelData_Face MakeSphericalFace()
{
ModelData_SphericalSurface aSurface (a3Axis, 10.);
return ModelData_Face (aSurface, 0., M_PI_2, 0., M_PI_2);
}
static ModelData_Face MakeCylindricalFace()
{
ModelData_CylindricalSurface aSurface (a3Axis, 5.);
return ModelData_Face (aSurface, 0., M_PI, -2., 2.);
}
static ModelData_Face MakeConicalFace()
{
ModelData_ConicalSurface aSurface (a3Axis, 1., 7.);
return ModelData_Face (aSurface, 0., M_PI, -2., 2.);
}
static ModelData_Face MakeToroidalFace()
{
ModelData_ToroidalSurface aSurface (a3Axis, 7., 3.);
return ModelData_Face (aSurface, 0., M_PI, 0., M_PI);
}
static ModelData_Face MakeFaceFromSurfaceOfLinearExtrusion()
{
array<ModelData_Point, 5> aPoles = {{
ModelData_Point (-2., 1., 0.),
ModelData_Point (-1., -1., 0.),
ModelData_Point ( 0., 1., 0.),
ModelData_Point ( 1., -1., 0.),
ModelData_Point ( 2., 1., 0.)
}};
ModelData_BezierCurve aBasisCurve (aPoles.data(), static_cast<int> (aPoles.size()));
ModelData_SurfaceOfLinearExtrusion aSurface (aBasisCurve, ModelData_Direction::ZDir());
return ModelData_Face (aSurface, 0.1, 0.9, -10., 10.);
}
static ModelData_Face MakeFaceFromSurfaceOfRevolution()
{
array<ModelData_Point, 5> aPoles = {{
ModelData_Point (-2., 1., 0.),
ModelData_Point (-1., 3., 0.),
ModelData_Point ( 0., 2., 0.),
ModelData_Point ( 1., 1., 0.),
ModelData_Point ( 2., 2., 0.)
}};
ModelData_BezierCurve aBasisCurve (aPoles.data(), static_cast<int> (aPoles.size()));
ModelData_SurfaceOfRevolution aSurface (aBasisCurve, ModelData_Point (0., 0., 0.), ModelData_Direction::XDir());
return ModelData_Face (aSurface, 0., M_PI + M_PI_2, 0.1, 0.9);
}
static ModelData_Face MakeFaceFromOffsetSurface()
{
array<ModelData_Point, 4> aPoles = {{
ModelData_Point (0., 0., 1.),
ModelData_Point (0., 2., 1.),
ModelData_Point (2., 0., 1.),
ModelData_Point (2., 2., -1.)
}};
ModelData_BezierSurface aBasisSurface (aPoles.data(), 2, 2);
ModelData_OffsetSurface aSurface (aBasisSurface, 10.);
return ModelData_Face (aSurface, 0.1, 0.9, 0.1, 0.9);
}
static ModelData_Face MakeFaceFromBezier()
{
array<ModelData_Point, 4> aPoles = {{
ModelData_Point (0., 0., 1.),
ModelData_Point (0., 2., 1.),
ModelData_Point (2., 0., 1.),
ModelData_Point (2., 2., -1.)
}};
ModelData_BezierSurface aSurface (aPoles.data(), 2, 2);
return ModelData_Face (aSurface, 0.25, 0.75, 0.25, 0.75);
}
static ModelData_Face MakeFaceFromBSpline()
{
array<ModelData_Point, 25> aPoles = {{
ModelData_Point ( 0., 0., 1.),
ModelData_Point ( 0., 2., 3.),
ModelData_Point ( 0., 6., 2.),
ModelData_Point ( 0., 8., 3.),
ModelData_Point ( 0., 10., 1.),
ModelData_Point ( 2., 0., 2.),
ModelData_Point ( 2., 2., 2.),
ModelData_Point ( 2., 6., 2.),
ModelData_Point ( 2., 8., 2.),
ModelData_Point ( 2., 10., 2.),
ModelData_Point ( 4., 0., 3.),
ModelData_Point ( 4., 2., 1.),
ModelData_Point ( 4., 6., 2.),
ModelData_Point ( 4., 8., 1.),
ModelData_Point ( 4., 10., 3.),
ModelData_Point ( 6., 0., 2.),
ModelData_Point ( 6., 2., 2.),
ModelData_Point ( 6., 6., 2.),
ModelData_Point ( 6., 8., 2.),
ModelData_Point ( 6., 10., 2.),
ModelData_Point ( 10., 0., 3.),
ModelData_Point ( 10., 2., 1.),
ModelData_Point ( 10., 6., 2.),
ModelData_Point ( 10., 8., 1.),
ModelData_Point ( 10., 10., 3.),
}};
int aUPoles = 5,
aVPoles = 5;
array<double, 4> aUKnots = {{0., 0.25, 0.75, 1.}},
aVKnots = {{0., 0.25, 0.75, 1.}};
array<int, 4> aUMultiplicities = {{3, 1, 1, 3}},
aVMultiplicities = {{3, 1, 1, 3}};
int aUDegree = 2;
int aVDegree = 2;
ModelData_BSplineSurface aSurface (aPoles.data(),
aUPoles, aVPoles,
aUKnots.data(), aVKnots.data(),
static_cast<int> (aUKnots.size()), static_cast<int> (aVKnots.size()),
aUMultiplicities.data(), aVMultiplicities.data(),
aUDegree, aVDegree);
return ModelData_Face (aSurface, 0.25, 0.75, 0.25, 0.75);
}
static ModelData_Face MakeFaceWithInnerWire()
{
ModelData_Circle anInnerCircle (anAxis2, 10.);
ModelData_Circle anOuterCircle (anAxis2, 20.);
ModelData_Wire anOuterWire, anInnerWire;
ModelData_Edge anOuterEdge (anOuterCircle);
ModelData_Edge anInnerEdge (anInnerCircle);
anOuterWire.Append (anOuterEdge);
anInnerWire.Append (ModelData_Edge::Cast (anInnerEdge.Reversed()));
ModelData_Axis3Placement anAxis3 (anAxis2);
ModelData_Plane aPlane (anAxis3);
ModelData_Face aFace (aPlane);
aFace.Append (anOuterWire);
aFace.Append (anInnerWire);
return aFace;
}
#endif
Defines a right-handed or left-handed axis placement in 3D.
Definition: ModelData_Axis3Placement.hxx:38
Defines a B-Spline surface.
Definition: ModelData_BSplineSurface.hxx:34
Defines a Bezier surface.
Definition: ModelData_BezierSurface.hxx:34
Defines a conical surface.
Definition: ModelData_ConicalSurface.hxx:32
Defines a cylindrical surface.
Definition: ModelData_CylindricalSurface.hxx:32
Defines a topological face.
Definition: ModelData_Face.hxx:32
Defines an offset surface.
Definition: ModelData_OffsetSurface.hxx:32
Defines a plane.
Definition: ModelData_Plane.hxx:32
Defines a spherical surface.
Definition: ModelData_SphericalSurface.hxx:32
Defines a surface of linear extrusion.
Definition: ModelData_SurfaceOfLinearExtrusion.hxx:34
Defines a surface of revolution.
Definition: ModelData_SurfaceOfRevolution.hxx:35
Defines a toroidal surface.
Definition: ModelData_ToroidalSurface.hxx:32
Defines a connected set of edges.
Definition: ModelData_Wire.hxx:31
bool Append(const ModelData_Edge &theEdge)
Adds an edge to the wire.
Definition: ModelData_Wire.cxx:64

bodyutil.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#ifndef _BodyUtil_HeaderFile
#define _BodyUtil_HeaderFile
#include <cadex/ModelAlgo_BRepFeatures.hxx>
#include <cadex/ModelAlgo_TopoPrimitives.hxx>
#include <cadex/ModelData_Axis2Placement.hxx>
#include <cadex/ModelData_Body.hxx>
#include <cadex/ModelData_Circle.hxx>
#include <cadex/ModelData_Direction.hxx>
#include <cadex/ModelData_Edge.hxx>
#include <cadex/ModelData_Face.hxx>
#include <cadex/ModelData_Line.hxx>
#include <cadex/ModelData_Plane.hxx>
#include <cadex/ModelData_Shell.hxx>
#include <cadex/ModelData_Solid.hxx>
#include <cadex/ModelData_Vertex.hxx>
#include <cadex/ModelData_Wire.hxx>
using namespace std;
using namespace cadex;
static ModelData_Body MakeSolidBody()
{
ModelData_Solid aSolid = ModelAlgo_TopoPrimitives::CreateBox (ModelData_Point (-3., -3., -4.),
ModelData_Point ( 3., 3., -2.));
ModelData_Body aBody = ModelData_Body::Create (aSolid);
return aBody;
}
static ModelData_Body MakeSheetBody()
{
ModelData_Plane aPlane (ModelData_Point (0., 0., 0.), ModelData_Direction::ZDir());
ModelData_Face aFace1 (aPlane, -4., 0., -4., 0.);
ModelData_Face aFace2 (aPlane, 0., 4., 0., 4.);
aShell.Append (aFace1);
aShell.Append (aFace2);
ModelData_Body aBody = ModelData_Body::Create (aShell);
return aBody;
}
static ModelData_Body MakeWireframeBody()
{
ModelData_Axis2Placement anAxis(ModelData_Point (0., 0., 0.), ModelData_Direction::ZDir(), ModelData_Direction::XDir());
ModelData_Circle aCircle (anAxis, 5.);
ModelData_Edge anEdge1 (aCircle, 1., 3.);
ModelData_Edge anEdge2 (aCircle, 3., 6.);
aWire.Append (anEdge1);
aWire.Append (anEdge2);
ModelData_Body aBody = ModelData_Body::Create (aWire);
return aBody;
}
static ModelData_Body MakeAcornBody()
{
ModelData_Vertex aVertex (ModelData_Point (0., 0., 0.));
ModelData_Body aBody = ModelData_Body::Create (aVertex);
return aBody;
}
#endif
Defines a root topological shape that can be owned by B-Rep representation.
Definition: ModelData_Body.hxx:28
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 topological vertex.
Definition: ModelData_Vertex.hxx:31

main.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#include <cadex/Base_UTF16String.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_ModelWriter.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cadex/ModelData_Shape.hxx>
#include <iostream>
#include "../../cadex_license.cxx"
#include "bodyutil.hxx"
#include "edgeutil.hxx"
#include "faceutil.hxx"
using namespace std;
using namespace cadex;
static bool SaveModel (const ModelData_Shape& theShape, Base_UTF16String theName)
{
ModelData_Part aPart (ModelData_BRepRepresentation (theShape), theName);
aModel.AddRoot (aPart);
Base_UTF16String aPath = theName + ".cdx";
return ModelData_ModelWriter().Write (aModel, aPath);
}
int main()
{
auto aKey = LicenseKey::Value();
// Activate the license (aKey must be defined in cadex_license.cxx)
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
ModelData_Edge aLine = MakeEdgeFromLine();
SaveModel (aLine, "LineEdge");
ModelData_Edge aCircle = MakeEdgeFromCircle();
SaveModel (aCircle, "CircleEdge");
ModelData_Edge anEllipse = MakeEdgeFromEllipse();
SaveModel (anEllipse, "EllipseEdge");
ModelData_Edge aParabola = MakeEdgeFromParabola();
SaveModel (aParabola, "ParabolaEdge");
ModelData_Edge aHyperbola = MakeEdgeFromHyperbola();
SaveModel (aHyperbola, "HyperbolaEdge");
ModelData_Edge anEdgeFromOffsetCurve = MakeEdgeFromOffSetCurve();
SaveModel (anEdgeFromOffsetCurve, "OffsetEdge");
ModelData_Edge aBezierEdge = MakeEdgeFromBezier();
SaveModel (aBezierEdge, "BezierEdge");
ModelData_Edge aBSplineEdge = MakeEdgeFromBSpline();
SaveModel (aBSplineEdge, "BSplineEdge");
ModelData_Face aPlane = MakePlanarFace();
SaveModel (aPlane, "PlaneFace");
ModelData_Face aSphere = MakeSphericalFace();
SaveModel (aSphere, "SphereFace");
ModelData_Face aCylinder = MakeCylindricalFace();
SaveModel (aCylinder, "CylinderFace");
ModelData_Face aCone = MakeConicalFace();
SaveModel (aCone, "ConeFace");
ModelData_Face aTorus = MakeToroidalFace();
SaveModel (aTorus, "TorusFace");
ModelData_Face aFaceFromLESurface = MakeFaceFromSurfaceOfLinearExtrusion();
SaveModel (aFaceFromLESurface, "LEFace");
ModelData_Face aFaceFromRevSurface = MakeFaceFromSurfaceOfRevolution();
SaveModel (aFaceFromRevSurface, "RevFace");
ModelData_Face aFaceFromOffsetSurface = MakeFaceFromOffsetSurface();
SaveModel (aFaceFromOffsetSurface, "OffsetFace");
ModelData_Face aBezierFace = MakeFaceFromBezier();
SaveModel (aBezierFace, "BezierFace");
ModelData_Face aBSplineFace = MakeFaceFromBSpline();
SaveModel (aBSplineFace, "BSplineFace");
ModelData_Face aFace = MakeFaceWithInnerWire();
SaveModel (aFace, "InnerWireFace");
ModelData_Body aSolid = MakeSolidBody();
SaveModel (aSolid, "SolidBody");
ModelData_Body aSheet = MakeSheetBody();
SaveModel (aSheet, "SheetBody");
ModelData_Body aWireframe = MakeWireframeBody();
SaveModel (aWireframe, "WireframeBody");
ModelData_Body anAcorn = MakeAcornBody();
SaveModel (anAcorn, "AcornBody");
return 0;
}
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
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:830
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:143
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37