AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
Solid modeling

Creating Basic Shapes

Basic shapes include boxes, cylinders, cones/frustums, spheres, and tori.

Box

AMCAX::MakeBox provides functionality to create boxes.

Construct a box using three dimensions dx, dy, and dz.

double dx = 1.;
double dy = 1.;
double dz = 1.;
AMCAX::TopoShape box = AMCAX::MakeBox(dx, dy, dz);
Class of making a box.
Definition MakeBox.hpp:20
Base class of shape, containing an underlying shape with a location and an orientation.
Definition TopoShape.hpp:15

Construct a box using a corner point and three dimensions dx, dy, and dz.

AMCAX::Point3 p(0., 0., 0.);// The corner point
double dx = 1.;
double dy = 2.;
double dz = 3.;
AMCAX::TopoShape box = AMCAX::MakeBox(p, dx, dy, dz);
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459

Construct a box using two diagonal points.

AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points

Construct a box using a local coordinate system and three dimensions dx, dy, and dz.

AMCAX::Frame3 frame;// The local coordinate system
double dx = 2.;
double dy = 3.;
double dz = 4.;
AMCAX::TopoShape box = AMCAX::MakeBox(frame, dx, dy, dz);
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:887

Cylinder

AMCAX::MakeCylinder provides functionality to create cylinders.

double r = 3.;// The radius
double h = 5.;// The height
Class of making a cylinder.
Definition MakeCylinder.hpp:18

Cone/Frustum

AMCAX::MakeCone provides functionality to create cones/frustums.

double r1 = 4.;// The bottom radius
double r2 = 2.;// The top radius
double h = 4.;// The height
Class of making a cone.
Definition MakeCone.hpp:18

Sphere

AMCAX::MakeSphere provides functionality to create spheres.

Construct a complete sphere using radius.

double r = 1.;
Class of making a sphere.
Definition MakeSphere.hpp:18

Construct a partial sphere (crescent shape) using radius and rotation angle. The rotation angle should be in range (0, 2pi].

double r = 1.;
double angle = AMCAX::Constants::half_pi / 2;// The rotation angle (longitude)
constexpr double half_pi
pi/2
Definition Constants.hpp:50

Construct a segmented sphere using radius and angle range. angle1 should be less than angle2, and angles should be in [-pi/2, pi/2] range.

double r = 1.;
double angle1 = -AMCAX::Constants::quarter_pi;// The start angle (latitude)
double angle2 = AMCAX::Constants::quarter_pi;// The end angle (latitude)
AMCAX::TopoShape sphere = AMCAX::MakeSphere(r, angle1, angle2);
constexpr double quarter_pi
pi/4
Definition Constants.hpp:58

Construct a partial segmented sphere using radius, angle range, and rotation angle.

double r = 1.;
double angle1 = -AMCAX::Constants::quarter_pi;// The start angle (latitude)
double angle2 = AMCAX::Constants::quarter_pi;// The end angle (latitude)
double angle3 = AMCAX::Constants::half_pi;// The rotation angle (longitude)
AMCAX::TopoShape sphere = AMCAX::MakeSphere(r, angle1, angle2, angle3);

Torus

AMCAX::MakeTorus provides functionality to create tori.

Construct a complete torus using major and minor radii.

double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
Class of making a torus.
Definition MakeTorus.hpp:21

Construct a partial torus using major radius, minor radius, and rotation angle.

double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
double angle = AMCAX::Constants::half_pi;// The rotation angle
AMCAX::TopoShape torus = AMCAX::MakeTorus(r1, r2, angle);

Construct a segmented torus using major radius, minor radius, and angle range.

double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
double angle1 = AMCAX::Constants::half_pi;// The start angle
double angle2 = AMCAX::Constants::pi;// The end angle
AMCAX::TopoShape torus = AMCAX::MakeTorus(r1, r2, angle1, angle2);
constexpr double pi
Mathematical constant Pi, ratio of a circle's circumference to its diameter.
Definition Constants.hpp:42

Construct a segmented torus using major radius, minor radius, angle range, and rotation angle.

