- UID
- 37996
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-3-24
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
以下一段程序应该没问题,我也用block命令做了块gc1234,可为什么却提示:Block definition gc1234 not found,怎么回事呢?
void insrtBlk()
{
char blkName[50];
AcDbDatabase *pCurDb;
AcDbBlockTable *pBlkTable;
AcDbBlockTableRecord *pBlkTableRecord;
AcDbBlockReference *pInsrtObj;
AcDbObjectId blkId;
AcGePoint3d insPt;
int retCode;
retCode = acedGetString(0, "\nEnter Block Name: ", blkName);
if(retCode != RTNORM || blkName[0] == '\0')
{
acutPrintf("\nInvalid block name.");
return;
}
pCurDb = acdbHostApplicationServices()->workingDatabase();
// Check to see if the block table
// has blkName
pCurDb->getBlockTable(pBlkTable, AcDb::kForRead);
if(!pBlkTable->has(blkName))
{
acutPrintf("\nBlock definition %s not found. ", blkName);
pBlkTable->close();
return;
}
// Get the AcDbObjectId of the block
// definition.
pBlkTable->getAt(blkName, blkId);
pBlkTable->getAt(ACDB_MODEL_SPACE, pBlkTableRecord, AcDb::kForWrite);
pBlkTable->close();
acedInitGet(RSG_NONULL, NULL);
acedGetPoint(NULL, "\nPick insertion point: ", asDblArray(insPt));
pInsrtObj = new AcDbBlockReference(insPt, blkId);
// Here is where you can set scale, rotation and other
// properties to the block entity. If you want to
// see the AcDbBlockReference class for more details.
pBlkTableRecord->appendAcDbEntity(blkId, pInsrtObj);
pBlkTableRecord->close();
pInsrtObj->close();
} |
|