- 积分
- 427
- 明经币
- 个
- 注册时间
- 2005-2-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
<BR>void InsertBlock(ads_point basePoint,double angle)<BR>{<BR> AcDbDatabase *pDwg =new AcDbDatabase (Adesk::kFalse) ; <BR> Acad::ErrorStatus es;<BR> es=pDwg->readDwgFile ("C:\\ccd.dwg") ; <BR> <BR> if(es==Acad::eOk)<BR> {<BR> AfxMessageBox("readDwgFile Successful!");<BR> return;<BR> }<BR> AcDbObjectId blockId ; <BR> <BR> es = acdbHostApplicationServices()->workingDatabase()->insert (blockId, "myfile", pDwg, <BR> Adesk::kFalse) ; <BR> if ( es != Acad::eOk ) <BR> acutPrintf ("\n插入块错误.") ; <BR> delete pDwg ; <BR> <BR> <BR> AcDbBlockReference *pBlkRef =new AcDbBlockReference ; <BR> pBlkRef->setBlockTableRecord (blockId) ;
AcGePoint3d inbase(basePoint[X], basePoint[Y], 0.0); <BR> pBlkRef->setPosition (inbase) ; <BR> pBlkRef->setRotation (0.0) ;<BR> pBlkRef->setScaleFactors(AcGeScale3d(1,1,1));<BR> <BR> AcDbBlockTable *pBlockTable ; <BR> <BR> es=acdbHostApplicationServices()->workingDatabase()->getBlockTable (pBlockTable, AcDb::kForRead) ; <BR> if(es!=Acad::eOk)<BR> acutPrintf("getBlockTable faile!");<BR> <BR> AcDbBlockTableRecord *pBlockTableRecord ; <BR> es=pBlockTable->getAt (ACDB_MODEL_SPACE, pBlockTableRecord, <BR> AcDb::kForWrite) ; <BR> <BR> if(es!=Acad::eOk)<BR> acutPrintf("getAt faile!");<BR> <BR> pBlockTable->close () ;<BR> AcDbObjectId newEntld;<BR> pBlockTableRecord->appendAcDbEntity(newEntld,pBlkRef);<BR> pBlockTableRecord->close();<BR> pBlkRef->close();<BR> <BR>}
为什么我调用了该函数,插入的图块显示不出来的,是什么原因!
谢谢
|
|