Results 1 to 1 of 1

Thread: ComponentOccurrence vs AllReferencedDocuments

  1. #1
    Active Member
    Join Date
    2015-09
    Location
    Québec (Bas-St-Laurent)
    Posts
    90
    Login to Give a bone
    0

    Default ComponentOccurrence vs AllReferencedDocuments

    Hi gang,

    I just learned how to use global variables in a Main/Private sub situation. Now I need to know how to "transpose" function arguments from the Main to the Sub function. In the following iLogic, the "Call Iteration(...)" uses some arguments in the Main sub <oAsmDoc.ComponentDefinition.Occurrences, 1> and I don't know what they mean.
    The Private Sub re-uses that information in a different way <Occurrences as ComponentOccurrences, Niveau As Integer>, apparently defining the Occurrences as an argument and defining the Niveau variable in there as well.

    What I want to do is use a For Each AllReferencedDocuments function to access each part only once, and not use Occurrences that revisits all identical parts in the assembly.

    Can someone show me how to achieve this, and explain how to use those arguments?

    Thank you.


    Here is the code, shortened
    *********
    Class This rule
    (Some global variables)


    Main Sub(...)
    ....(Some stuff)
    Call Iteration(oAsmDoc.ComponentDefinition.Occurrences, 1)
    End Sub


    Private Sub Iteration(Occurrences as ComponentOccurrences, Niveau As Integer)
    'look at the files referenced by the assembly
    Dim oRefDoc As ComponentOccurrence
    For Each oRefDoc In Occurrences

    (Access each part and do stuff)
    'If the Component it finds is an assembly, continue digging
    If oRefDoc.DefinitionDocumentType = kAssemblyDocumentObject Then
    Call Iteration(oRefDoc.SubOccurrences, Niveau + 1)
    End Sub
    End Class
    Last edited by Pierre Marcotte; 2015-09-18 at 01:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •