Does weldments work differently than regular assemblies?

Does weldments work differently than regular assemblies?

Anonymous
Not applicable
311 Views
2 Replies
Message 1 of 3

Does weldments work differently than regular assemblies?

Anonymous
Not applicable
I use the code below to loop through the occurrences of an assembly. I am beginning to conclude that a weldment works differently since this code errors at the "For Each" line.

Does anyone know anything about this, do I need to look for the weldment, and do something different....

Thanks,
Kurt



Public Sub LoopThruAllChildParts(InvAssmDoc As AssemblyDocument, oDocArray() As Document)
If InvAssmDoc.DocumentType <> kAssemblyDocumentObject Then Exit Sub

Dim oAssyCompDef As AssemblyComponentDefinition
Set oAssyCompDef = InvAssmDoc.ComponentDefinition

Dim oParentOccur As ComponentOccurrence
Dim oChildOccDoc As Document
Dim TempPartCount As Integer

MsgBox oAssyCompDef.Occurrences.Count
For Each oParentOccur In oAssyCompDef.Occurrences
If Not oParentOccur.ReferencedDocumentDescriptor.ReferenceMissing _
And Not oParentOccur.Suppressed And Not oParentOccur.ReferencedDocumentDescriptor.ReferenceSuppressed Then
'code entered here
End If
Next
End Sub
0 Likes
312 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Weldment documents have an additional occurrence
that is not visible to users. Some properties/methods on this occurrence return
a failure since it cannot be queried/edited like a regular occurrences. In most
cases, you would want to skip this occurrence.

 

For Each oParentOccur In
oAssyCompDef.Occurrences
    'Skip weld
occurrence
    If Not TypeOf oParentOccur.Definition Is
WeldsComponentDefinition Then
        If
Not oParentOccur.ReferencedDocumentDescriptor.ReferenceMissing
_
        And Not oParentOccur.Suppressed
And Not oParentOccur.ReferencedDocumentDescriptor.ReferenceSuppressed
Then
        'code entered
here
        End If
   
End If
Next

 

Sanjay-

 
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks a bunch, I will try this tomorrow...
Kurt
0 Likes