TA的每日心情![](source/plugin/dsu_paulsign/img/emot/kx.gif) | 开心 昨天 15:23 |
---|
签到天数: 69 天 [LV.6]常住居民II
管理员
- 积分
- 2704
|
int isPointOnRegion( bool& bIsOn, AcGePoint3d pt,AcDbObjectId regionId,double dMinDist )
{
Acad::ErrorStatus es;
bIsOn = false ;
AcDbRegion* pRegion ;
es = acdbOpenObject( pRegion, regionId, AcDb::kForRead );
if( es ) return 1;
AcDbVoidPtrArray entitySet;
es = pRegion->explode( entitySet );
pRegion->close();
if ( es )
{
return 2;
}
for ( int i = 0; i < entitySet.length() ; i ++ )
{
if(!((AcDbEntity*)entitySet[i])->isKindOf(AcDbCurve::desc())) continue;
AcDbCurve *pCurve = ((AcDbCurve*&)entitySet[i]);
if ( pCurve == NULL )
{
continue;
}
// 清空
if( bIsOn )
{
delete pCurve;
continue;
}
AcGePoint3d ptOn;
es = pCurve->getClosestPointTo( pt, ptOn );
if ( es )
{
delete pCurve ;
return 3 ;
}
delete pCurve ;
pt.z = ptOn.z = 0;
if ( pt.distanceTo( ptOn ) <= dMinDist )
{
bIsOn = true ;
break ;
}
}
return 0;
} |
|