Dim CATIA As Application
Set CATIA = GetObject(, "CATIA.Application")
Dim sel As Selection
Set sel = CATIA.ActiveDocument.Selection
2、常用对象类型判断
Select Case elem.Type
Case "Part"
Dim part As Part
Set part = elem.Value
Case "HybridBody"
Dim body As HybridBody
Set body = elem.Value
Case "Face"
Dim face As Face
Set face = elem.Value
Case "Sketch"
Dim sketch As Sketch
Set sketch = elem.Value
End Select
五、Selection 对象在 CATIA 生态系统中的定位
六、Selection 对象发展历程
1、Selection 对象版本演变史
2、各版本里程碑变化详解
CATIA V5 基础阶段 (R1-R10: 1998-2001)
版本
关键变化
影响
R1 (1998)
首次引入Selection对象
基础选择功能,仅支持简单元素选择
R3 (1999)
添加Add/Clear方法
实现编程控制选择集
R8 (2001)
增强Search方法
支持正则表达式搜索
' R8 典型代码
Dim sel As Selection
Set sel = CATIA.ActiveDocument.Selection
' 基础搜索功能
sel.Search "Part", True