double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
double angle1 = AMCAX::Constants::half_pi;// The start angle
double angle2 = AMCAX::Constants::pi;// The end angle
double angle3 = AMCAX::Constants::pi;// The rotation angle
AMCAX::TopoShape torus = AMCAX::MakeTorus(r1, r2, angle1, angle2, angle3);

Boolean Operations

Boolean operations include fuse, common, cut, split, and section computation.

Fuse

AMCAX::BoolBRepFuse provides fuse functionality.

// Make a box
double dx = 1.;
double dy = 1.;
double dz = 1.;
AMCAX::TopoShape box = AMCAX::MakeBox(dx, dy, dz);
// Make a torus
double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
// Compute the fuse of two shapes
The class of fuse operation.
Definition BoolBRepFuse.hpp:15

Common

AMCAX::BoolBRepCommon provides common functionality.

// Make a box
double dx = 5.;
double dy = 5.;
double dz = 5.;
AMCAX::TopoShape box = AMCAX::MakeBox(dx, dy, dz);
// Make a torus
double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
// Compute the common shape of two shapes
The class of common operation.
Definition BoolBRepCommon.hpp:14

Cut

AMCAX::BoolBRepCut provides cut functionality.

// Make a cone
double r1 = 4.;// The bottom radius
double r2 = 2.;// The top radius
double h = 4.;// The height
// Make a sphere
double r = 4.;
// Compute the cut operation of two shapes
The class of cut operation.
Definition BoolBRepCut.hpp:15

Split

AMCAX::BoolBRepSplitter provides split functionality.

// Make a box
double dx = 5.;
double dy = 5.;
double dz = 5.;
AMCAX::TopoShape box = AMCAX::MakeBox(dx, dy, dz);
// Make a torus
double r1 = 4.;// The major radius
double r2 = 2.;// The minor radius
// Split
auto tool_shape = std::list{ box };
auto tool_argument = std::list{ torus };
splitter.SetTools(tool_shape);
splitter.SetArguments(tool_argument);
// Get the resulting shape
AMCAX::TopoShape split = splitter.Shape();
The class of splitter operation.
Definition BoolBRepSplitter.hpp:16
AMCAX_API void SetTools(const std::list< TopoShape > &ls)
Set the tool shapes.
AMCAX_API void SetArguments(const std::list< TopoShape > &listargs)
Set the shapes to be processed.
virtual AMCAX_API const TopoShape & Shape()
Get the resulting shape.

Section Computation

AMCAX::BoolBRepSection provides section computation functionality, with results saved as TopoCompound.

// Make a cone
double r1 = 4.;// The bottom radius
double r2 = 2.;// The top radius
double h = 4.;// The height
// Make a sphere
double r = 4.;
// Compute the section of two shapes
AMCAX::TopoShape section = AMCAX::BoolBRepSection(cone, sphere);
The class of section operation.
Definition BoolBRepSection.hpp:17

Directly calling the interface as above won't compute parameter curves in the shape. To compute parameter curves, you need to initialize first and then compute the section.

// Make a cone
double r1 = 4.;// The bottom radius
double r2 = 2.;// The top radius
double h = 4.;// The height
// Make a sphere
double r = 4.;
// Compute the section of two shapes
section.Init1(cone);
section.ComputePCurveOn1(true);
section.Init2(sphere);
section.ComputePCurveOn2(true);
section.Build();
// Get the resulting shape
AMCAX::TopoShape result = section.Shape();

Sweep Operations

Extrusion

AMCAX::MakePrism provides extrusion (sweep) functionality.

// Construct a 3D geometric ellipse
double majorRadius = 3.;
double minorRadius = 1.;
AMCAX::MakeGeom3Ellipse mge(frame, majorRadius, minorRadius);
std::shared_ptr<AMCAX::Geom3Curve> curve = mge.Value();
// Make a face
// Make an extrusion shape
AMCAX::Vector3 vec(0.0, 0.0, 1.0);// The extrusion vector
Class of making an edge.
Definition MakeEdge.hpp:26
Class of making a face.
Definition MakeFace.hpp:24
Class of making 3D geometric ellipses.
Definition MakeGeom3Ellipse.hpp:13
Class of making a prism or an extrusion shape.
Definition MakePrism.hpp:18
Class of making a wire.
Definition MakeWire.hpp:19
Class of edge.
Definition TopoEdge.hpp:12
Class of face.
Definition TopoFace.hpp:12
Class of wire.
Definition TopoWire.hpp:12
VectorT< double, 3 > Vector3
3D vector
Definition VectorT.hpp:707

Revolution

AMCAX::MakeRevol provides revolution (sweep) functionality.

// Construct a bezier curve
std::vector<AMCAX::Point3> poles
{ AMCAX::Point3(1.0, 0.0, 0.0),
AMCAX::Point3(0.8, 0.0, 0.5),
AMCAX::Point3(1.0, 0.0, 1.0)
};
auto bezier = std::make_shared<AMCAX::Geom3BezierCurve>(poles);
// Make an edge
// Make a revolved shape
AMCAX::TopoShape revolshape = AMCAX::MakeRevol(e, axis);
static AMCAX_API const Axis3 & OZ() noexcept
Get the z-axis in 3D, including the origin and the z-direction.
Class of making a revolved shape.
Definition MakeRevol.hpp:20
AxisT< double, 3 > Axis3
3D axis
Definition AxisT.hpp:423

Pipe

Create pipes by specifying spine (wire) and profile (shape). Can be implemented using AMCAX::MakePipe or AMCAX::MakePipeShell.

MakePipe

AMCAX::MakePipe class is a simple pipe algorithm, only suitable for single cross-section (planar shape) and smooth path.

// Make a face
AMCAX::Point3 point(0., 0., 0.);
AMCAX::Direction3 dir(-8.57143, 0., 4.);
AMCAX::Frame3 frame(point, dir);
double radius = 0.1;
AMCAX::Circle3 circle = AMCAX::Circle3(frame, radius);
AMCAX::TopoFace Face = AMCAX::MakeFace(Wire);// The profile to be swept
// Compute the resulting curve by interpolating points
std::vector<AMCAX::Point3> points;
points.push_back(AMCAX::Point3(0., 0., 0.));
points.push_back(AMCAX::Point3(-1., 0., 1.));
points.push_back(AMCAX::Point3(0., 0., 2.));
points.push_back(AMCAX::Point3(1., 0., 3.));
points.push_back(AMCAX::Point3(0., 0., 4.));
int degree = 2.;
bool IsClosed = false;
std::shared_ptr<AMCAX::Geom3BSplineCurve> BSplineCurve = AMCAX::NURBSAPIInterpolate::InterpolatePoints(points, degree, IsClosed, AMCAX::ApproxParameterizationType::Centripetal);
// Make a wire
AMCAX::TopoEdge SpineEdge = AMCAX::MakeEdge(BSplineCurve);
AMCAX::TopoWire SpineWire = AMCAX::MakeWire(SpineEdge);// The spine
// Make a pipe
AMCAX::TopoShape Pipe = AMCAX::MakePipe(SpineWire, Face);
Class of make pipe algorithm.
Definition MakePipe.hpp:22
static AMCAX_API std::shared_ptr< Geom3BSplineCurve > InterpolatePoints(const std::vector< Point3 > &points, int degree=3, bool isClosed=false, ApproxParameterizationType ptype=ApproxParameterizationType::ChordLength)
The curve which interpolate the points is constructed.
CircleS< 3 > Circle3
3D circle
Definition CircleT.hpp:187
@ Centripetal
Parameters of points are proportional to square roots of distances between them.
Definition ApproxParameterizationType.hpp:17
DirectionT< double, 3 > Direction3
3D direction
Definition DirectionT.hpp:566

Results shown below:

MakePipeShell

AMCAX::MakePipeShell class is a more complete pipe algorithm, supporting multiple cross-sections (planar shapes) and non-smooth paths. However, the path (should not self-intersect) must intersect with the cross-section plane. Note: Add can only be TopoWire or TopoVertex.

