BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

Gsm object position issue with Archicad

sijocherian
Contributor

Hi Team,
I am experiencing a problem with a Library Object that I have trying to render through code in Archicad. 
The midpoint of the object while saving it as a gsm is on the center point of the object.
While when i try to create this object to archichad using API, the global position of the object gets defined by the top right corner of the object. No matter the rotation and position, it is always this top left corner from the center point of the IFC structure. 
But if we Place this element through UI, The global position should always be the centre point of the object.

sijocherian_0-1702966344291.png


Is there any way to make the the rendering point in archicad from top right corner to the centre?

Code:

 

GSErrCode CreateFurnitureElement(int storey, const char* name, API_Coord pos, double angle)
{

	API_Element element = {};
	BNClear(element);
	SetAPIElementType(element, API_ObjectID);

	API_ElementMemo memo{};
	BNClear(memo);

	GSErrCode err = ACAPI_Element_GetDefaults(&element, &memo);
	if (err != NoError)
	{
		return err;
	}

	element.object.head.floorInd = short(storey);

	Int32 libInd = GetLibraryIndex(name, APILib_ObjectID);
	if (libInd > 0)
	{
		element.object.libInd = libInd;
		element.object.pos = pos;
		element.object.angle = angle;
		err = ACAPI_Element_Create(&element, &memo);
		if (err != NoError)
		{

			return err;
		}
	}
	return NoError;
}

 

Thank you.





0 REPLIES 0
Learn and get certified!