Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: George on May 10, 2025, 06:55:40 am
-
Hi all,
I think that I found a bug in EA automation when placing ProvidedInterface or RequiredInterface elements in a component diagram via EA automation.
- From testing, I found that the rendered "lollipop" shape of an interface has dimensions 40×13 px, with a 1 px inset into the component.
- When such an interface is positioned on top or bottom of a component (i.e., placed horizontally), everything behaves as expected: the interface is rendered and stored with correct coordinates.
- However, when the same interface is positioned on the left or right side of the component, using the same assumptions (i.e., horizontal orientation, 40×13), EA places the interface element at the requested top-left coordinates, but rotates it vertically.
- The stored coordinates no longer match expectations: the bottom-right corner indicates a vertical object.
- This happens even though EA renders the interface correctly when the diagram is opened.
- If I manually move the component (e.g., drag it slightly), the interface moves with it and the coordinates are then recalculated correctly and updated after save.
Following are fragments of test script that demonstrates this issue.
// Sizes and positions
var COMP_X = 300, COMP_Y = 100, COMP_W = 200, COMP_H = 100; // Component rectangle
var IF_LEN = 40, IF_THICK = 13, IF_OFFSET = 1; // Real size of the i/f lollipop is 40x13 px and 1 px into the component
...
Session.Output("TopInterface expected: l=" + IF_TOP_X + ";t =" + IF_TOP_Y + "; r=" + (IF_TOP_X + IF_THICK) + "; b=" + (IF_TOP_Y + IF_LEN));
Session.Output("TopInterface actual: l=" + diaIfTop.left + "; t=" + diaIfTop.top + "; r=" + diaIfTop.right + "; b=" + diaIfTop.bottom);
...
Session.Output("LeftInterface expected: l=" + IF_LEFT_X + "; t=" + IF_LEFT_Y + "; r=" + (IF_LEFT_X + IF_LEN) + "; b=" + (IF_LEFT_Y + IF_THICK));
Session.Output("LeftInterface actual: l=" + diaIfLeft.left + "; t=" + diaIfLeft.top + "; r=" + diaIfLeft.right + "; b=" + diaIfLeft.bottom);
Logged results:
[653159378] Component position: l=300; t=-100; r=500; b=-200
[653159387] TopInterface expected: l=380;t =61; r=393; b=101
[653159390] TopInterface actual: l=380; t=-61; r=393; b=-101
[653159400] LeftInterface expected: l=261; t=150; r=301; b=163
[653159403] LeftInterface actual: l=261; t=-150; r=274; b=-190
Does anyone have the same experience?
Rgds
Jiri