// Construct two profiles
AMCAX::Point3 point1(0., 0., 0.);
AMCAX::Direction3 dir1(-8.57143, 0., 4.);
AMCAX::Frame3 frame1(point1, dir1);
double radius1 = 0.1;
AMCAX::Circle3 circle1 = AMCAX::Circle3(frame1, radius1);
AMCAX::Point3 point2(0., 0., 4.);
AMCAX::Direction3 dir2(-8.57143, 0., 4.);
AMCAX::Frame3 frame2(point2, dir2);
double radius2 = 0.5;
AMCAX::Circle3 circle2 = AMCAX::Circle3(frame2, radius2);
// Compute the spline
std::vector<AMCAX::Point3> points;
points.push_back(AMCAX::Point3(0., 0., 0.));
points.push_back(AMCAX::Point3(-1., 0., 1.));
points.push_back(AMCAX::Point3(0., 0., 2.));
points.push_back(AMCAX::Point3(1., 0., 3.));
points.push_back(AMCAX::Point3(0., 0., 4.));
int degree = 2.;
bool IsClosed = false;
std::shared_ptr<AMCAX::Geom3BSplineCurve> BSplineCurve = AMCAX::NURBSAPIInterpolate::InterpolatePoints(points, degree, IsClosed, AMCAX::ApproxParameterizationType::Centripetal);
// Make a wire
AMCAX::TopoEdge SpineEdge = AMCAX::MakeEdge(BSplineCurve);
AMCAX::TopoWire SpineWire = AMCAX::MakeWire(SpineEdge);
// Make a pipe shell
AMCAX::MakePipeShell mkPipeShell(SpineWire);
mkPipeShell.SetMode(false);// Frenet method
mkPipeShell.SetTransitionMode(AMCAX::TransitionMode::Transformed);
// Add a profile and set parameters
bool withContact = false;
bool withCorrection = true;
mkPipeShell.Add(Wire1, withContact, withCorrection);
mkPipeShell.Add(Wire2, withContact, withCorrection);
// Get the resulting shape
mkPipeShell.Build();
AMCAX::TopoShape pipeshell = mkPipeShell.Shape();
Class of making pipe shell algorithm.
Definition MakePipeShell.hpp:38

Results shown below:

Lofting Operation

AMCAX::MakeLoft class provides lofting functionality. Add several wires to loft a shell or solid.

// Make a polygon
AMCAX::Point3 Point1(1., 0., 0.);
AMCAX::Point3 Point2(-0.5, std::sqrt(3.) * 0.5, 0.);
AMCAX::Point3 Point3(-0.5, -std::sqrt(3.) * 0.5, 0.);
bool isclosed = true;
AMCAX::MakePolygon aPolygon(Point1, Point2, Point3, isclosed);
// Get the polygon wire
AMCAX::TopoWire bottomWire = aPolygon.Wire();
// Get the top wire
double angle = -AMCAX::Constants::pi / 6.0;// The rotation angle
AMCAX::Vector3 vec(0., 0., 3.);
Transform.SetRotation(axis, angle);// The translation vector
Transform.SetTranslationPart(vec);
AMCAX::TopoShape transform = AMCAX::TransformShape(bottomWire, Transform);
// Make a lofting shape
bool isSolid = true;
bool ruled = true;
AMCAX::MakeLoft MakeLoft(isSolid, ruled);
// Add wire
MakeLoft.AddWire(bottomWire);
MakeLoft.AddWire(topWire);
// Get the resulting shape
MakeLoft.Build();
AMCAX::TopoShape loft = MakeLoft.Shape();
Class of making a lofting shape.
Definition MakeLoft.hpp:34
Class of making a polygon.
Definition MakePolygon.hpp:20
static AMCAX_API const TopoWire & Wire(const TopoShape &s)
Cast shape to wire.
Class of transforming a shape.
Definition TransformShape.hpp:12
constexpr void SetTranslationPart(const VectorT< OtherScalar, DIM > &vec) noexcept
Set the translation part of the transformation.
Definition TransformationT.hpp:337
void SetRotation(const PointT< OtherScalar, DIM > &point, const OtherScalar2 &angle) noexcept
Set the transformation as rotation around a point with an angle in 2D.
Definition TransformationT.hpp:138
TransformationT< double, 3 > Transformation3
3D transformation
Definition TransformationT.hpp:1115

