ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Close default dwg with some change without "Save" dialogbox for ACAD 2015

0 REPLIES 0
Reply
Message 1 of 1
sandeepkhot.1
389 Views, 0 Replies

Close default dwg with some change without "Save" dialogbox for ACAD 2015

Hello All,

 

    My execution sequence is like,

 

1] load .ARX file.

2] add a layer in default drawing. (Drawing1.dwg)

3] Open another drawing.

4] Save as default drawing by name "DeleteDrawing.dwg" and close it. (Need to save as it has a layer added in it)

5] Execute some operation on newly opened drawing.

6] Close all documents.

 

I have attached code for point 4] above, it works well in all other AutoCADs (2013, 2014 etc) but creates problem on 2015 only it flashes "Save" dialogbox while closing documents, I think problem lies at this part only.

 

Code,

 

                CString sDeleteDWGName = ("C:\\deletedrawing.dwg");
                    
                int iFolderrLen = sDeleteDWGName.GetLength();
                TCHAR *sName = new TCHAR[iFolderrLen + 1];
                _stprintf(sName, _T("%s"), sDeleteDWGName);
                sName[iFolderrLen] = _T('\0');
                Acad::ErrorStatus eStatus = Acad::eOk;
                
                AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();
                AcApDocument *pDeleteDrawingDoc = NULL;                
                GetDocFromFilename(_T("Drawing1.dwg"), pDeleteDrawingDoc);      //initializes AcApDocument with document specified name.         
                if(pDeleteDrawingDoc)
                {
             
                    es = acDocManagerPtr()->setCurDocument(pDeleteDrawingDoc, AcAp::kNone, false);    
                    if(es == Acad::eOk)
                    {                     
                        eStatus = pDB->saveAs(sName);                       
                    }                  
                    Acad::ErrorStatus stt = acDocManager->sendStringToExecute(pDeleteDrawingDoc, _T("QSAVE "), false, true);                  
                    acDocManager->closeDocument(pDeleteDrawingDoc);                    
                    stt = acDocManager->sendStringToExecute(pDeleteDrawingDoc, _T("CLOSE "), false, true);
                }

 

Any help would be appreciable,

Thanks in advance.

 

Regards,

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost