Boolean Operations
Boolean operations are used to create new shapes from the combinations of two groups of shapes.
Operation | Result |
---|---|
Fuse | All points in S1 or S2 |
Common | All points in S1 and S2 |
Cut S1 by S2 | All points in S1 and not in S2 |
布尔运算
布尔运算用于通过两组形状的组合创建新形状。
操作 | 结果 |
---|---|
融合(Fuse) | S1 或 S2 中的所有点 |
交集(Common) | S1 且 S2 中的所有点 |
S1 减去 S2(Cut S1 by S2) | S1 中 不含 S2 的所有点 |
From the viewpoint of Topology these are topological operations followed by blending (putting fillets onto edges created after the topological operation).
从拓扑学角度来看,这些是拓扑操作后紧接着进行的混合处理(即在拓扑操作后生成的边上添加圆角)。
Topological operations are the most convenient way to create real industrial parts. As most industrial parts consist of several simple elements such as gear wheels, arms, holes, ribs, tubes and pipes. It is usually easy to create those elements separately and then to combine them by Boolean operations in the whole final part.
拓扑操作是创建实际工业零件的最便捷方式。由于大多数工业零件由多个简单元素组成,例如齿轮、臂架、孔、肋板、管道和管件,通常可以先分别创建这些元素,然后通过布尔运算将它们组合成完整的最终零件。
See Boolean Operations for detailed documentation.
有关详细文档,请参阅“布尔运算”。
Input and Result Arguments
Boolean Operations have the following types of the arguments and produce the following results:
For arguments having the same shape type (e.g. SOLID / SOLID)
- The type of the resulting shape will be a COMPOUND, containing shapes of this type.
For arguments having different shape types (e.g. SHELL / SOLID)
- The type of the resulting shape will be a COMPOUND, containing shapes of the type that is the same as that of the low type of the argument.
Example: For SHELL/SOLID, the result is a COMPOUND of SHELLs.
For arguments with different shape types
- Some Boolean Operations cannot be done using the default implementation due to a non-manifold type of the result.
Example: The FUSE operation for SHELL and SOLID cannot be done, but the CUT operation can be done where SHELL is the object and SOLID is the tool.
For arguments of the COMPOUND shape type
- Boolean Operations can be performed, but each compound must not be heterogeneous (i.e., it must contain equidimensional shapes):
- EDGEs or/and WIREs
- FACEs or/and SHELLs
- SOLIDs
- SOLIDs inside the COMPOUND must not contact (intersect or touch) each other. The same condition applies to SHELLs/FACEs or WIREs/EDGEs.
COMPSOLID type of shape
- Boolean Operations for COMPSOLID are not supported.
输入和结果参数
布尔运算具有以下参数类型并产生相应结果:
当参数形状类型相同(如实体/实体)
- 结果形状类型为复合体(COMPOUND),包含该类型的形状。
当参数形状类型不同(如壳/实体)
- 结果形状类型为复合体(COMPOUND),包含与参数中较低类型一致的形状。
示例:壳/实体的运算结果为壳的复合体。
当参数形状类型不同时
- 部分布尔运算因结果为非流形类型,无法使用默认实现。
示例:壳与实体无法执行融合(FUSE)运算,但可执行切割(CUT)运算(壳作为对象,实体作为工具)。
当参数为复合体(COMPOUND)形状类型时
- 可执行布尔运算,但每个复合体必须为同维度(即包含等维形状):
- 边(EDGE)或/和线框(WIRE)
- 面(FACE)或/和壳(SHELL)
- 实体(SOLID)
- 复合体内的实体不能接触(相交或相切),同理适用于壳/面或线框/边。
组合实体(COMPSOLID)形状类型
- 不支持组合实体的布尔运算。
Implementation
BRepAlgoAPI_BooleanOperation class is the deferred root class for Boolean operations.
Fuse
BRepAlgoAPI_Fuse performs the Fuse operation.
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Fuse(A,B);
Common
BRepAlgoAPI_Common performs the Common operation.
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Common(A,B);
Cut
BRepAlgoAPI_Cut performs the Cut operation.
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Cut(A,B);
Section
BRepAlgoAPI_Section performs the section, described as a TopoDS_Compound made of TopoDS_Edge.
Section operation
TopoDS_Shape A = ..., TopoDS_Shape B = ...;
TopoDS_Shape S = BRepAlgoAPI_Section(A,B);
实现
BRepAlgoAPI_BooleanOperation 类是布尔运算的抽象基类。
融合(Fuse)
BRepAlgoAPI_Fuse 用于执行融合操作。
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Fuse(A,B);
交集(Common)
BRepAlgoAPI_Common 用于执行交集操作。
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Common(A,B);
切割(Cut)
BRepAlgoAPI_Cut 用于执行切割操作。
TopoDS_Shape A = ..., B = ...;
TopoDS_Shape S = BRepAlgoAPI_Cut(A,B);
截面(Section)
BRepAlgoAPI_Section 用于执行截面操作,结果为由 TopoDS_Edge 组成的 TopoDS_Compound。
截面操作
TopoDS_Shape A = ..., TopoDS_Shape B = ...;
TopoDS_Shape S = BRepAlgoAPI_Section(A,B);