How to use GetOccurrences Method for Assembly Pattern

[ Edited ]



I am trying to get the occurance information ( Name) from the Assembly Pattern as follows,



Dim lAssemblyModelDocumentAsSolidEdgeAssembly.AssemblyDocument



lAssemblyPatterns = lAssemblyModelDocument.AssemblyPatterns


lAssemblyPattern = lAssemblyPatterns.Item(i + 1)


  lAssemblyPattern As SolidEdgeAssembly.AssemblyPatternDim lAssemblyPatterns As SolidEdgeAssembly.AssemblyPatternsFor i AsInteger = 0 To lAssemblyPatterns.Count - 1Next


Here lArrOccurances is supposed to be System.Array. In SE programming it is mentioned that it should be Matrix.

Can Anybody tell me how to define this lArrOccurances ?

Thanks and Regards,



Posted by: Ravindra Mujumdar
Post date: 5/8/2010 4:03:22 AM


RE: How to use GetOccurrences Method for Assembly Pattern

[ Edited ]

Hello Ravi,


You should declare lArrOcuurances as an empty array.

Then ReDim lArrOcuurances with lAssemblyPatterns.Count

lArrOcuurances should be filled with the following line of code lAssemblyPattern.GetOccurrences(lArrOccurances)


Good luck!


Posted by: Wouter Sloof
Post date: 5/9/2010 10:22:18 PM

RE: How to use GetOccurrences Method for Assembly Pattern

[ Edited ]

Hi ErWo,


Thanks a lot for quick reply.


I tried the way you suggested,


I declared

Dim lArrOccurances() as object


Redim lArrOccurances(lAssemblyPattern.count)


Now lArrOccurances is returning System_ComObject but has no information about

Occurrence like Name etc.


Here I will elaborate more what exactly I want.


Basically I want to know quantity of each part in assembly tree. I am facing a problem of getting quantity for the parts which are patterned.


Case 1

Suppose a part is not repeated in the assembly and has a pattern. Then I get no. of occurrences of this part by running a loop. In this case items in the assembly pattern has a flag IsPatterned as false but IsPatternItem as true. Counting loop iterations I can get total qty.


Case 2

This is where I am facing a problem


I have an assembly in which 2 identical parts say



Both of them has independent patterns. One pattern has 1 item and other has 3 items.

My problem is how do I know which of the pattern belongs to which of the above 2 parts.

When I look into the occurrence object of each part I get quantity of 1 only. Object only says that this item is Patterned.(IsPattered= True and IsPatternItem = False)


So the confusion is whether Part.par:1 has 2 occurances OR Part.par:2 has 2 occuarnces ?


I get quantity of items in Assembly patterns but I am not able to correlate it with the parts which are patterned in the assembly tree.


Do you agree the way I am going ? OR if is is wrong, will you suggest any other method ?







Posted by: Ravindra Mujumdar
Post date: 5/11/2010 3:32:08 AM