cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 

API_DrawingType::anchorPoint is ignored by ACAPI_Element_Create and ACAPI_Element_Change

API_DrawingType::anchorPoint is documented as "Placement reference by bounding box node (relevant only if not useOwnOrigoAsAnchor)" — nothing suggests it's output-only. However, I cannot find a way to actually set it through the API.

Repro (minimal):

  1. Create a Drawing linked to a navigator item via ACAPI_Element_Create, explicitly setting element.drawing.anchorPoint = APIAnc_RT (or any value other than APIAnc_LB) before the call.
  2. Read the element back with ACAPI_Element_Get.

Observed: anchorPoint always comes back as APIAnc_LB, and pos always equals bounds.xMin/yMin (the bottom-left corner), regardless of what was requested at creation.

Also tried: calling ACAPI_Element_Change on an already-placed Drawing with the anchorPoint mask bit set, to any of the 9 values. Same result every time.

Ruled out as a factor: whether the Drawing has a custom clip frame (isCutWithFrame = true, clip polygon in absolute layout coordinates) or not (isCutWithFrame = false, auto-fit extent) — identical behavior in both cases, tested explicitly.

Interesting data point: a Drawing placed interactively through the UI (Drawing Settings dialog, 3×3 anchor grid) correctly stores and reports a non-APIAnc_LB anchor (e.g. Center) when read with ACAPI_Element_Get — so the field is genuinely meaningful and persisted when set by the UI. It's specifically ACAPI_Element_Create/ACAPI_Element_Change that force it back to APIAnc_LB. Worse: calling ACAPI_Element_Change on such a UI-placed Drawing — even for an unrelated field — also resets its UI-set anchor to APIAnc_LB, and it cannot be restored to its original value through the API either.

Side finding, in case it's related: bounds is cached and does not reflect a pos change until ACAPI_Drawing_Update_Drawings is called — and even then, only across a separate command/API round-trip; calling Update+Get+Change within the same function call (same synchronous execution) doesn't see the updated bounds.

Questions:

  1. Is anchorPoint actually settable via the API at all for a view-linked Drawing, or is it silently read-only despite the doc wording?
  2. If it's not settable, is there another API (or Change mask combination) to reposition a Drawing by a bounding-box corner/center other than bottom-left, short of manually computing bounds via Update+Get and shifting pos (and poly/clip coordinates, which are stored in absolute coordinates and need a matching shift)?
  3. Is forcing a UI-set anchorPoint to APIAnc_LB via an unrelated ACAPI_Element_Change call (e.g. changing only ratio) expected/by design, and is there any way to avoid that side effect?

     

    Operating system used: Mac Apple Silicon

Archicad 27 - GDL - PYTHON
0 Replies 0

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!

Video Thumbnail