Hide menu
Loading...
Searching...
No Matches
modeling/brep/Program.cs

Refer to the B-Rep Geometry Creation Example.

edgeutil.cs

// ****************************************************************************
// $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.
//
// ****************************************************************************
using cadex;
using System;
namespace brep
{
class edgeutil
{
static public ModelData_Axis2Placement a2Axis = new ModelData_Axis2Placement();
static public ModelData_Edge MakeEdgeFromLine()
{
ModelData_Line aCurve = new ModelData_Line(new ModelData_Point(0.0, 0.0, 0.0), ModelData_Direction.XDir());
return new ModelData_Edge(aCurve, -2.0, 2.0);
}
static public ModelData_Edge MakeEdgeFromCircle()
{
ModelData_Circle aCurve = new ModelData_Circle(a2Axis, 5.0);
return new ModelData_Edge(aCurve, 0.0, Math.PI);
}
static public ModelData_Edge MakeEdgeFromEllipse()
{
ModelData_Ellipse aCurve = new ModelData_Ellipse(a2Axis, 7.0, 3.0);
return new ModelData_Edge(aCurve, 0.0, Math.PI);
}
static public ModelData_Edge MakeEdgeFromParabola()
{
ModelData_Parabola aCurve = new ModelData_Parabola(a2Axis, 5.0);
return new ModelData_Edge(aCurve, -2.0, 2.0);
}
static public ModelData_Edge MakeEdgeFromHyperbola()
{
ModelData_Hyperbola aCurve = new ModelData_Hyperbola(a2Axis, 7.0, 3.0);
return new ModelData_Edge(aCurve, -2.0, 2.0);
}
static public ModelData_Edge MakeEdgeFromOffSetCurve()
{
ModelData_Circle aBasisCurve = new ModelData_Circle(a2Axis, 5.0);
ModelData_OffsetCurve aCurve = new ModelData_OffsetCurve(aBasisCurve, 10.0, ModelData_Direction.ZDir());
return new ModelData_Edge(aCurve, 0.0, Math.PI);
}
static public ModelData_Edge MakeEdgeFromOffsetCurve()
{
ModelData_Circle aBasisCurve = new ModelData_Circle(a2Axis, 5.0);
ModelData_OffsetCurve aCurve = new ModelData_OffsetCurve(aBasisCurve, 10.0, ModelData_Direction.ZDir());
return new ModelData_Edge(aCurve, 0.0, Math.PI);
}
static public ModelData_Edge MakeEdgeFromBezier()
{
ModelData_Point[] aPoles = {
new ModelData_Point (-2.0, 1.0, 0.0),
new ModelData_Point (-1.0,-1.0, 0.0),
new ModelData_Point ( 0.0, 1.0, 0.0),
new ModelData_Point ( 1.0,-1.0, 0.0)
};
return new ModelData_Edge(aCurve);
}
static public ModelData_Edge MakeEdgeFromBSpline()
{
ModelData_Point[] aPoles = {
new ModelData_Point (1.0, 1.0, 0.0),
new ModelData_Point (2.0, 3.0, 0.0),
new ModelData_Point (3.0, 2.0, 0.0),
new ModelData_Point (4.0, 3.0, 0.0),
new ModelData_Point (5.0, 1.0, 0.0),
};
double[] aKnots = { 0.0, 0.25, 0.75, 1.0 };
int[] aMultiplicities = { 3, 1, 1, 3 };
int aDegree = 2;
ModelData_BSplineCurve aCurve = new ModelData_BSplineCurve(aPoles, aKnots, aMultiplicities, aDegree);
return new ModelData_Edge(aCurve);
}
}
}
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 a 3D direction.
Definition: ModelData_Direction.hxx:180
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.cs

