×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

StiEngine

StiEngine

StiEngine

(OP)
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.

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

RE: StiEngine

Hello, for the document loaded you may use this as inspiration:

CODE --> CatScript

Err.Clear
  On Error Resume Next

  '//---------- Get the active document
  Set objGCATIADocument0 = CATIA.ActiveDocument
  If Err.Number <> 0 Then
    MsgBox "You must have a loaded and active document in the session", _
    vbOkOnly + vbCritical, "Erreur au chargement du modèle"
    Exit Sub
  End If
  Err.Clear 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources