- 积分
- 1148
- 明经币
- 个
- 注册时间
- 2004-5-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我的程序在VC中编译没错,但运行到输入标号,按回车后就出现异常,但CAD不会退出!请高手指点一二!!!我的程序如下:
void ACADbiaohao() { #ifdef OARXWIZDEBUG acutPrintf ("\nOARXWIZDEBUG - ACADbiaohao() called."); #endif // OARXWIZDEBUG
// TODO: Implement the command AcGePoint3d sp,ep,dp,textp; AcGeVector3d normal(0,0,1); char cha[3]; if(acedGetPoint(NULL,"\n请选择所标对象:",asDblArray(sp))!=RTNORM) return; if(acedGetPoint(asDblArray(sp),"\n请选定标号位置:",asDblArray(dp))!=RTNORM) return; if(acedGetString(Adesk::kTrue,"\n请输入标号:",cha)!=RTNORM) return; if(dp[X]>sp[X]) { ep[X]=dp[X]+10; ep[Y]=dp[Y]; ep[Z]=0; textp[X]=dp[X]+3; textp[Y]=dp[Y]+1; textp[Z]=0; } else { ep[X]=dp[X]-10; ep[Y]=dp[Y]; ep[Z]=0; textp[X]=dp[X]-7; textp[Y]=dp[Y]+1; textp[Z]=0; } AcDbBlockTable *pbt; acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pbt,AcDb::kForRead); AcDbBlockTableRecord *pbtr; pbt->getAt(ACDB_MODEL_SPACE,pbtr,AcDb::kForWrite); pbt->close(); AcDbLine *pline=new AcDbLine(sp,dp); AcDbLine *pline1=new AcDbLine(dp,ep); AcDbCircle *pcircle=new AcDbCircle(sp,normal,0.3); AcDbObjectId lineid; AcDbObjectId lineid1; AcDbObjectId circleid; pbtr->appendAcDbEntity(lineid,pline); pbtr->appendAcDbEntity(lineid1,pline1); pbtr->appendAcDbEntity(circleid,pcircle); AcDbText *ptext=new AcDbText(textp,cha,NULL,3,0); pbtr->appendAcDbEntity(ptext); ptext->close(); pcircle->close(); pbtr->close(); pline->close(); pline1->close(); } |
|