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

Create Basic Shape

Basic shape include box, cylinder, cone/frustum, sphere, and torus.

Box

AMCAX::MakeBox class provides functionality to create a box.

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, 0.0), AMCAX::Point3(5.0, 5.0, 3.0));
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
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459

Cylinder

AMCAX::MakeCylinder class provides functionality to create a cylinder.

AMCAX::TopoShape cylinder = AMCAX::MakeCylinder(AMCAX::Frame3(AMCAX::Point3(0.0, 0.0, 0.0), AMCAX::Direction3(0.0, 0.0, 1.0)), 3.0, 5.0);
Class of making a cylinder.
Definition MakeCylinder.hpp:18
DirectionT< double, 3 > Direction3
3D direction
Definition DirectionT.hpp:566
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:887

Cone/Frustum

AMCAX::MakeCone class provides functionality to create a cone or frustum.

AMCAX::TopoShape cone = AMCAX::MakeCone(4.0, 0.0, 4.0);
Class of making a cone.
Definition MakeCone.hpp:18

Sphere

AMCAX::MakeSphere class provides functionality to create a sphere.

AMCAX::TopoShape sphere = AMCAX::MakeSphere(AMCAX::Point3(-3.0, 0.0, 0.0), 1.0);
Class of making a sphere.
Definition MakeSphere.hpp:18

Torus

AMCAX::MakeTorus class provides functionality to create a torus.

AMCAX::TopoShape torus = AMCAX::MakeTorus(AMCAX::Frame3(AMCAX::Point3(0.0, 0.0, 2.0), AMCAX::Direction3(1.0, 0.0, 0.0)), 4.0, 2.0);
Class of making a torus.
Definition MakeTorus.hpp:21

Boolean Operation

Boolean operation functionalities include union, intersection, cut, split, and section.

Union

AMCAX::BoolBRepFuse class provides the union functionality.

AMCAX::TopoShape shape1, shape2;
AMCAX::OCCTIO::OCCTTool::Read(shape1, "./data/part.brep");
AMCAX::OCCTIO::OCCTTool::Read(shape2, "./data/box.brep");
//Fuse
AMCAX::TopoShape fuse = AMCAX::BoolBRepFuse(shape1, shape2);
The class of fuse operation.
Definition BoolBRepFuse.hpp:15
static AMCAX_API bool Read(TopoShape &s, std::istream &is)
Read a shape from a stream.

Intersection

AMCAX::BoolBRepCommon class provides the intersection functionality.

AMCAX::TopoShape shape1, shape2;
AMCAX::OCCTIO::OCCTTool::Read(shape1, "./data/part.brep");
AMCAX::OCCTIO::OCCTTool::Read(shape2, "./data/box.brep");
//Common
AMCAX::TopoShape common = AMCAX::BoolBRepCommon(shape1, shape2);
The class of common operation.
Definition BoolBRepCommon.hpp:14

Cut

AMCAX::BoolBRepCut class provides the cut functionality.

//Cut
The class of cut operation.
Definition BoolBRepCut.hpp:15

Split

AMCAX::BoolBRepSplitter class provides the split functionality.

AMCAX::TopoShape shape1, shape2;
AMCAX::OCCTIO::OCCTTool::Read(shape1, "./data/part.brep");
AMCAX::OCCTIO::OCCTTool::Read(shape2, "./data/box.brep");
//Splitter
auto tool_shape = std::list{ shape1 };
auto tool_argument = std::list{ shape2 };
splitter.SetTools(tool_shape);
splitter.SetArguments(tool_argument);
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

The AMCAX::BoolBRepSection class provides functionality to compute intersection curves, with the results stored as a TopoCompound.

AMCAX::TopoShape section = AMCAX::BoolBRepSection(cone, sphere);
The class of section operation.
Definition BoolBRepSection.hpp:17

Calling the interface directly as shown above will ​not​ compute the parametric curves within the shapes. To compute parametric curves, you must first initialize the operation and then compute the intersection.

section.Init1(cone);
section.ComputePCurveOn1(true);
section.Init2(sphere);
section.ComputePCurveOn2(true);
section.Build();
AMCAX::TopoShape result = section.Shape();

​# ​Sweep Operation​

Extrude

AMCAX::MakePrism provides the extrude (sweep) functionality.

AMCAX::MakeGeom3Ellipse makeEllipse(AMCAX::Frame3(), 3.0, 1.0);
std::shared_ptr<AMCAX::Geom3Curve> curve = makeEllipse.Value();
//Make an extrusion shape
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

Rotation

AMCAX::MakeRevol class provides the rotation (sweep) functionality.

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 bz = std::make_shared<AMCAX::Geom3BezierCurve>(poles);
//Make a revolved shape
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

Pipe