// ****************************************************************************
// $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.
//
// ****************************************************************************
using cadex;
using System;
namespace brep
{
class faceutil
{
static public ModelData_Axis3Placement a3Axis = new ModelData_Axis3Placement();
static public ModelData_Face MakePlanarFace()
{
ModelData_Plane aSurface = new ModelData_Plane(a3Axis);
return new ModelData_Face(aSurface, -2.0, 2.0, -2.0, 2.0);
}
static public ModelData_Face MakeSphericalFace()
{
return new ModelData_Face(aSurface, 0.0, Math.PI / 2, 0.0, Math.PI / 2);
}
static public ModelData_Face MakeCylindricalFace()
{
return new ModelData_Face(aSurface, 0.0, Math.PI, -2.0, 2.0);
}
static public ModelData_Face MakeConicalFace()
{
ModelData_ConicalSurface aSurface = new ModelData_ConicalSurface(a3Axis, 1.0, 7.0);
return new ModelData_Face(aSurface, 0.0, Math.PI, 0.0, Math.PI);
}
static public ModelData_Face MakeToroidalFace()
{
ModelData_ToroidalSurface aSurface = new ModelData_ToroidalSurface(a3Axis, 7.0, 3.0);
return new ModelData_Face(aSurface, 0.0, Math.PI, 0.0, Math.PI);
}
static public ModelData_Face MakeFaceFromSurfaceOfLinearExtrusion()
{
ModelData_Point[] aPoles = {
new ModelData_Point (-2.0, 1.0, 0.0),
new ModelData_Point (-1.0, -1.0, 0.0),
new ModelData_Point ( 0.0, 1.0, 0.0),
new ModelData_Point ( 1.0, -1.0, 0.0),
new ModelData_Point ( 2.0, 1.0, 0.0)
};
ModelData_BezierCurve aBasisCurve = new ModelData_BezierCurve(aPoles);
return new ModelData_Face(aSurface, 0.1, 0.9, -10.0, 10.0);
}
static public ModelData_Face MakeFaceFromSurfaceOfRevolution()
{
ModelData_Point[] aPoles = {
new ModelData_Point (-2.0, 1.0, 0.0),
new ModelData_Point (-1.0, 3.0, 0.0),
new ModelData_Point ( 0.0, 2.0, 0.0),
new ModelData_Point ( 1.0, 1.0, 0.0),
new ModelData_Point ( 2.0, 2.0, 0.0)
};
ModelData_BezierCurve aBasisCurve = new ModelData_BezierCurve(aPoles);
return new ModelData_Face(aSurface, 0.0, Math.PI + Math.PI / 2, 0.1, 0.9);
}
static public ModelData_Face MakeFaceFromOffsetSurface()
{
ModelData_Point[] aPoles = {
new ModelData_Point (0.0, 0.0, 1.0),
new ModelData_Point (0.0, 2.0, 1.0),
new ModelData_Point (2.0, 0.0, 1.0),
new ModelData_Point (2.0, 2.0, -1.0)
};
ModelData_BezierSurface aBasisSurface = new ModelData_BezierSurface(aPoles, 2, 2);
ModelData_OffsetSurface aSurface = new ModelData_OffsetSurface(aBasisSurface, 10.0);
return new ModelData_Face(aSurface, 0.1, 0.9, 0.1, 0.9);
}
static public ModelData_Face MakeFaceFromBezier()
{
ModelData_Point[] aPoles = {
new ModelData_Point (0.0, 0.0, 1.0),
new ModelData_Point (0.0, 2.0, 1.0),
new ModelData_Point (2.0, 0.0, 1.0),
new ModelData_Point (2.0, 2.0, -1.0)
};
ModelData_BezierSurface aSurface = new ModelData_BezierSurface(aPoles, 2, 2);
return new ModelData_Face(aSurface, 0.25, 0.75, 0.25, 0.75);
}
static public ModelData_Face MakeFaceFromBSpline()
{
ModelData_Point[] aPoles = {
new ModelData_Point ( 0.0, 0.0, 1.0),
new ModelData_Point ( 0.0, 2.0, 3.0),
new ModelData_Point ( 0.0, 6.0, 2.0),
new ModelData_Point ( 0.0, 8.0, 3.0),
new ModelData_Point ( 0.0, 10.0, 1.0),
new ModelData_Point ( 2.0, 0.0, 2.0),
new ModelData_Point ( 2.0, 2.0, 2.0),
new ModelData_Point ( 2.0, 6.0, 2.0),
new ModelData_Point ( 2.0, 8.0, 2.0),
new ModelData_Point ( 2.0, 10.0, 2.0),
new ModelData_Point ( 4.0, 0.0, 3.0),
new ModelData_Point ( 4.0, 2.0, 1.0),
new ModelData_Point ( 4.0, 6.0, 2.0),
new ModelData_Point ( 4.0, 8.0, 1.0),
new ModelData_Point ( 4.0, 10.0, 3.0),
new ModelData_Point ( 6.0, 0.0, 2.0),
new ModelData_Point ( 6.0, 2.0, 2.0),
new ModelData_Point ( 6.0, 6.0, 2.0),
new ModelData_Point ( 6.0, 8.0, 2.0),
new ModelData_Point ( 6.0, 10.0, 2.0),
new ModelData_Point (10.0, 0.0, 3.0),
new ModelData_Point (10.0, 2.0, 1.0),
new ModelData_Point (10.0, 6.0, 2.0),
new ModelData_Point (10.0, 8.0, 1.0),
new ModelData_Point (10.0, 10.0, 3.0)
};
int aUPoles = 5;
int aVPoles = 5;
double[] aUKnots = { 0.0, 0.25, 0.75, 1.0 };
double[] aVKnots = { 0.0, 0.25, 0.75, 1.0 };
int[] aVMultiplicities = { 3, 1, 1, 3 };
int[] aUMultiplicities = { 3, 1, 1, 3 };
int aUDegree = 2;
int aVDegree = 2;
ModelData_BSplineSurface aSurface = new ModelData_BSplineSurface(aPoles, aUPoles, aVPoles, aUKnots, aVKnots,
aUMultiplicities, aVMultiplicities,
aUDegree, aVDegree);
return new ModelData_Face(aSurface, 0.25, 0.75, 0.25, 0.75);
}
static public ModelData_Face MakeFaceWithInnerWire()
{
ModelData_Circle anInnerCircle = new ModelData_Circle(anAxis2, 10.0);
ModelData_Circle anOuterCircle = new ModelData_Circle(anAxis2, 20.0);
ModelData_Edge anOuterEdge = new ModelData_Edge(anOuterCircle);
ModelData_Edge anInnerEdge = new ModelData_Edge(anInnerCircle);
ModelData_Wire anOuterWire = new ModelData_Wire(anOuterEdge);
ModelData_Wire anInnerWire = new ModelData_Wire(ModelData_Edge.Cast(anInnerEdge.Reversed()));
ModelData_Plane aPlane = new ModelData_Plane(anAxis3);
ModelData_Face aFace = new ModelData_Face(aPlane);
aFace.Append(anOuterWire);
aFace.Append(anInnerWire);
return aFace;
}
}
}
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
static const ModelData_Edge & Cast(const ModelData_Shape &theShape)
Casts a base class object to ModelData_Edge.
Definition: ModelData_Edge.cxx:688
Defines a topological face.
Definition: ModelData_Face.hxx:32
bool Append(const ModelData_Wire &theWire)
Adds a wire to the face.
Definition: ModelData_Face.cxx:226
Defines an offset surface.
Definition: ModelData_OffsetSurface.hxx:32
Defines a plane.
Definition: ModelData_Plane.hxx:32
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 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