Edge Processing

Fillet

Filleting is an operation that replaces sharp edges with smooth surfaces. AMCAX::MakeFillet and AMCAX::MakeFillet2d classes can be used for filleting geometric shapes.

Fillet

Constant Radius

// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the edge in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Edge, edges);
AMCAX::TopoShape e1 = edges[0];
// Perform fillet on the edge
double radius = 1.;
mf.Add(radius, edge);// Add an edge with a radius to the fillet
mf.Build();
// Get the resulting shape
AMCAX::TopoShape box_fillet = mf.Shape();
Template class of indexed set.
Definition IndexSet.hpp:20
The class of fillet.
Definition MakeFillet.hpp:25
static AMCAX_API const TopoEdge & Edge(const TopoShape &s)
Cast shape to edge.
static AMCAX_API void MapShapes(const TopoShape &s, ShapeType t, IndexSet< TopoShape > &shapeSet)
Construct a set of sub-shapes of given type.

Varying Radius

// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the edge in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Edge, edges);
AMCAX::TopoShape e1 = edges[0];
// Perform fillet on the edge
double r1 = 1.;// The start radius
double r2 = 3.;// The end radius
mf.Add(r1, r2, edge);// Add an edge with a linear varying radius
mf.Build();
// Get the resulting shape
AMCAX::TopoShape box_fillet = mf.Shape();

Planar Fillet

// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
AMCAX::TopoShape f = faces[0];
// Get the vertex in f1
AMCAX::TopoExplorerTool::MapShapes(face, AMCAX::ShapeType::Vertex, vertexs);
AMCAX::TopoShape v1 = vertexs[0];
// Make fillet on a vertex of a planar face
double radius = 1.;
mf2d.AddFillet(vertex, radius);// Add a vertex for making fillet with a radius
mf2d.Build();
// Get the resulting shape
AMCAX::TopoShape box_fillet2d = mf2d.Shape();
Class of make fillet and chamfer on a vertex of a planar face.
Definition MakeFillet2d.hpp:22
static AMCAX_API const TopoVertex & Vertex(const TopoShape &s)
Cast shape to vertex.
static AMCAX_API const TopoFace & Face(const TopoShape &s)
Cast shape to face.
Class of vertex.
Definition TopoVertex.hpp:12

Chamfer

Chamfering is an operation that replaces sharp vertices in a face with straight edges. AMCAX::MakeChamfer class can be used for chamfering geometric shapes.

// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the edge in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Edge, edges);
AMCAX::TopoShape e1 = edges[0];
// Perform chamfer on the edge
double dis = 1.;// The distance parameter
mc.Add(dis, edge);// Add an edge used to build chamfers
mc.Build();
// Get the resulting shape
AMCAX::TopoShape box_chamfer = mc.Shape();
The class of chamfer.
Definition MakeChamfer.hpp:22

Shape Deformation

Shape Offset

MakeOffset

AMCAX::MakeOffset class is used to offset 2D Wires. If a Wire is input, it directly offsets it; if a Face is input, it offsets its boundary loop, finally returning the newly generated offset Wire.

// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
// Get the wire of the face
AMCAX::TopoExplorerTool::MapShapes(face, AMCAX::ShapeType::Wire, wires);
// Method 1
// Compute the offset wire
double offset = 1.5;
bool isOpenResult = false;
AMCAX::MakeOffset moffset1(wire, join, isOpenResult);
moffset1.Perform(offset);
// Get the resulting shape
AMCAX::TopoShape offset_wire1 = moffset1.Shape();
// Method 2
// Compute the offset wire
AMCAX::MakeOffset moffset2(face, join, isOpenResult);
moffset2.Perform(offset);
AMCAX::TopoShape offset_wire2 = moffset2.Shape();
Class of making offset wires.
Definition MakeOffset.hpp:21
JoinType
Type of join.
Definition GeometryMacros.hpp:74
@ Arc
Build arc blend.
Definition GeometryMacros.hpp:76

