- UID
- 353383
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-11-19
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
请高手帮忙分析一下,为什么运行后图块显示不出来,谢谢了!
AcDbBlockTableRecord *pLtBlockTableRec
=new AcDbBlockTableRecord();
pLtBlockTableRec->setName("ASDK_BLOCK_LT2");
//获取块表
//
AcDbBlockTable *pBlockTable=NULL;
acdbCurDwg()->getSymbolTable(pBlockTable,AcDb::kForWrite);
//将新建的块表记录加入到块表中
//
AcDbObjectId blockId;
pBlockTable->add(blockId,pLtBlockTableRec);
pBlockTable->close();
acedGetPoint(NULL,"请选择圆形冷铁的圆心",center);
AcDbCircle *pCircle=new AcDbCircle;
CopyPoint(basePoint,center);
pCircle->setCenter(basePoint);
pCircle->setRadius(lt2_radius);
//AcDbCircle *pCir;
//pCir=new AcDbCircle(center,(0,0,1),lt2_radius);
if (acdbEntLast(ent_lt2[0])!=RTNORM) {
acdbFail("\nFail create last entity.");
return;
}
//
AcDbObjectId circleId;
pLtBlockTableRec->appendAcDbEntity(circleId,pCircle);
//画两条交叉线并将它们作为部件加入块表中
AcGePoint3d pt1,pt2,pt3,pt4;
acutPolar(center,PI/4,lt2_radius,asDblArray(pt1));//获得与圆心成45度角的圆周点
acutPolar(center,5*PI/4,lt2_radius,asDblArray(pt2));
acutPolar(center,3*PI/4,lt2_radius,asDblArray(pt3));
acutPolar(center,7*PI/4,lt2_radius,asDblArray(pt4));
AcDbLine *pLine;
pLine=new AcDbLine(pt1,pt2);
AcDbObjectId lineId1;
//AddEntityToDbs(pLine);
pLtBlockTableRec->appendAcDbEntity(lineId1,pLine);
pLine->close();
pLine=new AcDbLine(pt3,pt4);
AcDbObjectId lineId2;
//AddEntityToDbs(pLine);
pLtBlockTableRec->appendAcDbEntity(lineId2,pLine);
pLine->close();
pLtBlockTableRec->close();
AcDbBlockReference *pBlkRef=new AcDbBlockReference;
pBlkRef->setBlockTableRecord(blockId);
struct resbuf to,from;
from.restype=RTSHORT;
from.resval.rint=1;
to.restype=RTSHORT;
to.resval.rint=0;
AcGeVector3d normal(0.0,0.0,1.0);
acedTrans(&(normal.x),&from,&to,Adesk::kTrue,&(normal.x));
pBlkRef->setPosition(basePoint);
pBlkRef->setRotation(0.0);
pBlkRef->setNormal(normal);
acdbCurDwg()->getSymbolTable(pBlockTable,AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRec;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRec,AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId newEntId;
pBlockTableRec->appendAcDbEntity(newEntId,pBlkRef);
pBlockTableRec->close();
INSERT("ASDK_BLOCK_LT2",center,1,"0"); |
|