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.;
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.
double dx = 1.;
double dy = 2.;
double dz = 3.;
PointT< double, 3 > Point3
3D point
Definition PointT.hpp:459
Construct a box using two diagonal points.
Construct a box using a local coordinate system and three dimensions dx, dy, and dz.
double dx = 2.;
double dy = 3.;
double dz = 4.;
FrameT< double, 3 > Frame3
3D frame
Definition FrameT.hpp:887
Cylinder
AMCAX::MakeCylinder provides functionality to create cylinders.
double r = 3.;
double h = 5.;
Class of making a cylinder.
Definition MakeCylinder.hpp:18
Cone/Frustum
AMCAX::MakeCone provides functionality to create cones/frustums.
double r1 = 4.;
double r2 = 2.;
double h = 4.;
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.;
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.;
constexpr double quarter_pi
pi/4
Definition Constants.hpp:58
Construct a partial segmented sphere using radius, angle range, and rotation angle.
Torus
AMCAX::MakeTorus provides functionality to create tori.
Construct a complete torus using major and minor radii.
double r1 = 4.;
double r2 = 2.;
Class of making a torus.
Definition MakeTorus.hpp:21
Construct a partial torus using major radius, minor radius, and rotation angle.
double r1 = 4.;
double r2 = 2.;
Construct a segmented torus using major radius, minor radius, and angle range.
double r1 = 4.;
double r2 = 2.;
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.;
double r2 = 2.;
Boolean Operations
Boolean operations include fuse, common, cut, split, and section computation.
Fuse
AMCAX::BoolBRepFuse provides fuse functionality.
double dx = 1.;
double dy = 1.;
double dz = 1.;
double r1 = 4.;
double r2 = 2.;
The class of fuse operation.
Definition BoolBRepFuse.hpp:15
Common
AMCAX::BoolBRepCommon provides common functionality.
double dx = 5.;
double dy = 5.;
double dz = 5.;
double r1 = 4.;
double r2 = 2.;
The class of common operation.
Definition BoolBRepCommon.hpp:14
Cut
AMCAX::BoolBRepCut provides cut functionality.
double r1 = 4.;
double r2 = 2.;
double h = 4.;
double r = 4.;
The class of cut operation.
Definition BoolBRepCut.hpp:15
Split
AMCAX::BoolBRepSplitter provides split functionality.
double dx = 5.;
double dy = 5.;
double dz = 5.;
double r1 = 4.;
double r2 = 2.;
auto tool_shape = std::list{ box };
auto tool_argument = std::list{ torus };
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.
double r1 = 4.;
double r2 = 2.;
double h = 4.;
double r = 4.;
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.
double r1 = 4.;
double r2 = 2.;
double h = 4.;
double r = 4.;
section.Init1(cone);
section.ComputePCurveOn1(true);
section.Init2(sphere);
section.ComputePCurveOn2(true);
section.Build();
Sweep Operations
Extrusion
AMCAX::MakePrism provides extrusion (sweep) functionality.
double majorRadius = 3.;
double minorRadius = 1.;
std::shared_ptr<AMCAX::Geom3Curve> curve = mge.Value();
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.
std::vector<AMCAX::Point3> poles
};
auto bezier = std::make_shared<AMCAX::Geom3BezierCurve>(poles);
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.
double radius = 0.1;
std::vector<AMCAX::Point3> points;
int degree = 2.;
bool IsClosed = false;
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.
double radius1 = 0.1;
double radius2 = 0.5;
std::vector<AMCAX::Point3> points;
int degree = 2.;
bool IsClosed = false;
mkPipeShell.SetMode(false);
mkPipeShell.SetTransitionMode(AMCAX::TransitionMode::Transformed);
bool withContact = false;
bool withCorrection = true;
mkPipeShell.Add(Wire1, withContact, withCorrection);
mkPipeShell.Add(Wire2, withContact, withCorrection);
mkPipeShell.Build();
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.
bool isclosed = true;
bool isSolid = true;
bool ruled = true;
MakeLoft.AddWire(bottomWire);
MakeLoft.AddWire(topWire);
MakeLoft.Build();
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.
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
double radius = 1.;
mf.Add(radius, edge);
mf.Build();
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.
Varying Radius
double r1 = 1.;
double r2 = 3.;
mf.Add(r1, r2, edge);
mf.Build();
Planar Fillet
double radius = 1.;
mf2d.AddFillet(vertex, radius);
mf2d.Build();
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.
double dis = 1.;
mc.Add(dis, edge);
mc.Build();
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.
double offset = 1.5;
bool isOpenResult = false;
moffset1.Perform(offset);
moffset2.Perform(offset);
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
double offsetvalue = 1.2;
bool removeIntEdges = false;
moffset2.
PerformByJoin(shell, offsetvalue, tol, mode,
false,
false, join, removeIntEdges);
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.
std::vector<AMCAX::Point3> points1;
for (const auto& p : points1)
{
}
auto outerWire = mp1.
Wire();
std::vector<AMCAX::Point3> points2;
for (const auto& p : points2)
{
}
auto innerWire = mp2.
Wire();
auto surface = std::make_shared<AMCAX::Geom3Plane>();
builder.
Add(face, innerWire);
builder.
Add(face, outerWire);
double offset = 0.1;
{
auto result = moffset.Shape();
}
{
auto result = moffset.Shape();
}
{
auto result = moffset.Shape();
}
{
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
double offsetvalue = 1.5;
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
double radius = 5.;
double height = 10.;
std::shared_ptr<AMCAX::Geom3Plane> surf = std::make_shared<AMCAX::Geom3Plane>(plane);
{
}
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.