美文网首页
V5-将草图拆分成一组单独的草图线

V5-将草图拆分成一组单独的草图线

作者: 游在路上的鱼 | 来源:发表于2019-03-07 21:45 被阅读0次

    /************************************************************************/

    /* 草图输入模式                                                        */

    /* 将草图拆分为单独线                                                  */

    /************************************************************************/

    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);

    }

    相关文章

      网友评论

          本文标题:V5-将草图拆分成一组单独的草图线

          本文链接:https://www.haomeiwen.com/subject/eyhkpqtx.html