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

Splitting Drawings in Layout

Nayan
Booster
Hi,
I am trying to Split a drawing into two drawings.
The situation is:
While placing a drawing in layout we need to split the drawing into two drawings(just make the drawing into half) and will put in on the layout.
I have tried it with "APIDb_StartClippingSessionID" function:

API_Region          clipRegion;
BNZeroMemory(&clipRegion, sizeof(API_Region));
clipRegion.box.xMin = 0.0;
clipRegion.box.xMax = .2;
clipRegion.box.yMin = 0.0;
clipRegion.box.yMax = .1;

err = ACAPI_Database(APIDb_StartClippingSessionID, nullptr, nullptr);
if (err == NoError) {
		API_Element element;
		BNZeroMemory(&element, sizeof(API_Element));
		element.header.typeID = API_DrawingID;
		err = ACAPI_Element_GetDefaults(&element, nullptr);
		if (err != NoError) {
			return err;
		}
		//here the Selectedguid array holds the ViewNavigator Item guid
		element.drawing.drawingGuid = Selectedguid[0];
		element.drawing.anchorPoint = APIAnc_LB;
		element.drawing.pos.x = 0.05;
		element.drawing.pos.y = 0.05;
		err = ACAPI_CallUndoableCommand("crate new from last drawing", [&]()->GSErrCode {
			err = ACAPI_Element_Create(&element, nullptr);
			err = ACAPI_Database(APIDb_DoClipID, &clipRegion, nullptr);
			err = ACAPI_Database(APIDb_StopClippingSessionID, nullptr, nullptr);
			return err;
			});
But it's not working. On "ACAPI_Database(APIDb_DoClipID, &clipRegion, nullptr)" method getting error code "-2130313215" that refers to the "General error code".
Any suggestion how can I achieve it?
0 REPLIES 0