MakeShape
快捷创建拓扑结构是一项基础需求,而 AMCAX::MakeVertex、AMCAX::MakeEdge、AMCAX::MakeWire、AMCAX::MakeFace 等提供了不同拓扑结构的快捷创建方式,这是极为常用且重要的功能。
MakeVertex
创建 Vertex 可通过一个 Point3 实现:
// Construct a vertex from a point
AMCAX::Point3 p1(1., 2., 3.);
AMCAX::TopoVertex v = AMCAX::MakeVertex(p1);
MakeEdge
AMCAX::MakeEdge 可通过 Curve 快捷创建 Edge。若 MakeEdge 的输入中未包含 Vertex,它会自动生成两个 Vertex。这意味着,若想通过 MakeEdge 构建两条相连的 Edge,需特别注意 Vertex 的共用问题 —— 简单创建会得到 2 个 Edge 和 4 个 Vertex。此外,退化边也可通过 MakeEdge 构建。MakeEdge 功能丰富,下文将分类介绍:
简单构建
可通过两个 Point3 构建线段 Edge,也可通过两个 TopoVertex 构建。需要注意的是,两个 Point3/TopoVertex 之间的距离需大于 AMCAX::Precision::Confusion (),否则会被判定为同一个 Point3/TopoVertex。
// Construct an edge from two points
AMCAX::Point3 p1(0., 0., 0.);
AMCAX::Point3 p2(1.0, 0.0, 0.0);
AMCAX::TopoEdge edge1 = AMCAX::MakeEdge(p1, p2);
// Construct from two vertices
AMCAX::TopoVertex v1 = AMCAX::MakeVertex(p1);
AMCAX::TopoVertex v2 = AMCAX::MakeVertex(p2);
AMCAX::TopoEdge edge2 = AMCAX::MakeEdge(v1, v2);
基于数学表达构建
例如,可基于 Circle3、Line3 等数学表达式构建,以下以 Line3 为例:
// Construct from an infinite line
AMCAX::Point3 p(0., 0., 0.);
AMCAX::Direction3 dir(1.0, 0.0, 0.0);
AMCAX::Line3 line(p, dir);
AMCAX::TopoEdge edge1 = AMCAX::MakeEdge(line);
// Construct from a line with parameter bounds
double fp = 0.0;
double lp = 1.0;
AMCAX::TopoEdge edge2 = AMCAX::MakeEdge(line, fp, lp);
// Construct from a line with two end points
AMCAX::Point3 p1(0., 0., 0.);// The first point
AMCAX::Point3 p2(1.0, 0.0, 0.0);// The second point
AMCAX::TopoEdge edge3 = AMCAX::MakeEdge(line, p1, p2);
// Construct from a line with two end vertices
AMCAX::TopoVertex v1 = AMCAX::MakeVertex(p1);// The first vertex
AMCAX::TopoVertex v2 = AMCAX::MakeVertex(p2);// The second vertex
AMCAX::TopoEdge edge4 = AMCAX::MakeEdge(line, v1, v2);
此外,MakeEdge 会根据数学表达自动调整参数、Point3、Vertex 的顺序,以及 Vertex 的 Orientation:
AMCAX::TopoEdge edge5 = AMCAX::MakeEdge(line, lp, fp); // same as MakeEdge(line, fp, lp)
AMCAX::TopoEdge edge6 = AMCAX::MakeEdge(line, p2, p1); // same as MakeEdge(line, p1, p2)
AMCAX::TopoEdge edge7 = AMCAX::MakeEdge(line, v2, v1); // same as MakeEdge(line, v1, v2)
基于 curve 3d 构建
这是基于 curve 构建 Edge 的重要功能。在此,MakeEdge 仍会自动调整参数、Point3、Vertex 的顺序,以及 Vertex 的 Orientation。具体构建方法如下:
// Construct from a curve
AMCAX::Point3 p(0., 0., 0.);
AMCAX::Direction3 dir(1.0, 0.0, 0.0);
AMCAX::Line3 line(p, dir);
std::shared_ptr<AMCAX::Geom3Curve> curve = std::make_shared<AMCAX::Geom3Line>(line);
AMCAX::TopoEdge edge1 = AMCAX::MakeEdge(curve);
// Construct from a curve with parameter bounds
double fp = 0.0;
double lp = 1.0;
AMCAX::TopoEdge edge2 = AMCAX::MakeEdge(curve, fp, lp);
// Construct from a curve with two end points
AMCAX::Point3 p1(0., 0., 0.);// The first point
AMCAX::Point3 p2(1.0, 0.0, 0.0);// The second point
AMCAX::TopoEdge edge3 = AMCAX::MakeEdge(curve, p1, p2);
// Construct from a curve with two end points and their parameters
AMCAX::TopoEdge edge4 = AMCAX::MakeEdge(curve, p1, p2, fp, lp);
// Construct from a curve with two end vertices
AMCAX::TopoVertex v1 = AMCAX::MakeVertex(p1);// The first vertex
AMCAX::TopoVertex v2 = AMCAX::MakeVertex(p2);// The second vertex
AMCAX::TopoEdge edge5 = AMCAX::MakeEdge(curve, v1, v2);
// Construct from a curve with two end vertices and their parameters
AMCAX::TopoEdge edge6 = AMCAX::MakeEdge(curve, v1, v2, fp, lp);
基于 pcurve 构建
需要注意的是,基于 pcurve 与 Surface 构建的 Edge 不包含 curve3d。在此,MakeEdge 仍会自动调整参数、Point3、Vertex 的顺序,以及 Vertex 的 Orientation。具体构建方法如下:
// Construct from a pcurve on a surface
AMCAX::Point2 point(0., 0.);
AMCAX::Direction2 dir(1., 0.);
std::shared_ptr<AMCAX::Geom2Curve> pcurve = std::make_shared<AMCAX::Geom2Line>(point, dir);
AMCAX::Frame3 frame;
std::shared_ptr<AMCAX::Geom3Surface> surf = std::make_shared<AMCAX::Geom3Plane>(frame); // xoy
AMCAX::TopoEdge edge1 = AMCAX::MakeEdge(pcurve, surf);
// Construct from a pcurve on a surface with parameter bounds
double fp = 0.0;
double lp = 1.0;
AMCAX::TopoEdge edge2 = AMCAX::MakeEdge(pcurve, surf, fp, lp);
// Construct from a pcurve on a surface with two end points
AMCAX::Point3 p1(0., 0., 0.);// The first point
AMCAX::Point3 p2(1.0, 0.0, 0.0);// The second point
AMCAX::TopoEdge edge3 = AMCAX::MakeEdge(pcurve, surf, p1, p2);
// Construct from a pcurve on a surface with two end points and their parameters
AMCAX::TopoEdge edge4 = AMCAX::MakeEdge(pcurve, surf, p1, p2, fp, lp);
// Construct from a pcurve on a surface with two end vertices
AMCAX::TopoVertex v1 = AMCAX::MakeVertex(p1);// The first vertex
AMCAX::TopoVertex v2 = AMCAX::MakeVertex(p2);// The second vertex
AMCAX::TopoEdge edge5 = AMCAX::MakeEdge(pcurve, surf, v1, v2);
// Construct from a pcurve on a surface with two end vertices and their parameters
AMCAX::TopoEdge edge6 = AMCAX::MakeEdge(pcurve, surf, v1, v2, fp, lp);
MakeWire
构建一个 Wire 可以通过以下三种方式:
单独添加 Edge
// Make edge
AMCAX::Point3 p1(-4.0, -1.0, 0.0);
AMCAX::Point3 p2(4.0, -1.0, 0.0);
AMCAX::Point3 p3(4.0, 1.0, 0.0);
AMCAX::Point3 p4(-4.0, 1.0, 0.0);
AMCAX::TopoEdge e1 = AMCAX::MakeEdge(p1, p2);
AMCAX::TopoEdge e2 = AMCAX::MakeEdge(p2, p3);
AMCAX::TopoEdge e3 = AMCAX::MakeEdge(p3, p4);
AMCAX::TopoEdge e4 = AMCAX::MakeEdge(p4, p1);
// Add an edge to the wire
AMCAX::MakeWire makewire1;
makewire1.Add(e1);
makewire1.Add(e2);
makewire1.Add(e3);
makewire1.Add(e4);
// Get the wire
AMCAX::TopoWire wire = makewire1.Wire();
// Error
AMCAX::MakeWire makewire2;
makewire2.Add(e1);
makewire2.Add(e3);
std::cout << makewire2.IsDone() << std::endl;// 0
std::cout << "error type:" << int(makewire2.Error());// 2
![图片[1]-九韶内核:拓扑结构的构建-卡核](https://docs.amcax.net/v5_0_0/zh_cn/html/brep2_1.png)
注:每次添加的边必须与已添加的边在几何上相连。在上述示例中,若按 e1—e3—e2—e4 的顺序添加,在添加 e3 时会因与 e1 不相连而失败,此时调用 IsDone () 将返回 false,调用 Error () 将返回 WireError::DisconnectedWire。若能确定待连成 wire 的 edge 彼此相连但不清楚具体连接关系,则必须采用下文一次性添加 edge 列表的方式。
添加 Edge 的 list
列表中 edge 的顺序不影响构造结果。
// Make edge
AMCAX::Point3 p1(-4.0, -1.0, 0.0);
AMCAX::Point3 p2(4.0, -1.0, 0.0);
AMCAX::Point3 p3(4.0, 1.0, 0.0);
AMCAX::Point3 p4(-4.0, 1.0, 0.0);
AMCAX::TopoEdge e1 = AMCAX::MakeEdge(p1, p2);
AMCAX::TopoEdge e2 = AMCAX::MakeEdge(p2, p3);
AMCAX::TopoEdge e3 = AMCAX::MakeEdge(p3, p4);
AMCAX::TopoEdge e4 = AMCAX::MakeEdge(p4, p1);
// Add a list of edges to the wire
std::list<AMCAX::TopoShape> elist = { e1, e3, e2, e4 };
AMCAX::MakeWire makewire;
makewire.Add(elist);
// Get the wire
AMCAX::TopoWire wire = makewire.Wire();
添加 wire
在添加 wire 时,要求待添加 wire 的第一条 edge 需与已有的 wire 相连,Add 操作才能成功。
// Make edge
AMCAX::Point3 p1(10., 0., 0.);
AMCAX::Point3 p2(15., 5., 0.);
AMCAX::Point3 p3(15., 10., 0.);
AMCAX::Point3 p4(10., 15., 0.);
AMCAX::Point3 p5(5., 15., 0.);
AMCAX::Point3 p6(0., 10., 0.);
AMCAX::TopoEdge e1 = AMCAX::MakeEdge(p1, p2);
AMCAX::TopoEdge e2 = AMCAX::MakeEdge(p2, p3);
AMCAX::TopoEdge e3 = AMCAX::MakeEdge(p3, p4);
AMCAX::TopoEdge e4 = AMCAX::MakeEdge(p4, p5);
AMCAX::TopoEdge e5 = AMCAX::MakeEdge(p5, p6);
// Make wire123
AMCAX::MakeWire mw1(e1, e2, e3);
AMCAX::TopoWire wire123 = mw1.Wire();
// Make wire45
AMCAX::MakeWire mw2(e4, e5);
AMCAX::TopoWire wire45 = mw2.Wire();
// Add wire45 to wire123
AMCAX::MakeWire mw3(wire123);
mw3.Add(wire45);
AMCAX::TopoWire wire12345 = mw3.Wire();
// Error
// Make wire54
AMCAX::MakeWire mw4(e5, e4);
AMCAX::TopoWire wire54 = mw4.Wire();
// Add wire45 to wire123
AMCAX::MakeWire mw5(wire123);
mw5.Add(wire54);
std::cout << mw5.IsDone() << std::endl;// 0
std::cout << "error type:" << int(mw5.Error());// 2
![图片[2]-九韶内核:拓扑结构的构建-卡核](https://docs.amcax.net/v5_0_0/zh_cn/html/brep2_2.png)
在该示例中,若向现有 wire123 中添加 wire54,由于 wire54 中的第一条 edge (edge5)与 wire123 不相连,所以此时调用 IsDone () 将返回 false,调用 Error () 将返回 WireError::DisconnectedWire。
MakeFace
MakeFace 功能丰富,下文将分类介绍:
基于数学表达
可基于 Plane、Cylinder 等数学表达式构建,以下以 Plane 为例:
// Construct from a plane with parameter bounds
AMCAX::Frame3 frame;
AMCAX::Plane plane(frame); // xoy
double uMin = 0.0;
double uMax = 1.0;
double vMin = 0.0;
double vMax = 1.0;
AMCAX::TopoFace face = AMCAX::MakeFace(plane, uMin, uMax, vMin, vMax);
基于 Surface
基于 Geom3Surface 构建 Face 是 MakeFace 最常用的功能。
// Construct from a surface with parameter bounds and tolerance
AMCAX::Frame3 frame;
std::shared_ptr<AMCAX::Geom3Surface> surface = std::make_shared<AMCAX::Geom3Plane>(frame);
double uMin = 0.0;
double uMax = 1.0;
double vMin = 0.0;
double vMax = 1.0;
double tol = AMCAX::Precision::Confusion();
AMCAX::TopoFace face = AMCAX::MakeFace(surface, uMin, uMax, vMin, vMax, tol);
MakeFace 要求在提供 Surface 的同时提供 Tolerance。需要注意的是,当输入的曲面为无穷大且没有约束参数范围时,将不会自动生成 Wire。其余情况都会自动生成 Wire。
基于 Wire
单独 Wire
当 Wire 为平面上的 Wire 时,输入单独 Wire 即可成功构建 Face。
// Construct a wire
AMCAX::Frame3 frame;
double r = 1.0;// radius
AMCAX::Circle3 circle(frame, r);
AMCAX::TopoEdge circleEdge = AMCAX::MakeEdge(circle);
AMCAX::TopoWire wire = AMCAX::MakeWire(circleEdge);
AMCAX::TopoFace face = AMCAX::MakeFace(wire);
注:单独输入不在平面上的 Wire 可能会构建 Face 失败。
Wire + 数学表达
// Construct a wire
AMCAX::Frame3 frame;
double r = 1.0;// radius
AMCAX::Circle3 circle(frame, r);
AMCAX::TopoEdge circleEdge = AMCAX::MakeEdge(circle);
AMCAX::TopoWire wire = AMCAX::MakeWire(circleEdge);
AMCAX::Plane plane(frame);// xoy
bool inside = true;
AMCAX::TopoFace face = AMCAX::MakeFace(plane, wire, inside);
注:需指定 Face 所表示的区域位于 Wire 的内部还是外部(最后的 bool 参数中,true 表示位于内部)。
Wire + Surface
// Construct a wire
AMCAX::Frame3 frame;
double r = 1.0;// radius
AMCAX::Circle3 circle(frame, r);
AMCAX::TopoEdge circleEdge = AMCAX::MakeEdge(circle);
AMCAX::TopoWire wire = AMCAX::MakeWire(circleEdge);
std::shared_ptr<AMCAX::Geom3Surface> surface = std::make_shared<AMCAX::Geom3Plane>(frame);
bool inside = true;
AMCAX::TopoFace face = AMCAX::MakeFace(surface, wire, inside);
Wire + Face
// Construct a wire
AMCAX::Frame3 frame1;
double r1 = 1.0;// radius
AMCAX::Circle3 circle1(frame1, r1);
AMCAX::TopoEdge circleEdge1 = AMCAX::MakeEdge(circle1);
AMCAX::TopoWire wire1 = AMCAX::MakeWire(circleEdge1);
// Construct face1 from surface1 and wire1
std::shared_ptr<AMCAX::Geom3Surface> surface1 = std::make_shared<AMCAX::Geom3Plane>(frame1);
bool inside = true;
AMCAX::TopoFace face1 = AMCAX::MakeFace(surface1, wire1, inside);
// Construct face2 from face1 and wire2 (the wire2 will be added to the face1)
AMCAX::Point3 point(0., 0., 0.);
AMCAX::Direction3 dir(0., 0., -1.);
AMCAX::Frame3 frame2(point, dir);
double r2 = 0.5;// radius
AMCAX::Circle3 circle2(frame2, r2);
AMCAX::TopoEdge circleEdge2 = AMCAX::MakeEdge(circle2);
AMCAX::TopoWire wire2 = AMCAX::MakeWire(circleEdge2);
AMCAX::TopoFace face2 = AMCAX::MakeFace(face1, wire2);
结果如下图所示:左边为 face1,右图为 face2。
![]() |
![]() |
但需注意 Wire 的 Orientation,即若按如下写法,会得到错误结果。
// Construct a wire
AMCAX::Frame3 frame1;
double r1 = 1.0;// radius
AMCAX::Circle3 circle1(frame1, r1);
AMCAX::TopoEdge circleEdge1 = AMCAX::MakeEdge(circle1);
AMCAX::TopoWire wire1 = AMCAX::MakeWire(circleEdge1);
// Construct face1 from surface1 and wire1
std::shared_ptr<AMCAX::Geom3Surface> surface1 = std::make_shared<AMCAX::Geom3Plane>(frame1);
bool inside = true;
AMCAX::TopoFace face1 = AMCAX::MakeFace(surface1, wire1, inside);
// Construct face2 from face1 and wire2 (the wire2 will be added to the face1)
double r2 = 0.5;// radius
AMCAX::Circle3 circle2(frame1, r2);
AMCAX::TopoEdge circleEdge2 = AMCAX::MakeEdge(circle2);
AMCAX::TopoWire wire2 = AMCAX::MakeWire(circleEdge2);
AMCAX::TopoFace face2 = AMCAX::MakeFace(face1, wire2);
而修正方法是在 Edge 或 Wire 层级将其 Orientation 设为 Reversed,以下以 Wire 为例:
AMCAX::TopoShape reshape = wire2.Oriented(AMCAX::OrientationType::Reversed);
AMCAX::TopoWire wire2_new = AMCAX::TopoCast::Wire(reshape);
AMCAX::TopoFace face2_new = AMCAX::MakeFace(face1, wire2_new);
TopoBuilder
尽管 Make*.hpp 提供了若干便于构建 TopoShape 的 API,但部分建模问题仍需依赖 TopoBuilder 解决。下文将介绍使用 TopoBuilder 构建不同拓扑结构的方法。
Vertex
MakeVertex 提供构建顶点的功能。
AMCAX::Point3 p(0.,0.,0.);
AMCAX::TopoVertex v;
double tol = AMCAX::Precision::Confusion();
AMCAX::TopoBuilder builder;
// Method 1
builder.MakeVertex(v, p, tol);// Make a vertex with a point
// Method 2
builder.MakeVertex(v);
builder.UpdateVertex(v, p, tol);// Update the point of a vertex
Edge
针对不同类型的 Edge,其构建方法各不相同,以下将逐一介绍:
普通 Edge
规范的建模思路为:先通过几何计算获取所有所需的 Point、Curve3d 及 Pcurve,再据此构建拓扑结构。
第一步:准备所需的 Curve3d ,基于该 Curve3d 构建 Edge 。
// Make a 3D curve
AMCAX::Point3 p(0.0, 0.0, 0.0);
AMCAX::Direction3 dir(1.0, 0.0, 0.0);
AMCAX::MakeGeom3Line line(p, dir);
std::shared_ptr<AMCAX::Geom3Curve >curve = line.Value();
// Make an edge with a curve
AMCAX::TopoBuilder builder;
AMCAX::TopoEdge edge;
double tol = AMCAX::Precision::Confusion();
builder.MakeEdge(edge, curve, tol);
// Set the range of parameter of an edge
double fp = 0.0;
double lp = 2.0;
builder.Range(edge, fp, lp);
Range 用于设置 TopoEdge 的参数范围。若 Curve3d 的参数范围与 TopoEdge 所需的参数范围一致,此步骤可省略。
第二步:准备 Edge 对应的起始 Vertex 与终止 Vertex,并将这两个 Vertex 关联至该 Edge。
// Make vertex
AMCAX::Point3 start(0.0, 0.0, 0.0);
AMCAX::Point3 last(2.0, 0.0, 0.0);
AMCAX::TopoVertex v1, v2;
builder.MakeVertex(v1, start, tol);
builder.MakeVertex(v2, last, tol);
builder.Add(edge, v1);
// Method 1
v2.SetOrientation(AMCAX::OrientationType::Reversed);// Set the orientation of the vertex to Reversed
builder.Add(edge, v2);
// Method 2
v2.Reverse();
builder.Add(edge, v2);
// Method 3
builder.Add(edge, v2.Oriented(AMCAX::OrientationType::Reversed));
注:此处需注意起始 Vertex 与终止 Vertex 的 Orientation。TopoEdge 的起始 Vertex 方向为 Forward,终止 Vertex 方向为 Reversed。
由于 Orientation 的默认值为 Forward,因此需调整终止 Vertex 的方向属性。调整方式分为两类:一是对自身进行改变,对应的接口为 SetOrientation 和 Reverse;二是不对自身进行改变,生成一个方向为 Reversed 的新 Vertex,对应的接口为 Oriented,生成的新对象需传入 builder 中使用。
第三步:在完成 Face 的构建后,为其添加 Pcurve。
// Construct a face from a surface with parameter bounds
AMCAX::Point3 p1(0., 0., 0.);
AMCAX::Point3 p2(0., 2., 0.);
AMCAX::Point3 p3(0., 2., 2.);
AMCAX::Point3 p4(2., 0., 0.);
AMCAX::Point3 p5(2., 2., 0.);
double tol = AMCAX::Precision::Confusion();
AMCAX::MakeGeom3Plane mp1(p1, p2, p3);
AMCAX::MakeGeom3Plane mp2(p1, p4, p5);
double uMin = 0.0;
double uMax = 2.0;
double vMin = 0.0;
double vMax = 2.0;
std::shared_ptr< Geom3Surface > surf1 = mp1.Value();
std::shared_ptr< Geom3Surface > surf2 = mp2.Value();
AMCAX::TopoFace face1 = AMCAX::MakeFace(surf1, uMin, uMax, vMin, vMax, tol);
AMCAX::TopoFace face2 = AMCAX::MakeFace(surf2, uMin, uMax, vMin, vMax, tol);
// Update the pcurve of an edge on a face
std::shared_ptr< AMCAX::Geom2Curve > pcurve1;
std::shared_ptr< AMCAX::Geom2Curve > pcurve2;
builder.UpdateEdge(edge, pcurve1, face1, AMCAX::Precision::PConfusion());
builder.UpdateEdge(edge, pcurve2, face2, AMCAX::Precision::PConfusion());
需注意 Pcurve 的方向应与 Curve3d 保持一致,且 Edge 的 Orientation 对 Pcurve 的方向无任何影响,需牢记 “几何是几何,拓扑是拓扑” 的核心逻辑。
此外,添加 Vertex 的操作仅需在 MakeEdge 之后执行即可:一方面,第二步(添加 Vertex)与第三步(添加 Pcurve)的顺序可互换;另一方面,在设置 Range 之前添加 Vertex,同样不影响建模流程。
Seam Edge
其他的步骤都相同,仅第三步有所不同:
需注意 pcurve1 与 pcurve2 的方向仍需与 curve3d 保持一致。二者的区别在于:pcurve1 对应正向(Forward)Edge 在 Surface 参数域上的参数曲线,pcurve2 对应反向(Reversed)Edge 在 Surface 参数域上的参数曲线。
Degenerated Edge
其他的步骤都相同,仅第一步不同,没有 curve3d:
AMCAX::TopoEdge edge;
builder.MakeEdge(edge);
builder.Degenerated(edge, true);
builder.Range(edge, 0.0, 2.0 * AMCAX::Constants::pi);
此处需注意将退化标志(Flag)设为 True。不同于常规情况,此处 Pcurve 的方向无需与 Curve3d 保持一致,只需与 Edge 的 Orientation 保持一致即可。
自由 Edge
其他的步骤都相同,仅第三步不同,只有 1 条 pcurve。
Wire
正常的思路是:
第一步:先依据参数域上的 Wire 确定其方向,再明确需选用的 Edge 以及这些 Edge 各自的 Orientation。
AMCAX::TopoBuilder builder;
std::vector<std::pair<int, bool>> wireEdges1 =
{
{1, true},
{2, true},
{3, true},
{4, true}
};
第二步:构建 Edge 并将其添加至 Wire 中。
AMCAX::TopoWire wire1;
builder.MakeWire(wire1);
for (const auto& edgeInfo : wireEdges1)
{
int edgeID = edgeInfo.first;
bool isForward = edgeInfo.second;
AMCAX::TopoEdge edge;
AMCAX::TopoShape crshape = allEdges[edgeID - 1];
if (isForward)
{
edge = AMCAX::TopoCast::Edge(crshape.Oriented(AMCAX::OrientationType::Forward));
}
else
{
edge = AMCAX::TopoCast::Edge(crshape.Oriented(AMCAX::OrientationType::Reversed));
}
builder.Add(wire1, edge);
}
注:这里 Edge 的添加顺序可以是任意的。
第三步:将 Wire 的 Closed Flag 设置为对应状态。
bool isClosedWire1 = AMCAX::TopoTool::IsClosed(wire1);
wire1.Closed(isClosedWire1);
Face
构建 Face 的方法如下:
const AMCAX::Direction3 DZ = AMCAX::CartesianCoordinateSystem::DZ();
AMCAX::MakeGeom3Plane plane1(p1, -DZ);
AMCAX::TopoFace face1;
builder.MakeFace(face1, plane1.Value(), AMCAX::Precision::Confusion());
builder.Add(face1, wire1);
Shell
构建 Shell 时需要注意 Closed Flag,方法如下:
AMCAX::TopoShell shell;
builder.MakeShell(shell);
std::vector<AMCAX::TopoFace> allFaces = { face1 };
for (const auto& face : allFaces)
{
builder.Add(shell, face);
}
bool isClosedShell = AMCAX::TopoTool::IsClosed(shell);
shell.Closed(isClosedShell);
Solid
构建 Solid 的方式如下:
AMCAX::TopoSolid solid;
builder.MakeSolid(solid);
builder.Add(solid, shell);
Compound
构建 Compound 的方式如下:
AMCAX::TopoCompound comp;
builder.MakeCompound(comp);
builder.Add(comp, anyShape);

![图片[3]-九韶内核:拓扑结构的构建-卡核](https://docs.amcax.net/v5_0_0/zh_cn/html/guide_modeling_fundation_brep_3_1.png)
![图片[4]-九韶内核:拓扑结构的构建-卡核](https://docs.amcax.net/v5_0_0/zh_cn/html/guide_modeling_fundation_brep_3_2.png)












