|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
代码如下:
HRESULT GetIntersectPoint(const CATISpecObject_var &spMainbodyFeature,const CATISpecObject_var &spLineObj)
{
CATLISTP(CATPoint) LISTPoint = NULL;
HRESULT rc = S_OK;
CATBody_var spMainFeaturebody = NULL_var;
CATBody_var spLineObjBody = NULL_var;
spMainFeaturebody = GetBodyFromFeature(spMainbodyFeature);
if (spMainbodyFeature == NULL_var)
{
cout<<"Error:GetBodyFromFeature(spMainbodyFeature,spMainFeaturebody)"<<endl;
return E_FAIL;
}
cout<<"Get spMainFeaturebody Successful"<<endl;
rc = GetBodyFromFeature(spLineObj,spLineObjBody);
if (FAILED(rc)||(spLineObjBody == NULL_var))
{
cout<<"Error:GetBodyFromFeature(spLineObj,spLineObjBody)"<<endl;
return rc;
}
cout<<"Get spLineObjbody Successful"<<endl;
CATLISTP(CATCell) LISTCell1;
spLineObjBody->GetAllCells(LISTCell1,1);
if (LISTCell1.Size() <= 0)
{
cout<<"can't get line body"<<endl;
return E_FAIL;
}
cout<<"LISTCell1.Size() = "<<LISTCell1.Size()<<endl;
CATLISTP(CATCell) LISTCell2;
spMainFeaturebody->GetAllCells(LISTCell2,2);
if (LISTCell2.Size() <= 0)
{
cout<<"can't get surface body"<<endl;
return E_FAIL;
}
cout<<"LISTCell2.Size() = "<<LISTCell2.Size()<<endl;
CATBody* piLineBody = spLineObjBody;
CATBody* piMainFeaturebody = spMainFeaturebody;
cout<<"get piLineBody and piMainfeaturebody successful"<<endl;
CATSoftwareConfiguration* piConfig = new CATSoftwareConfiguration();
CATTopData topData(piConfig);
CATTopData* ptopData = &topData;
CATGeoFactory* piGeomFactory = ::CATCreateCGMContainer() ;
if (NULL == piGeomFactory)
{
cout<<"Error:::CATCreateCGMContainer()"<<endl;
return E_FAIL;
}
CATHybIntersect* pHyIntersect = CATCreateTopIntersect(piGeomFactory,ptopData,piLineBody,piMainFeaturebody);//这句出错,输入对象不能引用
if (NULL == pHyIntersect) return E_FAIL;
pHyIntersect->Run();
CATBody* piIntersectBody = pHyIntersect->GetResult();
if (piIntersectBody == NULL)
{
cout<<"Error:piIntersectBody == NULL"<<endl;
return E_FAIL;
}
cout<<"Get Intersectbody successful"<<endl;
return rc;
}
求高手指点
|
|