Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename a Annotated View with script, is not working (DMU Navigator workbench)

Status
Not open for further replies.

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.


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
 
Replies continue below

Recommended for you

Thank you for your answer.
It's not working, but I succeed by unlinking and linking the annotated view.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor