- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- AcDbObjectId createInsertForBlock (AcDbObjectId blockId, AcGePoint3d basePoint,
- AcGeScale3d scaleFactor, double rotationAng,
- AcGeVector3d vector, AcDbObjectId ownerRefId,
- AcDbObjectId blockRefLayId)
- {
- AcDbDatabase *pDB;
- AcDbBlockReference *pBlkRef;
- AcDbBlockTable *pBlockTable;
- AcDbBlockTableRecord *pBlockTableRecord;
- AcDbObjectId newEntId;
- AcDbBlockTableRecord *pBlockDef;
- AcDbBlockTableRecordIterator *pIterator;
- AcDbBlockReference *pOriginalRef;
- AcDbObjectIterator *pIterRef;
- AcDbEntity *pEnt;
- AcDbAttributeDefinition *pAttdef;
- pDB = acdbHostApplicationServices()->workingDatabase();
- pBlkRef = new AcDbBlockReference;
- pBlkRef->setBlockTableRecord(blockId);
- pBlkRef->setNormal(vector);
- pBlkRef->setPosition(basePoint);
- pBlkRef->setScaleFactors(scaleFactor);
- pBlkRef->setRotation(rotationAng);
- pBlkRef->setLayer(blockRefLayId, Adesk::kFalse);
- pDB->getBlockTable(pBlockTable, AcDb::kForRead);
- pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
- AcDb::kForWrite);
- pBlockTable->close();
- pBlockTableRecord->appendAcDbEntity(newEntId, pBlkRef);
- pBlockTableRecord->close();
- acdbOpenObject(pBlockDef, blockId, AcDb::kForRead);
- pBlockDef->newIterator(pIterator);
- //____iterating original block ref for attributes
- acdbOpenObject(pOriginalRef,ownerRefId,AcDb::kForRead);
- pIterRef =pOriginalRef->attributeIterator ();
- pOriginalRef->close();
- for(pIterator->start(); !pIterator->done(); pIterator->step())
- {
- pIterator->getEntity(pEnt, AcDb::kForRead);
- pAttdef = AcDbAttributeDefinition::cast (pEnt);
- if (pAttdef != NULL && !pAttdef->isConstant())
- {
- //____iteration of original block ref continues...
- AcDbObject *pObj;
- AcDbObjectId ida;
- AcDbAttribute *pAtt;
- AcDbObjectId attId;
- ida = pIterRef->objectId();
- acdbOpenObject(pObj, ida, AcDb::kForRead);
- pAtt = AcDbAttribute::cast(pObj->clone());
- pObj->close();
- pAtt->setTextString("XXX");
- pBlkRef->appendAttribute(attId, pAtt);
- pAtt->close();
- pIterRef->step();
- }
- pEnt->close();
- }
- delete pIterator;
- delete pIterRef;
- pBlockDef->close();
- pBlkRef->close();
- return newEntId;
- }
|
|