cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

AC26 API 'APIEnv_GetDocumentFrom3DSettingsID' is crashing

Erenford
Booster

Hello, I've been experimenting on 3D Documents and I've encountered crashing when I use 'APIEnv_GetDocumentFrom3DSettingsID'. Then I checked and run the Database_Control example and it also crashes on that line ' GSErrCode err = ACAPI_Environment (APIEnv_GetDocumentFrom3DSettingsID, &dbPars.databaseUnId, &documentFrom3DType);'.

 

static void		Do_Change3DDocument ()
{
	API_DatabaseUnId	*dbases = nullptr;

	if (ACAPI_Database (APIDb_GetDocumentFrom3DDatabasesID, &dbases) == NoError) {
		GSSize nDbases = BMpGetSize (reinterpret_cast<GSPtr>(dbases)) / Sizeof32 (API_DatabaseUnId);

		if (nDbases > 0) {
			API_DatabaseInfo dbPars;
			API_DocumentFrom3DType documentFrom3DType;
			BNZeroMemory (&dbPars, sizeof (API_DatabaseInfo));
			dbPars.databaseUnId = dbases[0];

			GSErrCode err = ACAPI_Environment (APIEnv_GetDocumentFrom3DSettingsID, &dbPars.databaseUnId, &documentFrom3DType);
			if (err == NoError) {
				documentFrom3DType.attributeOptions.shouldUseUniformCutAttributes = !documentFrom3DType.attributeOptions.shouldUseUniformCutAttributes;
				err = ACAPI_Environment (APIEnv_ChangeDocumentFrom3DSettingsID, &dbPars.databaseUnId, &documentFrom3DType);
				if (err != NoError)
					DBPrintf ("APIEnv_ChangeDocumentFrom3DSettingsID returns with error code");
			} else {
				DBPrintf ("APIEnv_GetDocumentFrom3DSettingsID returns with error code");
			}

			BMKillHandle (reinterpret_cast<GSHandle*> (&documentFrom3DType.cutSetting.shapes));
		}
	}

	if (dbases != nullptr)
		BMpFree (reinterpret_cast<GSPtr>(dbases));
}

 

This is the exception detected by Visual Studio

Erenford_0-1691059392778.png

 

I also tried running the AC25 addon and it works fine so this looks like a problem for AC26 API

Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
0 REPLIES 0

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!