Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ian Mitchell on May 07, 2022, 12:24:03 am

Title: Reset diagram object back to default backgroundColor
Post by: Ian Mitchell on May 07, 2022, 12:24:03 am
When I read the 'backgroundColor' of a diagramObject, it comes back as '-1', which means 'default color' for this element type, as defined by it's MDG. Which is my case is Archimate, and as the element is a ApplicationComponent, it's pale blue in my diagram. All good, exactly as in the documentation.

Now I change the color to a different one, but I'm not totally stupid, and I remember what the original color was : '-1'.

Later, I want to change the back to what is was originally: so I set the backgroundColor to -1, and....it goes white. Not the 'default color'.
The database confirms this: BCol=13882323, which is white. Same is true for the border and font colors - all set to white.

But I have a plan - set these colors to 'nothing' via the API. Doesn't work - that just makes them black.

But I get out my big stick, and edit those the entries in t_DiagramObject.ObjectStyle, and delete BCol=.. then all is well. Back to having the default color.

Anyone else seen this feature? Or did I miss something ?

Another hour of my life I'd like to claim back from Sparx.
Title: Re: Reset diagram object back to default backgroundColor
Post by: Geert Bellekens on May 07, 2022, 12:31:22 am
According to the documentation, setting it back to -1 should work: https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html)

Quote
BackgroundColor

Long

Notes: The background color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

So if that doesn't work it's officially a bug.

Geert
Title: Re: Reset diagram object back to default backgroundColor
Post by: Paolo F Cantoni on May 07, 2022, 09:48:50 am
According to the documentation, setting it back to -1 should work: https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html (https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/diagramobjects.html)

Quote
BackgroundColor

Long

Notes: The background color of the object on the diagram.

Set to -1 to re-set to the default color in the model.

So if that doesn't work it's officially a bug.

Geert
+1


Paolo
Title: Re: Reset diagram object back to default backgroundColor
Post by: Ian Mitchell on May 09, 2022, 05:21:24 pm
Further strangeness - now between v15.1 and v16 (32bit).
Something major has changed with the refreshing of diagrams. My addin removes and adds-back diagram obejcts in a diagram, an relies on the Repository.reloadDiagram call to get a new-look diagram.
Except that with V16, nothing happens. I will post later when I have time to isolate the problem ,but a simple switch back to V15 fixed the issue.
Any one else seen issues with reloading diagrams ?
Title: Re: Reset diagram object back to default backgroundColor
Post by: Ian Mitchell on May 09, 2022, 06:28:18 pm
I'm also getting a lot of 'Your need to reaload diagram' messages coming up in the UI, when changing the diagram. These don't happen in V15.2, but pop up quite frequently in V16. Distracting for the user.
Title: Re: Reset diagram object back to default backgroundColor
Post by: steverumsby on June 02, 2022, 01:08:18 am
Yes, I'm getting the same thing. I have a script to add a heatmap to an archimate diagram and I'd like another to restore the default colouring, but that just turns everything white as you say. But setting the background colour to "default" via the layout ribbon does what it is supposed to. That at least saves a certain amount of pain...

Did you find a solution to this, or is it a bug we need to report?

Thanks,
Steve.
Title: Re: Reset diagram object back to default backgroundColor
Post by: Matt on July 14, 2022, 09:31:21 pm
I am also experimenting with the Archimate functionality in EA v16 (64 bit) and I am also seeing the white background for -1 instead of the expected colour.
In my case, I am doing some experimentation with 'capabilities'.  Their default colour is orange.
I wanted to dynamically colour them through scripts, which is fine...
When I wanted to reset them, using -1, they show up as white.
I could modify the script to explicitly set them to orange, but then I would need to do that based on each stereotype, which becomes a pain, quickly...

Sounding a bit like a bug...