本文整理汇总了C++中AcDbDatabase::saveAs方法的典型用法代码示例。如果您正苦于以下问题:C++ AcDbDatabase::saveAs方法的具体用法?C++ AcDbDatabase::saveAs怎么用?C++ AcDbDatabase::saveAs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcDbDatabase
的用法示例。
在下文中一共展示了AcDbDatabase::saveAs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToFile
bool CMakeBlkFile::SaveToFile()
{
bool bRet = true;
AcDbDatabase *pDwg = NULL;
Acad::ErrorStatus es;
es = acdbHostApplicationServices()->workingDatabase()->wblock(pDwg, m_objIdArrs, m_insertPt/*, AcDb::kDrcIgnore*/);
if (es == Acad::eOk)
{
AcDb::AcDbDwgVersion dwgVer = acdbHostApplicationServices()->workingDatabase()->originalFileVersion();
es = pDwg->saveAs(m_strFileName,FALSE,dwgVer,0);
if (es!=Acad::eOk)
{
bRet = false;
}
}
if (pDwg != NULL)
{
delete pDwg;
pDwg = NULL;
}
acTransactionManagerPtr()->queueForGraphicsFlush();
acTransactionManagerPtr()->flushGraphics();//刷新
acedUpdateDisplay();
return bRet;
}
示例2: createDatabase
void createDatabase()
{
// Create a new Database.
AcDbDatabase *pDb = new AcDbDatabase();
// Get the BlockTable.
AcDbBlockTable *pBTable = NULL;
pDb->getSymbolTable(pBTable, AcDb::kForRead);
// Get the ModelSpace.
AcDbBlockTableRecord *pRecord = NULL;
pBTable->getAt(ACDB_MODEL_SPACE, pRecord, AcDb::kForWrite);
pBTable->close();
// Create a new Circle.
AcDbCircle *pCircle1 = new AcDbCircle(AcGePoint3d(100,100,0),
AcGeVector3d(0,0,1),
50.0);
// Create another new Circle.
AcDbCircle *pCircle2 = new AcDbCircle(AcGePoint3d(200,200,0),
AcGeVector3d(0,0,1),
30.0);
// Append Circle1 to ModelSpace
pRecord->appendAcDbEntity(pCircle1);
pCircle1->close();
// Append Circle2 to ModelSpace
pRecord->appendAcDbEntity(pCircle2);
pCircle2->close();
pRecord->close();
// Save to file
// MUST append a DWG file extension.
acutPrintf(_T("\nSave file to \"d:\\temp\\testfile.dwg\"."));
pDb->saveAs(_T("d:\\temp\\testfile.dwg"));
delete pDb;
}
示例3: createDwg
void
createDwg()
{
AcDbDatabase *pDb = new AcDbDatabase();
AcDbBlockTable *pBtbl;
pDb->getSymbolTable(pBtbl, AcDb::kForRead);
AcDbBlockTableRecord *pBtblRcd;
pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd,
AcDb::kForWrite);
pBtbl->close();
AcDbCircle *pCir1 = new AcDbCircle(AcGePoint3d(1,1,1),
AcGeVector3d(0,0,1),
1.0),
*pCir2 = new AcDbCircle(AcGePoint3d(4,4,4),
AcGeVector3d(0,0,1),
2.0);
pBtblRcd->appendAcDbEntity(pCir1);
pCir1->close();
pBtblRcd->appendAcDbEntity(pCir2);
pCir2->close();
pBtblRcd->close();
// AcDbDatabase::saveAs() does NOT automatically
// append a DWG file extension, so it
// must be specified.
//
pDb->saveAs(_T("./test1.dwg"));
delete pDb;
}
示例4: acutNewRb
//.........这里部分代码省略.........
// Set up an object ID array.
//
AcDbObjectIdArray objIdArray;
// Iterate over the model space BTR. Look specifically
// for lines and append their object ID to the array.
//
for (pIter->start(); !pIter->done(); pIter->step()) {
AcDbEntity *pEntity;
pIter->getEntity(pEntity, AcDb::kForRead);
// Look for only AcDbLine objects and add them to the
// object ID array.
//
if (pEntity->isKindOf(AcDbLine::desc())) {
objIdArray.append(pEntity->objectId());
}
pEntity->close();
}
delete pIter;
pOtherMsBtr->close();
if (objIdArray.isEmpty()) {
acad_free(fname);
acutPrintf("\nYou must pick a drawing file that contains lines.");
return;
}
// Now get the current database and the object ID for the
// current database's model space BTR.
//
AcDbBlockTable *pThisBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getSymbolTable(pThisBlockTable, AcDb::kForRead);
AcDbBlockTableRecord *pThisMsBtr;
pThisBlockTable->getAt(ACDB_MODEL_SPACE, pThisMsBtr, AcDb::kForWrite);
pThisBlockTable->close();
AcDbObjectId id = pThisMsBtr->objectId();
pThisMsBtr->close();
// Create the long transaction. This will check all the entities
// out of the external database.
//
AcDbIdMapping errorMap;
acapLongTransactionManagerPtr()->checkOut(transId, objIdArray, id, errorMap);
// Now modify the color of these entities.
//
int colorIndex;
acedGetInt("\nEnter color number to change entities to: ", &colorIndex);
AcDbObject* pObj;
if (acdbOpenObject(pObj, transId, AcDb::kForRead) == Acad::eOk) {
// Get a pointer to the transaction.
//
AcDbLongTransaction* pLongTrans = AcDbLongTransaction::cast(pObj);
if (pLongTrans != NULL) {
// Get a work set iterator.
//
AcDbLongTransWorkSetIterator* pWorkSetIter;
pLongTrans->newWorkSetIterator(pWorkSetIter);
// Iterate over the entities in the work set and change the color.
//
for (pWorkSetIter->start(); !pWorkSetIter->done(); pWorkSetIter->step()) {
AcDbEntity *pEntity;
acdbOpenAcDbEntity(pEntity, pWorkSetIter->objectId(), AcDb::kForWrite);
pEntity->setColorIndex(colorIndex);
pEntity->close();
}
delete pWorkSetIter;
}
pObj->close();
}
// Pause to see the change.
//
char str[132];
acedGetString(0, "\nSee the new colors. Press return to check the object into the original database", str);
// Check the entities back in to the original database.
//
acapLongTransactionManagerPtr()->checkIn(transId, errorMap);
// Save the original database, since we have made changes.
//
pDb->saveAs(fname);
// Close/Delete the database
//
delete pDb;
pDb = NULL;
acad_free(fname);
}