iscariot
Mechanical
- Oct 15, 2009
- 154
I try to rename a annotated view using a small script but is not working as it should.
If I check in the proprieties window of the Ann view, it seems that the name was changed, but in the tree I can see still the old name.
After I click Apply in the proprieties window, the name is also changed in the tree.
Thank you for your help.
If I check in the proprieties window of the Ann view, it seems that the name was changed, but in the tree I can see still the old name.
After I click Apply in the proprieties window, the name is also changed in the tree.
Thank you for your help.
Code:
Sub CATMain()
' Retrieve the AnnotatedViews collection
Dim cAnnotatedViews As AnyObject
Set cAnnotatedViews = CATIA.ActiveDocument.Product.GetTechnologicalObject("AnnotatedViews")
' Retrieve selection
Dim sel
set sel=Catia.ActiveDocument.Selection
' Check if selection is a annotated view
If sel.Item2(1).Type = "AnnotatedView" Then
name = sel.Item2(1).Value.Name
Else
MsgBox("Select Annotated View!!!")
Exit Sub
End If
' Retrieve selected annotated view
Dim annView
Set annView = cAnnotatedViews.Item(name)
' Change name to a desired one
annView.Name = "test"
End Sub