×
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

Isolate External References Macro

Isolate External References Macro

Isolate External References Macro

(OP)
Is there a macro that will search an assembly and select all external references and Isolate them?
I would like to isolate every reference except those pointing to Published elements.

RE: Isolate External References Macro

I tried for quite a while in VBA to find:
  • If an external reference is bad/not connected
  • The parent of an external reference
From my experience:
  • Differentiating between a good and bad external reference is not an exposed API...You would likely need CAA to do this
  • Getting the parent of the external reference was also not exposed, nor was the path of the external reference. All you could really do was collect all publications from all the parts in the loaded product and check to see if the name of the external reference matches the name of any of the publications. This is not a good way to do it because:

  • You can rename external references or publications so the names don't match
  • You can have several publications from different parts with the same name so you might get a false positive
  • It takes a really long time to keep looping through all the publication names over and over and over, trying to find a match...users hated it

RE: Isolate External References Macro

Dim i As Integer, j As Integer
For i = 1 To myDocuments.Count
If InStr(1, myDocuments.Item(i).Name, ".CATPart") > 0 And InStr(1, myDocuments.Item(i).Name, ".CATProduct") <= 0 Then
myPart = myDocuments.Item(i).Part
Dim iBodyCnt As Integer
iBodyCnt = myPart.HybridBodies.Count
For j = 1 To iBodyCnt
If j >= iBodyCnt Then Exit For
If myPart.HybridBodies.Item(j).Name = "External References" Then
Dim myHBBody As HybridBody
myHBBody = myPart.HybridBodies.Item(j)
Dim k As Integer
For k = 1 To myHBBody.HybridShapes.Count
Debug.Print(myPart.Name & " - " & myHBBody.HybridShapes.Item(k).Name)
mySelection.Add(myHBBody.HybridShapes.Item(k))
iCnt = iCnt + 1
Next
If mySelection.Count2 > 0 Then
' Create Alias for Isolate
'CATIA.StartCommand("IsolateObject")
CATIA.StartCommand("Isolate")
mySelection.Clear()
End If
End If
Next
End If
Next
MsgBox("Isolating " & iCnt & " External Referances - Done", vbInformation, "Isolate External Referances")

RE: Isolate External References Macro

I thought the goal was to only isolate features that weren't linked?

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