How can I access "Component Pattern"?

How can I access "Component Pattern"?

Anonymous
Not applicable
225 Views
1 Reply
Message 1 of 2

How can I access "Component Pattern"?

Anonymous
Not applicable
Hello,

How can I access "Component Pattern"? I've found the API function to access
the PatternElement object of a Part, but not the "Component Pattern object"?

Is it the Parent object of PatternElement object?
Is "Component Pattern object" store as an assembly feature?

thanks,

jf.c
0 Likes
226 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Here is the solution where pOccurrencePattern is the object we are looking
for:


// Variables
CComPtr pAssemblyDoc;
CComPtr pAssemblyCompDef;
CComPtr pOccurrencePattern;
CComPtr pOccurrencePatterns;
long nbOccurrencePatterns = 0l;
bool bStopPattern = false;

// ...


// Getting the Assembly component definition from the Assembly document
hResult = pAssemblyDoc->get_ComponentDefinition(&pAssemblyCompDef);
if (FAILED(hResult))
{
// throw Exception ..
}

// Getting the occurrence patterns collection
hResult = pAssemblyCompDef->get_OccurrencePatterns(&pOccurrencePatterns);
if (FAILED(hResult))
{
// throw Exception ..
}

// Getting the number of occurrence pattern
hResult = pOccurrencePatterns->get_Count(&nbOccurrencePatterns);
if (FAILED(hResult))
{
// throw Exception ..
}

// Browsing Component Pattern
if(nbOccurrencePatterns>0)
{

bStopPattern = false;
i = 1l;
while(!bStopPattern)
{
//
hResult = pOccurrencePatterns->get_Item(_variant_t(i),
&pOccurrencePattern);
if (FAILED(hResult))
{
// throw Exception ..
// ...
}
}
}

"jf.c" wrote in message
news:94B6D9274535E93316B928E1954EF5D4@in.WebX.maYIadrTaRb...
> Hello,
>
> How can I access "Component Pattern"? I've found the API function to
access
> the PatternElement object of a Part, but not the "Component Pattern
object"?
>
> Is it the Parent object of PatternElement object?
> Is "Component Pattern object" store as an assembly feature?
>
> thanks,
>
> jf.c
>
>
0 Likes