The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

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

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

#304713
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
#304824
Hey

Check this thread:
viewtopic.php?f=23&t=62853&hilit=Naviga ... ly+layouts

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.