iCAx开思网

标题: 谁做过 CAA_V5_For_CATIA_Foundations_Exercises 这个例子,请指导一下,谢谢。 [打印本页]

作者: powermill    时间: 2011-8-19 09:00
标题: 谁做过 CAA_V5_For_CATIA_Foundations_Exercises 这个例子,请指导一下,谢谢。
我在做 exercises1的 第二步时,CreatePoint这个函数怎样使用,我不会用,总是出错,请指导,谢谢。
相关的原程序如下:

CAAOmtPoint::CAAOmtPoint(double iX, double iY):
    CATBaseUnknown(),
                _x(iX),
                _y(iY)
{
}   

  HRESULT CAAOmtModelFactory::CreatePoint(double      iX,                                         double      iY,
                                        CAAIPoint** opiNewCAAIPoint)
{
        HRESULT rc = E_FAIL;
  *opiNewCAAIPoint = NULL;

        // Create the point implementation
        CAAOmtPoint* pNewPoint = new CAAOmtPoint(iX, iY);
        if(!pNewPoint) {
                cout << "CreatePoint(): could not create a CAAOmtPoint" << endl << flush;
                return NULL;
        }
       
        // Get a CATIPoint on pNewPoint
        rc = pNewPoint->QueryInterface(IID_CAAIPoint,
                                       (void**) opiNewCAAIPoint);
        if(FAILED(rc)) {
                cout << "CreatePoint(): could not obtaine CAAIPoint interface" << endl << flush;
                return E_FAIL;
        }
        pNewPoint->Release();
        pNewPoint=NULL;

        cout << "I Got a Point...." << endl << flush;

        return S_OK;

}



我在使用时,是这样的:

CAAOmtModelFactory * pCreatePointFactory;
        pCreatePointFactory =(CAAOmtModelFactory *) new CAAOmtModelFactory();


        //  2. Use factory to create a point

        CAAIPoint** opiNewPoint=NULL;


        rc = pCreatePointFactory -> CreatePoint(20,20,???);

CreatePoint函数的第三个变量是返回值,我应该怎样初始化?




作者: powermill    时间: 2011-9-6 08:46
现在清楚了,是这样使用:
CAAIPoint*  opiNewPoint=NULL;

  rc = pCreatePointFactory -> CreatePoint(20,20,&opiNewPoin);




欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3