The pipe is created by specifying the spine (wire) and profile (shape). This can be done using AMCAX::MakePipe or AMCAX::MakePipeShell. MakePipe is for simpler pipe algorithms, suitable for a single section (planar shape) and a smooth path. MakePipeShell is a more complete pipe algorithm, supporting multiple sections and non-smooth paths, but the path must intersect with the section plane. Note that Add can only be TopoWire or TopoVertex.

//Makepipe
//Make a face
double radius = 0.1;
AMCAX::Frame3 aFrame(AMCAX::Point3(0., 0., 0.), AMCAX::Direction3(-8.57143, 0., 4.));
AMCAX::Circle3 aCircle = AMCAX::Circle3(aFrame, radius);
//Make a curve
std::vector<AMCAX::Point3> pointSet;
pointSet.push_back(AMCAX::Point3(0., 0., 0.));
pointSet.push_back(AMCAX::Point3(-1., 0., 1.));
pointSet.push_back(AMCAX::Point3(0., 0., 2.));
pointSet.push_back(AMCAX::Point3(1., 0., 3.));
pointSet.push_back(AMCAX::Point3(0., 0., 4.));
std::shared_ptr<AMCAX::Geom3BSplineCurve> aBSplineCurve = AMCAX::NURBSAPIInterpolate::InterpolatePoints(pointSet,
//Make a wire
AMCAX::TopoEdge aSpineEdge = AMCAX::MakeEdge(aBSplineCurve);
AMCAX::TopoWire aSpineWire = AMCAX::MakeWire(aSpineEdge);
//Make a pipe
AMCAX::TopoShape aPipe = AMCAX::MakePipe(aSpineWire, aFace);
//MakePipeShell
AMCAX::MakePipeShell ps(aSpineWire);
ps.Add(aWire, false, false);
ps.Build();
Class of make pipe algorithm.
Definition MakePipe.hpp:22
Class of making pipe shell algorithm.
Definition MakePipeShell.hpp:38
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

Loft Operation

AMCAX::MakeLoft class provides loft functionality. By adding multiple wires, a shell or solid can be lofted.

//Make a polygon
AMCAX::Point3 aPoint1(1.0, 0.0, 0.0);
AMCAX::Point3 aPoint2(-0.5, std::sqrt(3.0) * 0.5, 0.0);
AMCAX::Point3 aPoint3(-0.5, -std::sqrt(3.0) * 0.5, 0.0);
AMCAX::MakePolygon aPolygon(aPoint1, aPoint2, aPoint3, true);
//Get the polygon wire
AMCAX::TopoWire bottomWire = aPolygon.Wire();
//Get the top wire
aTransform.SetTranslationPart(AMCAX::Vector3(0.0, 0.0, 3.0));
AMCAX::TopoWire topWire = AMCAX::TopoCast::Wire(AMCAX::TransformShape(bottomWire, aTransform));
//Make a lofting shape
AMCAX::MakeLoft aMakeLoft(true, true);
aMakeLoft.AddWire(bottomWire);
aMakeLoft.AddWire(topWire);
aMakeLoft.Build();
AMCAX::TopoShape loft = aMakeLoft.Shape();
Class of making a lofting shape.
Definition MakeLoft.hpp:33
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
constexpr double pi
Mathematical constant Pi, ratio of a circle's circumference to its diameter.
Definition Constants.hpp:42
TransformationT< double, 3 > Transformation3
3D transformation
Definition TransformationT.hpp:1115

Edge Processing

Fillet

Fillet replaces sharp edges with smooth surfaces. The AMCAX::MakeFillet class and the AMCAX::MakeFillet2d class provide fillet functionality.

MakeFillet

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//Get the edge in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Edge, edges);
AMCAX::TopoShape e1 = edges[0];
//Make fillet
mf.Add(1.0, AMCAX::TopoCast::Edge(e1));
mf.Build();
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.

MakeFillet2d

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//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(f1, AMCAX::ShapeType::Vertex, vertex);
AMCAX::TopoShape v1 = vertex[0];
//Make fillet2d
mf2d.AddFillet(AMCAX::TopoCast::Vertex(v1), 1.0);
mf2d.Build();
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.

Chamfer

AMCAX::MakeChamfer class provides the chamfer functionality.

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//Get the edge in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Edge, edges);
AMCAX::TopoShape e1 = edges[0];
//Perform chamfer on a given shape
mc.Add(1.0, AMCAX::TopoCast::Edge(e1));
mc.Build();
AMCAX::TopoShape box_chamfer = mc.Shape();
The class of chamfer.
Definition MakeChamfer.hpp:22

Shape Deformation​​

Shape Offset

The AMCAX::MakeOffset class and AMCAX::MakeOffsetShape class provide the functionality for shape offset.

MakeOffset (Offset for 2D Shapes)

The input is a wire for offset, and for a face, the boundary of the face is offset, returning the wire after offset.

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
AMCAX::TopoShape f = faces[0];
//Get the wire of the f
AMCAX::TopoExplorerTool::MapShapes(f, AMCAX::ShapeType::Wire, wire);
//Make offset wire
double offset = 1.5;
bool isOpenResult = false;
AMCAX::MakeOffset MakeOffset(w, theJoin, isOpenResult);
MakeOffset.Perform(offset);
AMCAX::TopoShape offset1 = MakeOffset.Shape();
//Make offset face
AMCAX::MakeOffset MakeOffset2(f1, theJoin, isOpenResult);
MakeOffset2.Perform(offset);
AMCAX::TopoShape offset2 = MakeOffset2.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 (Offset for 3D Shapes)

Offset the input face. If the input is a shell, offset the entire solid of it. Finally, return the offset face or solid. For the gaps caused by offsetting, you can choose to use extension to find intersections or fillets for connection. The self - intersecting parts caused by offsetting will be deleted. Additionally, modeling tracking can be performed through Modified and Generated.

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
AMCAX::TopoShape f = faces[0];
//Make offset face
AMCAX::MakeOffsetShape MakeOffsetShape;
double offsetvalue = 1.2;
MakeOffsetShape.PerformBySimple(f, offsetvalue);
MakeOffsetShape.Build();
AMCAX::TopoShape offsetshape1 = MakeOffsetShape.Shape();
AMCAX::OCCTIO::OCCTTool::Write(offsetshape1, "MakeOffsetShape-face.brep");
//Make offset face
AMCAX::MakeOffsetShape MakeOffsetShape2;
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Shell, shell);
AMCAX::TopoShape s = shell[0];
MakeOffsetShape2.PerformBySimple(s, offsetvalue);
MakeOffsetShape2.Build();
AMCAX::TopoShape offsetshape2 = MakeOffsetShape2.Shape();
Class of build a shell out of a shape algorithm.
Definition MakeOffsetShape.hpp:20
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 AMCAX_API bool Write(const TopoShape &s, std::ostream &os, int format=3)
Write a shape to a stream.

