SOLIDWORKS API
Help
Macro Features and Dimensions
The following sample code shows how you might create a dimension for
a macro feature.
In C++, create containers for the dimension types
and values before inserting the macro feature:
//Create
dimension containers
long
dimType[MBossDimNum] =
{
swLinearDimension,
swLinearDimension,
swLinearDimension,
swLinearDimension,
swLinearDimension,
swLinearDimension,
swLinearDimension,
swAngularDimension,
swAngularDimension,
swAngularDimension
};
double dimValue[MBossDimNum] =
{
pData->m_BaseRadius*2,
pData->m_BaseHeight,
pData->m_FinHeight,
pData->m_FinLength,
pData->m_FinWidth,
pData->m_InsideRadius*2,
pData->m_InsideHeight,
pData->m_BaseDraft,
pData->m_FinDraft,
pData->m_InsideDraft
};
Insert the macro feature.
pFeatMan->IInsertMacroFeature2(_bstr_t(baseName),
_bstr_t("SldFuncFeat.MBossFeature"),
macroMethods,
MBossParamNum, MBossParamName,
MBossParamType,
paramVal, MBossDimNum, dimType, dimValue, pEditBody,3,
icons,
swMacroFeatureIsPatternable, &pFeat);
Set the lines for the dimensions in your rebuild
function:
dim->put_DimensionLineDirection(transformedVectLineDir);
dim->put_ExtensionLineDirection(transformedVectExtDir);
dim->ISetReferencePoints(2,
refPoints);
NOTE: When regenerating a macro
feature, IDimension::ReferencePoints
gets and sets the reference points of a display dimension (IDisplayDimension
object). In
all other cases, this property gets and sets the reference points of a
dimension (IDimension
object).