BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

Update drawings programatically

Anonymous
Not applicable
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)?
3 REPLIES 3
Link
Graphisoft Partner
Graphisoft Partner
Ralph Wessel's Codebook add-on does that.

Cheers,
Link.
Anonymous
Not applicable
I am using fallowing code to refresh all layout books using API.

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?
Anonymous
Not applicable
Link wrote:
Ralph Wessel's Codebook add-on does that.

Cheers,
Link.
Where can I find it?
Learn and get certified!