MakeOffsetWire

This function also offsets a wire in a plane but supports topological changes. It allows for extending and intersecting at disconnected areas or creating arc transitions. It also supports tracking through the Generated function.

//Make a 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();
const auto& outerWire = mp1.Wire();
//Make a 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();
const auto& innerWire = mp2.Wire();
//Make a face
auto surf = std::make_shared<AMCAX::Geom3Plane>();
b.Add(f, innerWire);
b.Add(f, outerWire);
//Make offset wire
double offset = 0.1;
{
AMCAX::MakeOffsetWire mow(f, innerWire, join, offset);
const auto& result = mow.Shape();
}
{
AMCAX::MakeOffsetWire mow(f, innerWire, join, -offset);
const auto& result = mow.Shape();
}
{
AMCAX::MakeOffsetWire mow(f, innerWire, join, offset);
const auto& result = mow.Shape();
}
{
AMCAX::MakeOffsetWire mow(f, innerWire, join, -offset);
const auto& result = mow.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.
static constexpr double Confusion() noexcept
Get the confusion tolerance.
Definition Precision.hpp:122
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

Example of topological structure changes:​​ (Blue-black lines represent input geometry, Blue lines indicate the desired final result, Red lines show intermediate construction elements that require removal)

Shape Thicken

AMCAX::MakeThickSolid class provides the functionality to thicken shape.

AMCAX::TopoShape box = AMCAX::MakeBox(AMCAX::Point3(-5.0, -5.0, -5.0), AMCAX::Point3(5.0, 5.0, 5.0));
//Get the face in box
AMCAX::TopoExplorerTool::MapShapes(box, AMCAX::ShapeType::Face, faces);
AMCAX::TopoShape f = faces[0];
//Make a thick solid
double offsetvalue = 1.5;
ts.MakeThickBySimple(f, offsetvalue);
ts.Build();
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...

Replace Face

The AMCAX::BoolBRepReplaceFace class provides the functionality to replace a face. This allows you to select a face from a solid and replace it with another surface. The basic logic involves extending the surrounding faces of the replaced face, intersecting them with the new surface, and reconstructing the topology. If the surface cannot cover the replaced face, the replacement will fail.

//Get the face in box
AMCAX::TopoExplorerTool::MapShapes(cylinder, AMCAX::ShapeType::Face, shapeFaces);
AMCAX::TopoFace upface = AMCAX::TopoCast::Face(shapeFaces[1]);
// Replace the feature faces in solid with surface
AMCAX::Plane plane(AMCAX::Point3(0., 0., 12.), AMCAX::Direction3(0.2, 0.2, 1.0));
std::shared_ptr<AMCAX::Geom3Plane> surf = std::make_shared<AMCAX::Geom3Plane>(plane);
rf.SetShape(cylinder);
rf.AddFaceToReplace(upface);
rf.Build();
if (rf.IsDone())
{
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.