psychanalyst
Computer
hi,
I am trying to make a macro to update links between CATDrawing and CATPart. After execution of the macro, there are losses colored red annotations.
Here is my code:
Sub CATMain()
partFile = CATIA.ActiveDocument.FullName
Set partDoc = CATIA.Documents.Read(partFile)
Set myPart = partDoc.Part
drwFile = Replace(partFile, "Part", "Drawing")
Set drwDoc = CATIA.Documents.Open(drwFile)
Set mySheet = CATIA.ActiveDocument.Sheets.Item("Sheet.1")
For i = 1 To mySheet.Views.Count
Set myView = mySheet.Views.Item(i)
Set vLinks = myView.GenerativeLinks
vLinks.RemoveAllLinks
If InStr(myView.Name, "Main") < 1 Then
If InStr(myView.Name, "Background" ) < 1 Then
vLinks.AddLink myPart
End If
End If
Next
mySheet.ForceUpdate
'CATIA.ActiveDocument.Save
End Sub
I am trying to make a macro to update links between CATDrawing and CATPart. After execution of the macro, there are losses colored red annotations.
Here is my code:
Sub CATMain()
partFile = CATIA.ActiveDocument.FullName
Set partDoc = CATIA.Documents.Read(partFile)
Set myPart = partDoc.Part
drwFile = Replace(partFile, "Part", "Drawing")
Set drwDoc = CATIA.Documents.Open(drwFile)
Set mySheet = CATIA.ActiveDocument.Sheets.Item("Sheet.1")
For i = 1 To mySheet.Views.Count
Set myView = mySheet.Views.Item(i)
Set vLinks = myView.GenerativeLinks
vLinks.RemoveAllLinks
If InStr(myView.Name, "Main") < 1 Then
If InStr(myView.Name, "Background" ) < 1 Then
vLinks.AddLink myPart
End If
End If
Next
mySheet.ForceUpdate
'CATIA.ActiveDocument.Save
End Sub