bodyutil.cs

// ****************************************************************************
// $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.
//
// ****************************************************************************
using cadex;
namespace brep
{
class bodyutil
{
static public ModelData_Body MakeSolidBody()
{
ModelData_Solid aSolid = ModelAlgo_TopoPrimitives.CreateBox(new ModelData_Point(-3.0, -3.0, -4.0), new ModelData_Point(3.0, 3.0, -2.0));
return aBody;
}
static public ModelData_Body MakeSheetBody()
{
ModelData_Plane aPlane = new ModelData_Plane(new ModelData_Point(0.0, 0.0, 0.0), ModelData_Direction.ZDir());
ModelData_Face aFace1 = new ModelData_Face(aPlane, -4.0, 0.0, -4.0, 0.0);
ModelData_Face aFace2 = new ModelData_Face(aPlane, 0.0, 4.0, 0.0, 4.0);
ModelData_Shell aShell = new ModelData_Shell(aFace1);
aShell.Append(aFace2);
return aBody;
}
static public ModelData_Body MakeWireframeBody()
{
ModelData_Circle aCircle = new ModelData_Circle(anAxis, 5.0);
ModelData_Edge anEdge1 = new ModelData_Edge(aCircle, 1.0, 3.0);
ModelData_Edge anEdge2 = new ModelData_Edge(aCircle, 1.0, 3.0);
ModelData_Wire aWire = new ModelData_Wire(anEdge1);
aWire.Append(anEdge2);
return aBody;
}
static public ModelData_Body MakeAcornBody()
{
ModelData_Vertex aVertex = new ModelData_Vertex(new ModelData_Point(0.0, 0.0, 0.0));
return aBody;
}
}
}
Creates B-Rep solid primitives.
Definition: ModelAlgo_TopoPrimitives.hxx:43
static ModelData_Solid CreateBox(double theDx, double theDy, double theDz)
Creates a box.
Definition: ModelAlgo_TopoPrimitives.cxx:86
Defines a root topological shape that can be owned by B-Rep representation.
Definition: ModelData_Body.hxx:28
static ModelData_Body Create(const ModelData_Shape &theShape)
Creates a body from an arbitrary shape.
Definition: ModelData_Body.cxx:223
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
bool Append(const ModelData_Edge &theEdge)
Adds an edge to the wire.
Definition: ModelData_Wire.cxx:64

Program.cs

// ****************************************************************************
// $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.
//
// ****************************************************************************
using cadex;
using System;
using System.Runtime.InteropServices;
namespace brep
{
partial class Program
{
// For more information see https://stackoverflow.com/questions/8836093/how-can-i-specify-a-dllimport-path-at-runtime
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
static int Main(string[] args)
{
// Add runtime path to CAD Exchanger libraries (e.g. compiled with Visual Studio 2015)
SetDllDirectory("../../../../../../win64/vc14.1/bin");
string aKey = LicenseKey.Value();
// Activate the license (aKey must be defined in cadex_license.cs)
if (!LicenseManager.Activate(aKey))
{
Console.WriteLine("Failed to activate CAD Exchanger license.");
return 1;
}
ModelData_Edge aLine = edgeutil.MakeEdgeFromLine();
SaveModel(aLine, new Base_UTF16String("LineEdge"));
ModelData_Edge aCircle = edgeutil.MakeEdgeFromCircle();
SaveModel(aCircle, new Base_UTF16String("CircleEdge"));
ModelData_Edge anEllipse = edgeutil.MakeEdgeFromEllipse();
SaveModel(anEllipse, new Base_UTF16String("EllipseEdge"));
ModelData_Edge aParabola = edgeutil.MakeEdgeFromParabola();
SaveModel(aParabola, new Base_UTF16String("ParabolaEdge"));
ModelData_Edge aHyperbola = edgeutil.MakeEdgeFromHyperbola();
SaveModel(aHyperbola, new Base_UTF16String("HyperbolaEdge"));
ModelData_Edge anEdgeFromOffsetCurve = edgeutil.MakeEdgeFromOffSetCurve();
SaveModel(anEdgeFromOffsetCurve, new Base_UTF16String("OffsetEdge"));
ModelData_Edge aBezierEdge = edgeutil.MakeEdgeFromBezier();
SaveModel(aBezierEdge, new Base_UTF16String("BezierEdge"));
ModelData_Edge aBSplineEdge = edgeutil.MakeEdgeFromBSpline();
SaveModel(aBSplineEdge, new Base_UTF16String("BSplineEdge"));
ModelData_Face aPlane = faceutil.MakePlanarFace();
SaveModel(aPlane, new Base_UTF16String("PlaneFace"));
ModelData_Face aSphere = faceutil.MakeSphericalFace();
SaveModel(aSphere, new Base_UTF16String("SphereFace"));
ModelData_Face aCylinder = faceutil.MakeCylindricalFace();
SaveModel(aCylinder, new Base_UTF16String("CylinderFace"));
ModelData_Face aCone = faceutil.MakeConicalFace();
SaveModel(aCone, new Base_UTF16String("ConeFace"));
ModelData_Face aTorus = faceutil.MakeToroidalFace();
SaveModel(aTorus, new Base_UTF16String("TorusFace"));
ModelData_Face aFaceFromLESurface = faceutil.MakeFaceFromSurfaceOfLinearExtrusion();
SaveModel(aFaceFromLESurface, new Base_UTF16String("LEFace"));
ModelData_Face aFaceFromRevSurface = faceutil.MakeFaceFromSurfaceOfRevolution();
SaveModel(aFaceFromRevSurface, new Base_UTF16String("RevFace"));
ModelData_Face aFaceFromOffsetSurface = faceutil.MakeFaceFromOffsetSurface();
SaveModel(aFaceFromOffsetSurface, new Base_UTF16String("OffsetFace"));
ModelData_Face aBezierFace = faceutil.MakeFaceFromBezier();
SaveModel(aBezierFace, new Base_UTF16String("BezierFace"));
ModelData_Face aBSplineFace = faceutil.MakeFaceFromBSpline();
SaveModel(aBSplineFace, new Base_UTF16String("BSplineFace"));
ModelData_Face aFace = faceutil.MakeFaceWithInnerWire();
SaveModel(aFace, new Base_UTF16String("InnerWireFace"));
ModelData_Body aSolid = bodyutil.MakeSolidBody();
SaveModel(aSolid, new Base_UTF16String("SolidBody"));
ModelData_Body aSheet = bodyutil.MakeSheetBody();
SaveModel(aSheet, new Base_UTF16String("SheetBody"));
ModelData_Body aWireframe = bodyutil.MakeWireframeBody();
SaveModel(aWireframe, new Base_UTF16String("WireframeBody"));
ModelData_Body anAcorn = bodyutil.MakeAcornBody();
SaveModel(anAcorn, new Base_UTF16String("AcornBody"));
return 0;
}
static bool SaveModel(ModelData_Shape theShape, Base_UTF16String theName)
{
ModelData_Part aPart = new ModelData_Part(aBRep, new Base_UTF16String(theName));
aModel.AddRoot(aPart);
Base_UTF16String aPath = new Base_UTF16String(theName.ToString() + ".cdx");
return new ModelData_ModelWriter().Write (aModel, aPath);
}
}
}
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