Suppression and Unsuppression of elements in a pattern |
Top Previous Next |
Read about general suppression programatically first, if you have't already.
Within a single RectangularPattern (or any other pattern) you can use this fragment as a starting point for suppressing individual features within a pattern. Note that the first element in a pattern cannot be suppressed.
CComPtr<Parameter> XCountParam ; pRectPatFeat->get_XCount (&XCountParam) ; const int ikXCount = XCountParam->GetValue () ;
TRACE (L"Component %d is called %s, and the x count is %d ",iRect,bstrName,ikXCount) ;
CComPtr<FeaturePatternElements> pFeaturePatternElements ; pRectPatFeat->get_PatternElements (&pFeaturePatternElements) ;
const int ikNumElements = pFeaturePatternElements->GetCount() ; TRACE (L", this has %d FeaturePatternElements\n",ikNumElements) ;
// Start at 2 because the first element cannot be suppressed for (int iElem = 2 ; iElem <= ikNumElements ; iElem++) { CComPtr<FeaturePatternElement> pFeaturePatternElement ; pFeaturePatternElements->get_Item (iElem,&pFeaturePatternElement) ;
VARIANT_BOOL bSuppressed ;
if (((iElem/2)*2) == iElem) { bSuppressed = VARIANT_TRUE ;
} else { bSuppressed = VARIANT_FALSE ; }
pFeaturePatternElement->put_Suppressed(bSuppressed) ; }
::SysFreeString(bstrName); }
Note that you'll need to call Update to refresh the display:
pPartDocument->Update () ; // Like an AutoCAD regen
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)