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

Is it possible insert text/drawings into a Independent Worksheet programmatically?

Anonymous
Not applicable
I am creating an Add-on where it would be very useful to be able to create an Independent Worksheet and put a bunch of info onto it.

I know its possible to create a new Independent Worksheet using:

API_DatabaseInfo		dbInfo = {};

dbInfo.typeID = APIWind_WorksheetID;
GS::snuprintf (dbInfo.name, sizeof (dbInfo.name), "Zaphod %ld", ++myPrefs->lastWorksheet);
GS::snuprintf (dbInfo.ref, sizeof (dbInfo.ref), "W%02ld", myPrefs->lastWorksheet);

if (ACAPI_Database (APIDb_NewDatabaseID, &dbInfo) == NoError) {
	DBPrintf ("DatabaseControl :: The ID of the new worksheet database is \"%s\"\n",
		APIGuidToString (dbInfo.databaseUnId.elemSetId).ToCStr ().Get ());
}

However, everything I've found for editing worksheets has to do with editing the worksheet marker, and not what is on the worksheet itself. It's hard because there's very little documentation on this.

Is there a way to Edit / Insert things into the worksheet programmatically? I basically want to use the Document edit tools from code.
1 REPLY 1
Ralph Wessel
Mentor
Yes, you can place elements into a worksheet in exactly the same way as any other drawing. Use ACAPI_Database with APIDb_ChangeCurrentDatabaseID to set the worksheet as the target for drawing operations, and ACAPI_Element_Create to place new elements.
Ralph Wessel BArch