romaleee
Mechanical
- May 13, 2016
- 37
Hi.
I am trying to write a script that would find and sort all the external links, in an assembly, into next classes:
1. OK
2. Not synchronized
3. Document not found
4. Document not loaded
5. Reference not found
so I can repair bolded ones. I need this only for external parameters so I'm taking only KWE_REFERENCE-s into consideration. The problem is that I don't know how to access to Link status value or from/to references of link. I manged to extract "Document not found links". Does anyone have an idea how to sort rest of them. Output would be an xls.file with paths of bolded parameters but thats an easy thing to do when and if I solve first problem.
Ty
I am trying to write a script that would find and sort all the external links, in an assembly, into next classes:
1. OK
2. Not synchronized
3. Document not found
4. Document not loaded
5. Reference not found
so I can repair bolded ones. I need this only for external parameters so I'm taking only KWE_REFERENCE-s into consideration. The problem is that I don't know how to access to Link status value or from/to references of link. I manged to extract "Document not found links". Does anyone have an idea how to sort rest of them. Output would be an xls.file with paths of bolded parameters but thats an easy thing to do when and if I solve first problem.
Code:
Sub AnalyseLink()
Dim oStiEngine As StiEngine
Set oStiEngine = CATIA.GetItem("CAIEngine")
Dim oStiDBItem As StiDBItem
Set oStiDBItem = oStiEngine.GetStiDBItemFromAnyObject(CATIA.ActiveDocument)
Call AnalyseSubProduct(oStiDBItem)
End Sub
Sub AnalyseSubProduct(oStiDBItem)
Dim i As Integer
Dim SonName, LinkType As String
Dim oStiDBChildren As StiDBChildren
Dim oStiDBItem2 As StiDBItem
Set oStiDBChildren = oStiDBItem.GetChildren
Dim odocument As Document
For i = 1 To oStiDBChildren.Count
Set oStiDBItem2 = oStiDBChildren.Item(i)
On Error Resume Next
Set odocument = oStiDBItem2.GetDocument
If Err.Number = 0 Then
MsgBox ("Rest of versions")
Else
MsgBox ("Document NOT found")
End If
Err.Clear
SonName = oStiDBItem2.GetDocumentFullPath
LinkType = CStr(oStiDBChildren.LinkType(i))
Next i
End Sub
Ty