1.获取面
bool ThkHPipPrtMdl::GetRefSrf()
{
if (m_tSld.IsEmpty())
{
return false;
}
CAtlArray<ThkFeature> arrFeat;
m_tSld.GetFeatByParam(arrFeat,THK_HPIP_FTYPE, E_HPIP_FEAT_EXT);
if (arrFeat.GetCount()<=0)
{
return false;
}
ThkFeature tFeat = arrFeat[0];
CAtlArray<ProGeomitem> arrSur;
tFeat.VisitGeomitem(arrSur,PRO_SURFACE);
for (int i=0;i<(int)arrSur.GetCount();i++)
{
ThkSurface tSrf=arrSur[i];
if (tSrf.IsEmpty())
{
continue;
}
if (tSrf.GetType()!=PRO_SRF_PLANE || tSrf.GetArea()<=0.0)
{
continue;
}
if (m_tStartSrf.IsEmpty() && tSrf.GetDist(m_tStartPnt.GetPos()) == 0 && tSrf.IsInside(m_tStartPnt.GetPos()))
{
m_tStartSrf = tSrf;
}
else if (tSrf.GetDist(m_tEndPnt.GetPos()) == 0 && tSrf.IsInside(m_tEndPnt.GetPos()) && abs(tSrf.GetArea() - m_tStartSrf.GetArea()) <1.0e-3)
{
m_tEndSrf = tSrf;
}
if (!m_tStartSrf.IsEmpty() && !m_tEndSrf.IsEmpty())
{
break;
}
}
return true;
}
2.获取点
bool ThkHPipPrtMdl::GetRefPnt()
{
if (m_tSld.IsEmpty())
{
return false;
}
CAtlArray<ThkFeature> arrFeat;
m_tSld.GetAllFeature(arrFeat);
for (int i = 0; i < (int)arrFeat.GetCount(); i++)
{
ThkFeature tFeat = arrFeat[i];
if (tFeat.IsEmpty())
{
continue;
}
if (tFeat.GetIntParam(_T(THK_HPIP_FTYPE))!= E_HPIP_FEAT_REFPNT)
{
continue;
}
CAtlArray<ProGeomitem> arrGeom;
tFeat.VisitGeomitem(arrGeom, PRO_POINT);
if ((int)arrGeom.GetCount()<=1)
{
continue;
}
m_tStartPnt = arrGeom[0];
int nIdx = (int)arrGeom.GetCount();
m_tEndPnt = arrGeom[nIdx - 1];
break;
}
return true;
}