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

AC17 API_CircleType.origC doesn't work?

Anonymous
Not applicable
Hey All,

I try to read out the center coordinates of a circle, but it always gives 0,0. Can anyone confirm whether it is a bug, and is there any workaround?

Thanks:
Andor
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Andor,

Thanks for pointing out this issue! Unfortunately it's a little bug, circle.origC and circle.r and others are all zero.

But it's only cosmetic bug, you can get all informations about the circle in the element.arc structure (arc.origC and arc.r).

Check out my example code:
GSErrCode			err; 
GS::Array<API_Guid> circleList; 
 
// Get all circles 
err = ACAPI_Element_GetElemList (API_CircleID, &circleList); 
if (err != NoError) { 
	ErrorBeep ("ACAPI_Element_GetElemList ()", err); 
	return; 
} 
WriteReport ("Number of total circles: %u", (GS::UIntForStdio) circleList.GetSize ()); 
 
// Enumerate circles 
for (GS::Array<API_Guid>::ConstIterator it = circleList.Enumerate (); it != NULL; ++it) { 
	API_Element element; 
	BNZeroMemory (&element, sizeof (API_Element)); 
	element.header.typeID = API_CircleID; 
	element.header.guid = *it; 
 
	// Get informations about the circle 
	err = ACAPI_Element_Get (&element); 
	if (err != NoError) { 
		ErrorBeep ("ACAPI_Element_Get ()", err); 
		return; 
	} 
 
	WriteReport ("Circle center point: (%.2f,%.2f)",	/* !!! use .arc instead of .circle !!!*/ element.arc.origC.x, element.arc.origC.y); 
	WriteReport ("Circle radius: %.2f",					/* !!! use .arc instead of .circle !!!*/ element.arc.r); 
}


Regards,
Tibor
Anonymous
Not applicable
Thanks a lot. Btw circle.r works for me, only the center was the issue..