The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, gkmethy, rmasaki, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy

User avatar
By Ranga Rao

Presently I am using DrawingManager->Update Drawings command to update all the layout books.

Can I do it(updating Drawings) By using API Command(s)?
User avatar
By Ranga Rao
I am using fallowing code to refresh all layout books using API.
Code: Select all
void RefreshAllLayoutBooks()
     API_DatabaseUnId *dbases = NULL;
     API_DatabaseInfo db_orig, dbLayoutBook;
     OSErr err;
     Int32 nDbases = 0;

     if(ACAPI_Database(APIDb_GetCurrentDatabaseID, &db_orig, NULL) != noErr)

     if(ACAPI_database(APIDb_GetLayoutDatabasesID, &dbases, NULL) == noErr)
          nDbases = BMpGetSize(reinterpret_cast<GSPtr>(dbases))/sizeof(API_DatabaseUnId);
          for(Int32 ii = 0; ii < Dbases; ++ii)
               BnZeroMemory(&dbLayoutBook, sizeof(API_DatabaseInfo));
               dbLayoutBook.typeID = APIWind_LayoutID;
               dbLayoutBook.databaseUnId = dbases[ii];
               if(ACAPI_Database(APIDb_ChangeCurrentDatabaseID, &dbLayoutBook, NULL) == noErr)
     ACAP_Database(APIDb_ChangeCurrentDatabaseID, &db_Orig, NULL);
     if(dbases != NULL)
Is this code right?