cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Access Violation Exception when using ACAPI_DrawingPrimitive_ShapePrims

oleh_arch
Newcomer

While evaluating the examples in API Kit I run into the following issue. I'm getting access violation exception when DrawPrimitives called

GSErrCode	ret = ACAPI_DrawOrder_DrawOrderInit();
if (ret != NoError)
	return;

API_Element	elem;
while ((ret = ACAPI_DrawOrder_DrawOrderGetNext((Int32)(APIFilt_OnVisLayer | APIFilt_OnActFloor), &elem.header)) == NoError) {
	if (elem.header.type != API_WallID)
		continue;

	ret = ACAPI_DrawingPrimitive_ShapePrims(elem.header, DrawPrimitives);
}
ACAPI_DrawOrder_DrawOrderTerm();

 Draw primitive contains only the following code

static GSErrCode DrawPrimitives(const API_PrimElement* primElem,
	const void* par1,
	const void* par2,
	const void* par3)
{
	DBPrintf("Draw Primitives type %s", primElem->header.typeID);
	return NoError;
}

The logic is called while the story window is active. I'm currently running in the DEMO mode. Could it be the reason for the exception? Or am I doing something else wrong?

 

Any help is highly appreciated.

1 REPLY 1
Hiromichi Shinkawa
Graphisoft
Graphisoft

Hi, I purpose the problem was the type conversion: 

DBPrintf("Draw Primitives type %s", primElem->header.typeID);

 Could you try to change %s to %d to see whether the error still happen?

DBPrintf("Draw Primitives type %d", primElem->header.typeID);

 HTH.