MakeOffsetShape

AMCAX::MakeOffsetShape class is used to offset 3D shapes, supporting input of Faces, Shells, Solids or Compounds composed of these three types. If a single Face is input, it directly offsets that face; if a Shell is input, it offsets the entire Solid it belongs to; if a Solid is input, it directly offsets that solid. If a Compound is input, it directly offsets that Compound.

Processing strategy:

  • Gaps generated by offset can be handled by extension intersection or fillet connection
  • Automatically removes self-intersecting parts generated during offset
  • Supports modeling tracking through Modified and Generated
Input Face
Input Shell
// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the shell in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Shell, shells);
AMCAX::TopoShape shell = shells[0];
// Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
// PerformBySimple
double offsetvalue = 1.2;
moffset1.PerformBySimple(face, offsetvalue);
moffset1.Build();
// Get the resulting shape
AMCAX::TopoShape offsetshape1 = moffset1.Shape();
// PerformByJoin
AMCAX::BRepOffsetMode mode = AMCAX::BRepOffsetMode::Skin;
bool removeIntEdges = false;
moffset2.PerformByJoin(shell, offsetvalue, tol, mode, false, false, join, removeIntEdges);
moffset2.Build();
// Get the resulting shape
AMCAX::TopoShape offsetshape2 = moffset2.Shape();
Class of build a shell out of a shape algorithm.
Definition MakeOffsetShape.hpp:20
AMCAX_API void PerformByJoin(const TopoShape &s, double offset, double tol, BRepOffsetMode mode=BRepOffsetMode::Skin, bool intersection=false, bool selfInter=false, JoinType join=JoinType::Arc, bool removeIntEdges=false)
Construct a shape parallel to a given shape.
AMCAX_API void PerformBySimple(const TopoShape &s, double offsetValue)
Construct an offset shape using the simple algorithm without intersections computation.
AMCAX_API void Build() override
Perform the algorithm.
static constexpr double Confusion() noexcept
Get the confusion tolerance.
Definition Precision.hpp:122
BRepOffsetMode
Type of offset mode.
Definition BRepOffsetMacros.hpp:11

MakeOffsetWire

AMCAX::MakeOffsetWire class is used to offset wires on a plane. Compared with MakeOffset, MakeOffsetWire supports changes in topology; supports extension intersection transition or arc transition at unconnected places; supports tracking through Generated function.

// Make outerWire
std::vector<AMCAX::Point3> points1;
points1.push_back(AMCAX::Point3(-1.0, -1.0, 0.0));
points1.push_back(AMCAX::Point3(1.0, -1.0, 0.0));
points1.push_back(AMCAX::Point3(1.0, 1.0, 0.0));
points1.push_back(AMCAX::Point3(-1.0, 1.0, 0.0));
for (const auto& p : points1)
{
mp1.Add(p);
}
mp1.Close();
auto outerWire = mp1.Wire();
// Make innerWire
std::vector<AMCAX::Point3> points2;
points2.push_back(AMCAX::Point3(0.0, -0.5, 0.0));
points2.push_back(AMCAX::Point3(-0.5, 0.0, 0.0));
points2.push_back(AMCAX::Point3(0.0, 0.5, 0.0));
points2.push_back(AMCAX::Point3(0.5, 0.0, 0.0));
for (const auto& p : points2)
{
mp2.Add(p);
}
mp2.Close();
auto innerWire = mp2.Wire();
// Make a face
auto surface = std::make_shared<AMCAX::Geom3Plane>();// xoy
builder.MakeFace(face, surface, AMCAX::Precision::Confusion());
builder.Add(face, innerWire);
builder.Add(face, outerWire);
// Make offset wire
double offset = 0.1;
{
AMCAX::MakeOffsetWire moffset(face, innerWire, join, offset);
auto result = moffset.Shape();
}
{
AMCAX::MakeOffsetWire moffset(face, innerWire, join, -offset);
auto result = moffset.Shape();
}
{
AMCAX::MakeOffsetWire moffset(face, innerWire, join, offset);
auto result = moffset.Shape();
}
{
AMCAX::MakeOffsetWire moffset(face, innerWire, join, -offset);
auto result = moffset.Shape();
}
Class of making offset wires, it support wire offset on the plane or parameter domain.
Definition MakeOffsetWire.hpp:21
AMCAX_API void Close()
Close the polygon.
AMCAX_API void Add(const Point3 &p)
Add a new point to the polygon.
AMCAX_API const TopoWire & Wire()
Get the polygon result.
Class of a tool for building B-Rep structure.
Definition TopoBuilder.hpp:39
AMCAX_API void MakeFace(TopoFace &f) const
Make an empty face.
AMCAX_API void Add(TopoShape &s, const TopoShape &c) const
Add a sub-shape to a shape.
@ Intersection
Build two tangent lines at the end of the edges and intersect the lines.
Definition GeometryMacros.hpp:79

