Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As far as I can tell, once I have a RectangularOccurrencePattern I can get its inpiut components using ParentComponents. In C# (must be similar in VBA)
RectangularOccurrencePattern RecOccPat = (RectangularOccurrencePattern)OccPattern;
ObjectCollection Objs = RecOccPat.ParentComponents;
But I can't find any help in how to loop over the ObjectCollection and listing the Parts or Assemblies it contains.
A longer example:
if (OccPattern.Type == ObjectTypeEnum.kRectangularOccurrencePatternObject)
{
RectangularOccurrencePattern RecOccPat = (RectangularOccurrencePattern)OccPattern;
ObjectCollection Objs = RecOccPat.ParentComponents;
int iObjCount = 0 ;
foreach (Object O in Objs)
{
ABSup.Log.WriteLn(CLog.Type_e.ekLog, " ",iObjCount.ToString()," ",O.GetType().ToString()," ",O.ToString());
// Crashes here, the cast is not valid
ComponentOccurrence CompOcc = (ComponentOccurrence) O;
if (CompOcc != null)
{
ABSup.Log.WriteLn(CLog.Type_e.ekLog, " Component occurrence");
}
iObjCount++;
}
Does anyone know how to interrogate object collections?
Is my logic or reasoning incorrect?
Solved! Go to Solution.