Search code examples
vbageometrycatia

FTA Catia R24 Associative Front view (VBA)


does anyone know how to create Associative Front View in FTA using VBA. I have short macro to create Front View based on the geometry from 3D but this view is isolated and I must manually change it to Associative. What I would like to have is Associative View created by macro. It is first step to perform macro for power copy.

Bellow my code.

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

Solution

  • As far I my knowlodge on Catia API go, it is not possible to associate a view using the API.

    Also, using Win32 to perform clicks on buttons/comboboxes from handles will not work because to associate the view to a plane/surface you will need to perform a click on the desired location using the Catia User Interface.

    the TPSView object on the API is probably one of the worse ones ever exposed, it doesn't have any property. Also, the TPSViewFactory and TPSViews don't have any usefull method to manager views.

    So, the short answer is no, you can't do that.