- UID
- 152861
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-6-26
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
1。求助:输入八个定点坐标自动联成一立方体
2。疑惑:为什么下面调用画圆程序后,只能画出一个画圆,在调用则显示不出圆实体
程序如下:
void rdscir()
{
//画圆命令
AcDbObjectId CirId=AcDbObjectId::kNull;
AcGeVector3d normal(0.0,0.0,1.0);
AcGePoint3d center;
ads_real radius;
ads_point pt1;
//初始化输入状态
acedInitGet(RSG_NONULL+RSG_DASH,NULL);
acedGetPoint(NULL,"请输入圆心坐标",pt1);
acedInitGet(RSG_NONULL+RSG_NONEG+RSG_NOZERO,NULL);
acedGetDist(pt1,"入圆的半径",&radius);
center=asPnt3d(pt1);
AcDbCircle *pCirc=new AcDbCircle(center,normal,radius);
//出错处理
if(pCirc==NULL)
return;
postToDb(pCirc,CirId);//将实体写入数据库
}
void postToDb(AcDbEntity *pEnt,AcDbObjectId &entId)
{
AcDbBlockTable *pBlockTable;
//打开块表纪录
Acad::ErrorStatus es=acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);
//如果打开失败,删除圆
if(es!=Acad::eOk)
{delete pEnt;
return;//返回
}
AcDbBlockTableRecord *pBlockTableRecord;
//打开块表纪录
es=pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
if(es!=Acad::eOk)
{ Acad::ErrorStatus es2=pBlockTable->close();
if(es2!=Acad::eOk)
{//弹出严重错误对话框
//acrx_abort("\nApp X failed to close Block Table.Error:%d",acadErrorStatusText(es2));
}
delete pEnt;
return;
}
//关闭块表
es=pBlockTable->close();
if(es!=Acad::eOk)
{ //acrx_abort("\nApp X failed to close Block" "Table.Error:%d", acadErrorStatusText(es));
}
//将实体写入块表纪录并返回ID号
es=pBlockTableRecord->appendAcDbEntity(entId,pEnt);
if(es!=Acad::eOk)
{ Acad::ErrorStatus es2=pBlockTableRecord->close();
if(es2!=Acad::eOk)
{//acrx_abort("\nApp X failed to close "
// "Model Space Block Record.Error:%s",
// acadErrorStatusText(es2));
}
delete pEnt;
return;
}
//关闭块表纪录
if(es!=Acad::eOk)
{acrx_abort("\nApp X failed to "
"Model Space Block Record.Error:%d")
// acadErrorStatusText(es));
;}
//关闭实体纪录
es=pEnt->close();
if (es!=Acad::eOk)
{
acrx_abort("\nApp X faild to"
"close entity.Error:%d")
// acadErrorStatusText(es));
;}
return;
} |
|