Hi Group,
I have few questions, it would be great if anyone has any inputs on it. I am struggling to get it cleared...
1. AcDbDatabase:saveAs:
The ObjectARX document says:
"Before calling this function, set the current database as the working database. Otherwise, failures may occur."
Does this indicate that the AcDbDatabase object on which we are calling this method should be set as current working database and after save the old database should be restored?
e.g.
//Set m_pDatabase as working one and restore old one after save.
AcDbDatabase* pOldDb = NULL;
pOldDb = acdbHostApplicationServices()->workingDatabase();
acdbHostApplicationServices()->setWorkingDatabase(m_pDatabase);
m_pDatabase->saveAs();
acdbHostApplicationServices()->setWorkingDatabase(pOldDb);
2. Is it necessary to lock/set current document for the drawing for which saveAs is getting called and
after save unlock/restore earlier document as current?
3. readDwgFile().
It is mentioned that This function should only be used on a newly created AcDbDatabase.
Now we can create AcDbDatabase as
AcDbDatabase(bool buildDefaultDrawing = true, bool noDocument = false);
If noDocument == true, then the newly created database will not be associated with the current document; otherwise it will. What does this statment indicate?
Now suppose I have a drawing A which contains external reference to drawing B. Drawing is A is currently opened in ACAD.
I want to open and updated XREFed drawing B. So I do it like:
///////////////////////////////////////////////////////
AcDbDatabase* pDatabase = new AcDbDatabase(true, true);
pDatabase->readDwgFile("Full path of drawing B");
...
//update some attributes of drawing B
...
pDatabase->saveAs("Full path of drawing B");
///////////////////////////////////////////////////////
Is this correct way of editing xrefed drawing information?
As readDwgFile does not open any document as such in ACAD so I can not obtain the AcApDocument pointer
by using : AcApDocument* pDocRead = acDocManager->document(pDatabase); So I can not lock/unlock the file opened by readDwgFile.
If there is any problem in explaining the problem from my side, please correct me.
Eagerly waiting for your expert replies....
-Prashant