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, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy, rmasaki

User avatar
By Ranga Rao
#180459
Hi,

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
#180471
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)
          return;

     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)
                    ACAPI_Database(APIDb_RebuildCurrentDatabaseID);
          }
     }
     ACAP_Database(APIDb_ChangeCurrentDatabaseID, &db_Orig, NULL);
     if(dbases != NULL)
          BMpFree(reinterpret_cast<GSPtr>(dbases));
}
Is this code right?