2021-05-25
11:25 AM
- last edited on
2021-09-14
09:36 AM
by
Noemi Balogh
GS::Array<API_Guid> drawingList;
err = ACAPI_Element_GetElemList(API_DrawingID, &drawingList);
API_Element mask;
ACAPI_ELEMENT_MASK_CLEAR(mask);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, nameType);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, numberingType);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, name);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, customNumber);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, bounds);
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, ratio);
API_Element element = {};
element.header.guid = drawingGuid;
err = ACAPI_Element_Get(&element);
if (err == NoError) {
element.drawing.nameType = APIName_CustomName;
element.drawing.numberingType = APINumbering_CustomNum;
CHCopyC("Test", element.drawing.name);
CHCopyC("Test", element.drawing.customNumber);
//-----------------------------------------------------------------------------
//Right now doing it manually
//layout size = 392 and drawingSize = 680
//ratio = layout size / drawing size
// = 392 / 680 = .57647
//---------------------------------------------------------------------------------
element.drawing.ratio = .57647;
element.drawing.bounds.xMin = 0.1010;
element.drawing.bounds.xMax = 0.4929;
element.drawing.bounds.yMin = 0.0140;
element.drawing.bounds.yMax = 0.4059;
err = ACAPI_Element_Change(&element, &mask, nullptr, 0, true);
Can anyone kindly help me to figure out what's doing wrong and how can I update the bound values here?Solved! Go to Solution.
2021-05-31 12:30 PM
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, isCutWithFrame);
//....
element.drawing.isCutWithFrame = true;
//....
if (element.drawing.poly.nCoords != 5
|| element.drawing.poly.nSubPolys != 1
|| element.drawing.poly.nArcs != 0) {
DBPrintf("Can only do rectangular polygons for now!");
return;
}
API_ElementMemo memo;
err = ACAPI_Element_GetMemo (element.header.guid, &memo);
if (err != NoError) {
DBPrintf ("Couldn't get Element Memo!");
ACAPI_DisposeElemMemoHdls(&memo);
return;
}
if (memo.coords != nullptr && memo.pends != nullptr) {
(*memo.coords)[1].x = element.drawing.bounds.xMin;
(*memo.coords)[1].y = element.drawing.bounds.yMin;
(*memo.coords)[2].x = element.drawing.bounds.xMax;
(*memo.coords)[2].y = element.drawing.bounds.yMin;
(*memo.coords)[3].x = element.drawing.bounds.xMax;
(*memo.coords)[3].y = element.drawing.bounds.yMax;
(*memo.coords)[4].x = element.drawing.bounds.xMin;
(*memo.coords)[4].y = element.drawing.bounds.yMax;
(*memo.coords)[5].x = (*memo.coords)[1].x;
(*memo.coords)[5].y = (*memo.coords)[1].y;
}
// Adapt your Element_Change line to this
err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_All, true);
ACAPI_DisposeElemMemoHdls(&memo);
2021-05-31 12:30 PM
ACAPI_ELEMENT_MASK_SET(mask, API_DrawingType, isCutWithFrame);
//....
element.drawing.isCutWithFrame = true;
//....
if (element.drawing.poly.nCoords != 5
|| element.drawing.poly.nSubPolys != 1
|| element.drawing.poly.nArcs != 0) {
DBPrintf("Can only do rectangular polygons for now!");
return;
}
API_ElementMemo memo;
err = ACAPI_Element_GetMemo (element.header.guid, &memo);
if (err != NoError) {
DBPrintf ("Couldn't get Element Memo!");
ACAPI_DisposeElemMemoHdls(&memo);
return;
}
if (memo.coords != nullptr && memo.pends != nullptr) {
(*memo.coords)[1].x = element.drawing.bounds.xMin;
(*memo.coords)[1].y = element.drawing.bounds.yMin;
(*memo.coords)[2].x = element.drawing.bounds.xMax;
(*memo.coords)[2].y = element.drawing.bounds.yMin;
(*memo.coords)[3].x = element.drawing.bounds.xMax;
(*memo.coords)[3].y = element.drawing.bounds.yMax;
(*memo.coords)[4].x = element.drawing.bounds.xMin;
(*memo.coords)[4].y = element.drawing.bounds.yMax;
(*memo.coords)[5].x = (*memo.coords)[1].x;
(*memo.coords)[5].y = (*memo.coords)[1].y;
}
// Adapt your Element_Change line to this
err = ACAPI_Element_Change (&element, &mask, &memo, APIMemoMask_All, true);
ACAPI_DisposeElemMemoHdls(&memo);
2021-06-18 01:06 PM
2021-07-01 10:49 AM