isNamedDrawing()

I try to find if drawing is saved on hard drive or new in memory.
In ObjectARX I can find it with

curDoc()->isNamedDrawing();

AcApDocument

But BRX don't have isNamedDrawing() in AcApDocument.

How can I find if drawing is new or saved?

Comments

  • Dear,

    you might query the database (not the document), for its filename ... if it is a .dwt, then it is in 99% an unsaved drawing, becuase saved database/document usually has .dwg filename ...
    but this might fail, if the database is actively saved as .dwt file.

    There is also originalFilename() as well ... maybe checking both can expose a clear indicator for a saved rawing/database ?
    many greetings !

  • INFODWG
    
     * curDoc()->fileName(): Drawing1.dwg
     * originalFileName(): C:\Users\Donatas\Desktop\Darbas\LISP\LKS94_2018.dwt
    : 
    : _qsave
    : INFODWG
    
     * curDoc()->fileName(): C:\Users\Donatas\Desktop\Drawing1.dwg
     * originalFileName(): C:\Users\Donatas\Desktop\Darbas\LISP\LKS94_2018.dwt
    

    It don't look like originalFileName() will work, but I found curDoc()->fileName()
    If file new and not saved it will return only file name, without path. If drawing are saved it will return filename with path.

    string getFileName(const std::string& s) {
       char sep = '/';
    #ifdef _WIN32
       sep = '\\';
    #endif
       size_t i = s.rfind(sep);
       if (i != std::string::npos) {
          return (s.substr(0, i));
    
       return("");
    }
    

    If I give result from fileName() to my function I will get file path, o empty string.

  • Owen Wengerd
    edited October 2018

    Try:
    resbuf rb = {};
    acedGetVar(L"DWGTITLED", &rb);
    if (rb.resval.rint) {
    //drawing has been saved
    }

  • acedGetVar worked, but need change to rb.resval.rint

This discussion has been closed.