- UID
- 38377
- 积分
- 135
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-3-25
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- static void BDYCAD_TEST(void)
- {
- ads_name name,ss;
- ads_point pt1,pt2;
- char BlockName[123];
- AcGePoint3d Cpt;
- int sel;long len;
- AcDbObjectId BID;
- if (acedSSGet(NULL,NULL,NULL,NULL,ss)!=RTNORM)return;
- if (acedGetPoint(NULL,"\n输入基准点:",pt1)!=RTNORM)return;
- if (acedGetString(FALSE,"\n请输入块名:",BlockName)!=RTNORM)return;
- Cpt.x=pt1[X];Cpt.y=pt1[Y];Cpt.z=pt1[Z];
- AcDbBlockTable *pBlockTable;
- acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable,AcDb::kForWrite);
- if (pBlockTable->has(BlockName)==Adesk::kTrue) {
- acutPrintf("\n这个块已经建立了!");
- pBlockTable->close();
- return;
- }
- AcDbBlockTableRecord *pBlockTableRec= new AcDbBlockTableRecord();
- pBlockTableRec->setName(BlockName);
- pBlockTable->add(pBlockTableRec);
- pBlockTableRec->setOrigin(Cpt);
- pBlockTable->upgradeOpen();
- AcDbEntity *pEnt,*pEnt0;
- acedSSLength(ss,&len);
- for (int i=0;i<len;i++) {
- AcDbObjectId ObjID;
- acedSSName(ss,i,name);
- acdbGetObjectId(ObjID,name);
- acdbOpenAcDbEntity(pEnt,ObjID,AcDb::kForWrite);
- pEnt0=(AcDbEntity*)pEnt->clone();
- pBlockTableRec->appendAcDbEntity(pEnt0);
- pEnt->close();
- pEnt0->close();
- }
- pBlockTable->close();
- pBlockTableRec->close();
- return;
- }
- static void HZCAD_TEST(void)
- {
- ads_name ent, ss;
- ads_point pt1;
- TCHAR BlockName[123] = {0};
- AcGePoint3d Cpt;
- long len;
- AcDbObjectId BID;
- if (acedSSGet(NULL, NULL, NULL, NULL, ss) != RTNORM)
- return;
- if (acedGetPoint(NULL, _T("\n输入基准点:"), pt1) != RTNORM)
- return;
- if (acedGetString(FALSE, _T("\n请输入块名:"), BlockName) != RTNORM)
- return;
- Cpt.x = pt1[X];
- Cpt.y = pt1[Y];
- Cpt.z = pt1[Z];
- AcDbBlockTable *pBlockTable;
- acdbHostApplicationServices()->workingDatabase()->getBlockTable(pBlockTable, AcDb::kForWrite);
- if (pBlockTable->has(BlockName) == Adesk::kTrue)
- {
- acutPrintf(_T("\n这个块已经建立了!"));
- pBlockTable->close();
- return;
- }
- AcDbBlockTableRecord *pBlockTableRec= new AcDbBlockTableRecord();
- pBlockTableRec->setName(BlockName);
- pBlockTable->add(pBlockTableRec);
- pBlockTableRec->setOrigin(Cpt);
- pBlockTable->upgradeOpen();
- acedSSLength(ss, &len);
- for (long int i = 0L; i < len; i++)
- {
- acedSSName(ss, i, ent);
- AcDbObjectId entId;
- Acad::ErrorStatus es = acdbGetObjectId(entId, ent);
- if (es != Acad::eOk)
- {
- return;
- }
- AcDbEntity *pEnt;
- acdbOpenAcDbEntity(pEnt, entId, AcDb::kForWrite);
- AcDbEntity* pEnt0 = (AcDbEntity*)pEnt->clone();
- pBlockTableRec->appendAcDbEntity(pEnt0);
- pEnt0->close();
- pEnt->close();
- }
- pBlockTable->close();
- pBlockTableRec->close();
- return;
- }
|
|