0

I have few shapes in a geometrical set which are pasted with link. I want to find out if the source of these shapes are still present or not. I could not find any function for hybridshape to do this.

In this image the first shape's source is present but the second shape's source is deleted, how do i differentiate between them

enter image description here

braX
  • 11,506
  • 5
  • 20
  • 33

1 Answers1

0

It is possible to tell if the referenced document exists or not.

If you need to check if the referenced surface still exists... not so easy.

This is how you can get and check the linked documents:

Dim oStiEngine As StiEngine
Set oStiEngine = CATIA.GetItem("CAIEngine")

Dim oDoc As Document
Set oDoc = CATIA.ActiveDocument

Dim oStiDBItem As StiDBItem
Set oStiDBItem = oStiEngine.GetStiDBItemFromCATBSTR(oDoc.fullName)

Dim ochildrenList As StiDBChildren
Set ochildrenList = oStiDBItem.GetChildren

Dim lChildrenNumber As Long
lChildrenNumber = ochildrenList.count

For i = 1 To lChildrenNumber

    Dim child As Variant
    Set child = ochildrenList.item(i)
    Dim linkType As String
    linkType = ochildrenList.linkType(i)
    Debug.Print vbTab & child.name & " " & child.GetDocumentFullPath & " " & linkType & " FILE " & IIf(CATIA.FileSystem.FileExists(child.GetDocumentFullPath), "EXISTS", "MISSING")

Next 

You may need a specific license to use the StiEngine object. SmartTeam itself is not required.

You should probably start to use published elements for inter-document links to make your life easier in the long run. There is a setting to enforce this.

C R Johnson
  • 964
  • 1
  • 5
  • 12