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

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

APIEnv_SetCurrent3DStyleID Error

Anonymous
Not applicable
I have Error This Source in Debug
(ArchiCAD 23 API / Windows / Visual Studio 2017 C++/Japanese)


//----------------------------------------------
Error Message / Code Stopped
ハンドルされない例外が0x0007FF8866B4B89(KernalBase.dll)で発生しました
(ARCHICAD.exe内);
0xC000041D:ユーザーコールバック中に未処理の例外がはっせいしました。

//----------------------------------------------
GS::UniString curStyleName;
GS::Array <GS::UniString> StyleList;
GSErrCode err = ACAPI_Environment(
APIEnv_Get3DStyleListID
, &stylesNames
, &currentStyleName
);
if(err==NoError){
GS::UniString u = StyleList[0];
err = ACAPI_Environment(
APIEnv_SetCurrent3DStyleID
, &u
);
}
//----------------------------------------------
2 REPLIES 2
In the code you posted it seems that some variable names are inconsistent (curStyleName <-> currentStyleName, StyleList <-> stylesNames), but that might be fine depending on the context your code is in.

Anyway I also get the same error when running the function "Do_Edit3DStyles" from the API Example "Environment_Control".
When debugging it I saw, that it runs into the following assertion:
ODB assertion failed at P:\VMWD\Build\Sources\ObjectDatabase\ObjectDatabaseDll\Database\ODBDatabase.cpp 1275
    assert id: A9CF0419-32EB-4DEB-A7EB-73B9F6B82C7F
    description: can't open modification scope inside transaction (modification scope should be the outermost)
I then tried to wrap ACEnv_SetCurrent3DStyleID in ACAPI_CallCommand but that still gives the same error. I filled out a bit more detailed bug report for Graphisoft. In case I hear back from them I'll let you know.
Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: bschwb.com
Anonymous
Not applicable
Thank You Your Answer.
Sorry, I missed My Variable Names in C++ Source.
But This Error is not caused by Variable Names.

I'm hoping in order to evade this error by your report.