License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

How to get drawings from layout / How to change drawings size

ARN
Newcomer
Hi,

Does anybody know how to get drawings from layout and how to change drawings size?

Here's my code:

API_DatabaseUnId *dbases = NULL;
API_DatabaseInfo dbLayoutBook;
OSErr err;
Int32 nDbases = 0;

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)
// FIRST PART: NOW HOW TO GET DRAWINGS THAT BELONGS THIS LAYOUT?

// SECOND PART: HOW TO CHANGE IT'S DRAWING(S) (Layout is now in 'hand' (dbases), includind it's size etc.). I mean drawing's size and origo should now set to fit in layout
??
}
}
if(dbases != NULL)
BMpFree(reinterpret_cast<GSPtr>(dbases));
}

The problem is that drawing is bigger than layout and the drawing should fix to the right size (and also position relative to layout)

What I miss now??

BR
Ari
2 REPLIES 2
Anonymous
Not applicable
Hey

Check this thread:
https://archicad-talk.graphisoft.com/viewtopic.php?f=23&t=62853&hilit=Navigator+items+especially+lay...

I can tell you that you need to change element.drawing.ratio but the bounds won’t change to fit the new size and you’ll have to click “update” to update the drawing’s bounds to its new size.
I am also looking for a solution for a way to change the bounds and not just the ratio.
ARN
Newcomer
Thank for your answer. I got the same result. Let's be in contact in future. BR Ari Räsänen