SOLVED!
Moving Dimension text thru API disables 'Always Readable'?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-01-11
12:08 PM
- last edited on
‎2022-10-04
04:43 PM
by
Daniel Kassai
‎2019-01-11
12:08 PM
Hello everyone,
What I'm trying to do is to move the dimension text (force it to the center) if its automatic position is outside. I've successfully done it, but I noticed that when I move it thru API, 'Always Readable' is disabled. I tried moving the text manually on Archicad and it didn't change it.
I've also tried setting it to true whenever I change element, but it turns out it doesn't have an equivalent variable in the 'API_NoteType' struct (or I kind of missed it).
I've tried this on Dimensions, Radial Dimension, and Hatches, elements using API_NoteType.
The only changes I do on the element memo is:
memo.dimElems[].note.pos = [center]
memo.dimElems[].note.fixPos = true
Below is a copy of my code:
What I'm trying to do is to move the dimension text (force it to the center) if its automatic position is outside. I've successfully done it, but I noticed that when I move it thru API, 'Always Readable' is disabled. I tried moving the text manually on Archicad and it didn't change it.
I've also tried setting it to true whenever I change element, but it turns out it doesn't have an equivalent variable in the 'API_NoteType' struct (or I kind of missed it).
I've tried this on Dimensions, Radial Dimension, and Hatches, elements using API_NoteType.
The only changes I do on the element memo is:
memo.dimElems[].note.pos = [center]
memo.dimElems[].note.fixPos = true
Below is a copy of my code:
GSErrCode Dimension_MoveTextToCenter(API_Guid& i_guid) { API_ElementMemo memo; BNZeroMemory(&memo, sizeof(memo)); GSErrCode err = ACAPI_Element_GetMemo(i_guid, &memo, APIMemoMask_AdditionalPolygon); if (err != NoError) DBGPrintlnf("[" __FUNC__ "] ERROR %s - ACAPI_Element_GetMemo(APIMemoMask_AdditionalPolygon)", ErrId2Name(err)); else { bool hasChanges = false; const UInt32 nDimElem = BMGetHandleSize((GSHandle)memo.dimElems) / sizeof(API_DimElem); for (UInt32 d = 1; d < nDimElem; ++d) { auto& dimElem = (*memo.dimElems); if (dimElem.dimVal == 0) continue; auto& dimElemPrev = (*memo.dimElems)[d - 1]; if (!Dimension_MoveTextToCenter(dimElem.note, dimElem.pos, dimElemPrev.pos)) continue; double length = 0; const GSErrCode err = Any_GetTextLineLength(dimElem.note, length); if (err != NoError) { DBGPrintlnf("[Error] %s " __FUNC__ " - ACAPI_Goodies(APIAny_GetTextLineLengthID)", ErrId2Name(err)); break; } API_Coord pos; pos.x = (dimElem.pos.x + dimElemPrev.pos.x) / 2; pos.y = (dimElem.pos.y + dimElemPrev.pos.y) / 2; if (dimElem.note.noteAngle != 0) RotatePoint(pos, -dimElem.note.noteAngle); pos.x -= (length / 2); pos.y += (GetDrawingScale() / 2) / 1000; if (dimElem.note.noteAngle != 0) RotatePoint(pos, dimElem.note.noteAngle); dimElem.note.pos = pos; dimElem.note.fixPos = true; hasChanges = true; } if (err == NoError && hasChanges) { ACAPI_CallUndoableCommand("Change Memo", [&]() -> GSErrCode { err = ACAPI_Element_ChangeMemo(i_guid, APIMemoMask_AdditionalPolygon, &memo); return NoError; }); if (err == NoError) DBGPrintlnf("[" __FUNC__ "] SUCCESS ACAPI_Element_ChangeMemo"); else DBGPrintlnf("[Error] %s " __FUNC__ " - ACAPI_Element_ChangeMemo()", ErrId2Name(err)); } } ACAPI_DisposeElemMemoHdls(&memo); return err; }
Solved! Go to Solution.
Labels:
- Labels:
-
Add-On (C++)
1 ACCEPTED SOLUTION
Accepted Solutions
Solution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-02-04 05:37 PM
‎2019-02-04
05:37 PM
Yes, it is indeed a bug. I made an entry for it. Let me know if this is a great deal for the project, and we will do our best to fix it.
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-01-30 06:44 PM
‎2019-01-30
06:44 PM
Hello,
Could you specify the version of ArchiCAD you are using?
Could you specify the version of ArchiCAD you are using?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-02-01 04:08 AM
‎2019-02-01
04:08 AM
sznagy wrote:that was ArchiCAD 22 3006 INT FULL
Hello,
Could you specify the version of ArchiCAD you are using?
I've recently updated to 5009 and tested again, still same output, the 'always readable' turns off.
Solution

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-02-04 05:37 PM
‎2019-02-04
05:37 PM
Yes, it is indeed a bug. I made an entry for it. Let me know if this is a great deal for the project, and we will do our best to fix it.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-02-13 06:17 AM
‎2019-02-13
06:17 AM
sznagy wrote:Thank you, and yes it is important as we are creating lots of dimensions and it will be quite a hassle for our users to turn each back on manually.
Yes, it is indeed a bug. I made an entry for it. Let me know if this is a great deal for the project, and we will do our best to fix it.