Traverse Project / Assemblies structures

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Examples >

Traverse Project / Assemblies structures

Description

This example shows the usage of a lib function to retrieve the components uid and their occurences in a project or in an assembly.

Requiremets

TraverseProjectAssemblies.lib
The file is distributed under folder

LST\DEMO_LST\

Code

GetAllDocumentsInStructure MainDocUid,AddDrawings,TraverseProjects

After calling this procedure, you will have a set of arrays containing the uid of components encountered while traversing the tree that has MainDocUid as root.

GlobalNumberOfProjects=UBound(ProjectsWorkingSetArray)

GlobalNumberOfPArts=UBound(PartWorkingSetArray)
GlobalNumberOfAssemblies=UBound(AssemblyWorkingSetArray)
GlobalNumberOfDrawings=UBound(DrawingWorkingSetArray)
GlobalNumberOfGeneric=UBound(GenericWorkingSetArray)

Now you can have the global number of parts, project, assemblies, drawings and generic components.

More, for each components (each uid) you have a dictionary called UidQty containing its occurences:

DBWMsgBox UidQty.Item(PartWorkingSetArray(j))

Example

For a complete example, look at file

LST\DEMO_LST\TraverseProjects_and_Assemblies.vbs