TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- AcDbObjectId CBlockUtil::InsertDwf(CString strFileFullPath, CString strFileName, AcGePoint3d insertPoint, double dbScale, double dbRotation)
- {
- AcDbDictionary *pNamedobj = NULL;
- AcDbDictionary *pAPPDict = NULL;
- AcDbDictionary *pDict = NULL;
- AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
- Acad::ErrorStatus es;
- es = pDb->getNamedObjectsDictionary(pNamedobj, AcDb::kForWrite);
- if (Acad::eOk != es) return false;
- CString strAppName = TEXT("APP"), strFieldName = TEXT("PLOT");
- if (pNamedobj->getAt(strAppName, (AcDbObject*&)pAPPDict, AcDb::kForWrite) == Acad::eKeyNotFound)
- {
- pAPPDict = new AcDbDictionary;
- AcDbObjectId dictId;
- pNamedobj->setAt(strAppName, pAPPDict, dictId);
- }
- pNamedobj->close();
- if (pAPPDict->getAt(strFieldName, (AcDbObject*&)pDict, AcDb::kForWrite) == Acad::eKeyNotFound)
- {
- pDict = new AcDbDictionary;
- AcDbObjectId dictId;
- pAPPDict->setAt(strFieldName, pDict, dictId);
- }
- pAPPDict->close();
- AcDbDwfDefinition *pDwfDef = new AcDbDwfDefinition;
- pDwfDef->setSourceFileName(strFileFullPath);
- AcDbObjectId entId;
- es = pDict->setAt(strFileName, (AcDbObject*&)pDwfDef, entId);
- pDict->close();
- pDwfDef->close();
- AcDbDwfReference *pDwfRef = new AcDbDwfReference;
- es = pDwfRef->setDefinitionId(entId);
- es = pDwfRef->setPosition(insertPoint);
- es = pDwfRef->setRotation(dbRotation);
- es = pDwfRef->setScaleFactors(dbScale);
- es = pDwfRef->setIsOn(true);
- es = pDwfRef->setFade(0);
- AcDbObjectId idDwfRef = AcDbObjectId::kNull;
- idDwfRef = CDwgDatabaseUtil::PostToModelSpace((AcDbEntity*)pDwfRef);
- pDwfRef->close();
- return idDwfRef;
- }
复制代码 |
|