当前位置: 首页 > news >正文

OCCT基础类库介绍:Modeling Algorithm - Sewing

Sewing

缝合

Introduction
简介

Sewing allows creation of connected topology (shells and wires) from a set of separate topological elements (faces and edges). For example, Sewing can be used to create a shell from a compound of separate faces.
缝合可从一组独立的拓扑元素(面和边)创建连通的拓扑结构(壳和线框)。例如,缝合可用于从独立面的组合中创建壳。

在这里插入图片描述
Shapes with partially shared edges
具有部分共享边的形状

It is important to distinguish between sewing and other procedures, which modify the geometry, such as filling holes or gaps, gluing, bending curves and surfaces, etc.
区分缝合与其他修改几何形状的过程(如填充孔洞或间隙、粘合、弯曲曲线和曲面等)非常重要。

Sewing does not change the geometrical representation of the shapes. Sewing applies to topological elements (faces, edges) which are not connected but can be connected because they are geometrically coincident: it adds the information about topological connectivity. Already connected elements are left untouched in case of manifold sewing.
缝合不会改变形状的几何表示。缝合适用于未连通但因几何重合而可以连通的拓扑元素(面、边):它添加拓扑连通性信息。在流形缝合的情况下,已连通的元素保持不变。

Let us define several terms:
定义几个术语:

  • Floating edges: do not belong to any face;
    浮动边:不属于任何面;
  • Free boundaries: belong to one face only;
    自由边界:仅属于一个面;
  • Shared edges: belong to several faces (i.e. two faces in a manifold topology).
    共享边:属于多个面(如流形拓扑中的两个面)。

Sewn faces should have edges shared with each other.
缝合面应具有相互共享的边。

Sewn edges should have vertices shared with each other.
缝合边应具有相互共享的顶点。

Sewing Algorithm

缝合算法

The sewing algorithm is one of the basic algorithms used for shape processing, therefore its quality is very important.
缝合算法是用于形状处理的基础算法之一,因此其质量至关重要。

Implementation
实现

Sewing algorithm is implemented in the class BRepBuilder_Sewing. This class provides the following methods:
缝合算法在 BRepBuilder_Sewing 类中实现,该类提供以下方法:

  • loading initial data for global or local sewing;
    加载全局或局部缝合的初始数据;
  • setting customization parameters, such as special operation modes, tolerances and output results;
    设置自定义参数,如特殊操作模式、公差和输出结果;
  • applying analysis methods that can be used to obtain connectivity data required by external algorithms;
    应用分析方法以获取外部算法所需的连通性数据;
  • sewing of the loaded shapes.
    对已加载的形状执行缝合。

Sewing supports working mode with big value tolerance. It is not necessary to repeat sewing step by step while smoothly increasing tolerance.
缝合支持大公差工作模式,无需在逐步增大公差时重复缝合步骤。

Stages of the Algorithm
算法阶段

The Sewing algorithm can be subdivided into several independent stages, some of which can be turned on or off using Boolean or other flags.
缝合算法可分为多个独立阶段,其中部分阶段可通过布尔值或其他标志启用或禁用。

In brief, the algorithm should find a set of merge candidates for each free boundary, filter them according to certain criteria, and finally merge the found candidates and build the resulting sewn shape.
简而言之,算法需为每个自由边界找到一组合并候选,根据特定标准过滤,最终合并找到的候选并构建缝合后的形状。

Key Parameters
关键参数

Each stage of the algorithm or the whole algorithm can be adjusted with the following parameters:
算法的每个阶段或整个算法可通过以下参数调整:

  • Working tolerance: Defines the maximal distance between topological elements which can be sewn. It is not ultimate that such elements will be actually sewn as many other criteria are applied to make the final decision.
    工作公差:定义可缝合的拓扑元素间的最大距离。由于需结合其他标准决策,满足该公差的元素未必一定会被缝合。
  • Minimal tolerance: Defines the size of the smallest element (edge) in the resulting shape. No edges with size less than this value are created after sewing.
    最小公差:定义结果形状中最小元素(边)的尺寸。缝合后不会生成小于该值的边。
  • Non-manifold mode: Enables sewing of non-manifold topology.
    非流形模式:启用非流形拓扑的缝合。
Example
示例

To connect a set of n contiguous but independent faces:
连接n个相邻但独立的面:

BRepBuilderAPI_Sewing Sew;
Sew.Add(Face1); 
Sew.Add(Face2); 
...
Sew.Add(Facen); 
Sew.Perform();
TopoDS_Shape result = Sew.SewedShape();

