有没有人知道如何使用VBA在FTA中创建关联前视图 . 我有一个短宏来创建基于3D几何体的前视图,但这个视图是孤立的,我必须手动将其更改为关联 . 我想要的是由宏创建的关联视图 . 执行宏复制的第一步 .
我的代码 .
Sub CATMain()
Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument
Dim part1 As PART
Set part1 = partDocument1.PART
'--------------------------------------------------
'Create Annotation Set
Dim annotationSet1 As AnnotationSet
Set annotationSet1 = part1.AnnotationSets.Add("ISO")
'Debug.Print annotationSet1.Name
Dim theViewFactory As TPSViewFactory
Set theViewFactory = annotationSet1.TPSViewFactory
'--------------------------------------------------
'Create reference plane from selection
Dim ViewPlane As Reference
Set Selection = partDocument1.Selection
Selection.Clear
Selection.Search ("name='Plane.6',all") 'Search plane by name
Set ViewPlane = Selection.Item(1).Value 'Set plane from selection
Selection.Clear
'--------------------------------------------------
'Create Front View
Dim theView As TPSView
Set theView = theViewFactory.CreateView(ViewPlane, 0)
theView.Name = "FrontView"
'--------------------------------------------------
'Create dimension
part1.Update
End Sub
1 回答
至于我对Catia API的了解,我不可能使用API关联
view
.此外,使用Win32从句柄执行按钮/组合框的点击将无法工作,因为要将视图关联到平面/曲面,您需要使用Catia用户界面执行所需位置的单击 .
API上的
TPSView
对象可能是有史以来最糟糕的对象之一,它没有任何属性 . 此外,TPSViewFactory
和TPSViews
对管理器视图没有任何有用的方法 .所以,简短的回答是 no, you can't do that .