We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-12-19 07:17 AM - last edited on 2024-09-17 12:43 PM by Doreena Deng
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.
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.