If all faces have been sewn correctly, the result is a shell. Otherwise, it is a compound. After a successful sewing operation, all faces have a coherent orientation.
若所有面正确缝合,结果为壳;否则为组合体。成功缝合后,所有面具有一致的方向。

Tolerance Management
公差管理

Recommendations for tuning the sewing process:
缝合过程的调优建议:

  1. Use small working tolerance: Reduces sewing time and minimizes incorrectly sewn edges for shells with free boundaries.
    使用小工作公差:减少缝合时间,并降低自由边界壳的错误缝合边数量。
  2. Use large minimal tolerance: Reduces small geometry in the shape (both original and generated after cutting).
    使用大最小公差:减少形状中的微小几何(包括原始和切割后生成的)。
  3. For shells with holes: Set working tolerance ≤ the smallest element size of free boundaries to avoid partial sewing.
    带孔壳场景:设置工作公差≤自由边界的最小元素尺寸,避免部分缝合。
Manifold and Non-manifold Sewing
流形与非流形缝合
  • Manifold sewing: Merges only two nearest edges (from different faces or one closed face). Produces only manifold shells.
    流形缝合:仅合并两条最近的边(来自不同面或一个闭合面),仅生成流形壳。
  • Non-manifold sewing: Merges all edges within the specified tolerance. Used for non-manifold shells.
    非流形缝合:合并指定公差内的所有边,用于非流形壳。

Best practice: Apply manifold sewing first, then non-manifold sewing with minimal tolerance for complex topologies.
最佳实践:复杂拓扑先使用流形缝合,再用最小公差进行非流形缝合。

Local Sewing
局部缝合

Local sewing is used to stitch remaining non-sewn elements with a larger tolerance, especially for open shells. It preserves existing connections of the whole shape.
局部缝合用于以更大公差缝合剩余未缝合元素,尤其适用于开放壳,且保留整体形状的现有连接。

Example workflow:
示例流程

// 初始缝合形状
TopoDS_Shape aS1, aS2;  // 预期为已正确缝合的壳
TopoDS_Shape aComp;
BRep_Builder aB;
aB.MakeCompound(aComp);
aB.Add(aComp, aS1);
aB.Add(aComp, aS2);BRepBuilderAPI_Sewing aSewing;
aSewing.Load(aComp);  // 加载组合体// 添加需要局部缝合的子形状
aSewing.Add(aF1);
aSewing.Add(aF2);// 执行缝合
aSewing.Perform();
TopoDS_Shape aRes = aSewing.SewedShape();  // 获取结果形状

Local sewing is faster than global sewing and allows selective stitching of specific regions.
局部缝合比全局缝合更快,且支持对特定区域的选择性缝合。

http://www.lqws.cn/news/453403.html

相关文章:

  • 如何正确处理音频数据:16位整数与32位浮点数
  • Agent轻松通-P3:分析我们的Agent
  • CppCon 2017 学习:Mocking Frameworks Considered
  • 您的元服务存在问题,不符合元服务UX设计规范
  • 从零开始:飞牛云NAS+Docker搭建WordPress全流程
  • (链表:哈希表 + 双向链表)146.LRU 缓存
  • XML在线格式化工具
  • MySQL基础多表查询
  • docker安装datax详细步骤
  • AUTOSAR实战教程--OS调试利器ORTI文件使用说明OSEK调试方法
  • OBCP第二章 OceanBase 存储引擎高级技术学习笔记
  • 63 网络交互的过程中目标设备的选择
  • PROFIBUS DP 转 EtherCAT 网关:冶金自动化高效协同的基石
  • 深入剖析HashMap与LinkedHashMap应用
  • 前端页面Javascript数组
  • python之使用cv2.matchTemplate识别缺口滑块验证码---实现最佳图像匹配
  • 主流测距技术深度解析:激光雷达、UWB、微波与视觉方案的全面对比
  • 今日行情明日机会——20250620
  • 响应式数据可视化大屏解决方案,重构工业交互体验
  • 【深度学习基础与概念】笔记(一)深度学习革命
  • 【Golang】go build 命令选项-ldflags用法
  • Spring @ModelAttribute注解全解析:数据绑定与模型管理
  • ceph 通过 crush rule 修改故障域
  • DataWhale-零基础络网爬虫技术(二er数据的解析与提取)
  • LeetCode热题100—— 169. 多数元素
  • leetcode 291. Word Pattern II和290. Word Pattern
  • 解锁数据宝藏:数据挖掘之数据预处理全解析
  • 在Django中把Base64字符串保存为ImageField
  • 思辨场域丨AR技术如何重塑未来学术会议体验?
  • LVS vs Nginx 负载均衡对比:全面解析