/************************************************************************/
/* 草图输入模式 */
/* 将草图拆分为单独线 */
/************************************************************************/
CATLISTV (CATI2DWFGeometry_var ) GeomList;
CATLISTV(CATI2DCurve_var) CrvList;
CATI2DCurve_var spCurve = NULL_var;
// 检索草图中的线
hr = _spSketch->GetComponents(CATI2DWFGeometry::ClassName(),GeomList);
if (SUCCEEDED(hr))
{
if (GeomList.Size() > 1)
{
int indice=1;
while (indice <= GeomList.Size())
{
spCurve = GeomList[indice];
if (NULL_var != spCurve)
{
CrvList.Append(spCurve);
}
indice++;
}
}
}
CATISpecObject_var spSpecOnCurve = NULL_var;
CATIMmDecodeSubElem* pSubElem = NULL;
CATIBRepAccess_var spBRep = NULL_var;
CATIFeaturize_var spFeaturize = NULL_var;
CATISpecObject_var spSpecObjectOnSketchCurve = NULL_var;
CATListValCATBaseUnknown_var brepList;
// 将其中各个线要素特征化
for (int iLoop = 1;iLoop<= CrvList.Size();iLoop++)
{
spSpecOnCurve = CrvList[iLoop];
if (NULL_var == spSpecOnCurve)
{
continue;
}
_spSketch->QueryInterface(IID_CATIMmDecodeSubElem, (void**)&pSubElem);
if (NULL == pSubElem)
{
continue;
}
brepList.RemoveAll();
hr = pSubElem->GetSpecificBRepAccess(spSpecOnCurve, &brepList);
if (FAILED(hr) || brepList.Size() < 1)
{
continue;
}
spBRep = brepList[1];
if (NULL_var == spBRep)
{
continue;
}
spFeaturize = spBRep;
if (NULL_var == spFeaturize)
{
continue;
}
spSpecObjectOnSketchCurve = spFeaturize->FeaturizeR(MfPermanentBody|MfLastFeatureSupport|MfNoDuplicateFeature);
if (NULL_var == spSpecObjectOnSketchCurve)
{
continue;
}
spInputSketchCurve.Append(spSpecObjectOnSketchCurve);
}
网友评论