下面是我的代码: LPDISPATCH pAppDisp; pAppDisp = acedGetAcadWinApp()->GetIDispatch(TRUE); VARIANT pArrayObjs; VariantInit(&pArrayObjs); V_VT(&pArrayObjs) = VT_ARRAY | VT_DISPATCH; double val[3] = {0,0,0}; VARIANT basePoint ; CTransUtil::PointsToVariant (val,&basePoint);//将double型数组转换为VARIANT型 AcGePoint3d ptCenter(100, 100, 0); AcDbObjectId objId=CTransUtil::CreateCircle(ptCenter, 20);//创建一个以100,100为圆心以20为半径的圆 if (SUCCEEDED(AcAxArrayPolar(objId,pAppDisp,4,2*(CTransUtil::PI()),basePoint,&pArrayObjs)))acutPrintf("\nsucceeded"); //将DOUBLE转换为VARIANT型 void CTransUtil::PointsToVariant (double* pt,VARIANT *a) {SAFEARRAYBOUND rgsaBound; rgsaBound.lLbound=0L; rgsaBound.cElements=3; SAFEARRAY* psa=NULL; psa=SafeArrayCreate(VT_R8,1,&rgsaBound); for(long i=0;i<3;i++) {if( FAILED(SafeArrayPutElement(psa,&i,&pt))) acutPrintf("\nPutElement FAILED"); } V_VT(a)=VT_ARRAY | VT_R8; V_ARRAY(a)=psa;} 调试时代码没有问题,可是在执行时却显示CAD内部命令出错,请问我哪里出了问题??? 高手一定帮帮忙啊 |