Examples of topology changes: (Blue-black is input, blue is expected result, red is parts generated during construction that need to be deleted)

Shape Thickening

AMCAX::MakeThickSolid class provides shape thickening functionality.

Before thickening
After thickening
// Make a box
AMCAX::Point3 p1(-5.0, -5.0, 0.0);// diagonal corner points
AMCAX::Point3 p2(5.0, 5.0, 3.0);// diagonal corner points
// Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
// Make a thick solid
double offsetvalue = 1.5;
ts.MakeThickBySimple(face, offsetvalue);
ts.Build();
// Get the resulting shape
AMCAX::TopoShape thicksolid = ts.Shape();
Class of making a thick solid shape.
Definition MakeThickSolid.hpp:12
AMCAX_API void Build() override
Perform the algorithm.
AMCAX_API void MakeThickBySimple(const TopoShape &s, double offsetValue)
Make a thick solid using simple algorithm, only for a non-closed single face or shell which contain t...

Face Replacement

AMCAX::BoolBRepReplaceFace class provides face replacement functionality. That is, select a face in a solid and replace it with another surface. The basic logic is to extend the faces around the face to be replaced, intersect with the new surface and reconstruct the topology. However, if the surface cannot cover the face to be replaced, the replacement will fail.

Before replacement
After replacement
// Construct a cylinder
double radius = 5.;
double height = 10.;
AMCAX::TopoShape cylinder = AMCAX::MakeCylinder(radius, height);
// Get the face in box
AMCAX::TopoExplorerTool::MapShapes(cylinder, AMCAX::ShapeType::Face, faces);
// Replace the feature faces in solid with surface
AMCAX::Point3 point(0., 0., 12.);
AMCAX::Direction3 dir(0.2, 0.2, 1.0);
AMCAX::Plane plane(point, dir);
std::shared_ptr<AMCAX::Geom3Plane> surf = std::make_shared<AMCAX::Geom3Plane>(plane);
rf.SetShape(cylinder);
rf.AddFaceToReplace(topface);
rf.Build();
if (rf.IsDone())
{
// Get the resulting shape
AMCAX::TopoShape result = rf.Shape();
}
The class of replace the feature faces in solid with surface. The input surface must be large enough ...
Definition BoolBRepReplaceFace.hpp:17
AMCAX_API void SetShape(const TopoShape &shape) noexcept
Set the shape for replace face feature algorithm.
AMCAX_API void SetReplaceSurface(const std::shared_ptr< Geom3Surface > &surface) noexcept
Set the surface with which the feature face is replaced.
AMCAX_API void AddFaceToReplace(const TopoShape &face)
Adds the face to be replaced from the input shape;.
AMCAX_API void Build() override
Perform the algorithm.
virtual AMCAX_API bool IsDone() const noexcept
Is the construction algorithm done.
Class of Plane.
Definition Plane.hpp:13

Some images are sourced from: https://dev.opencascade.org/doc/overview/html/index.html , the copyright belongs to its owner.