Reset Visual Objects to Default

Started by cybye, May 23, 2025, 09:22:58 AM

Previous topic - Next topic

cybye

Hi,

is there any simple way to reset selected visual objects to their default appearance?

Thanks,
Chris

Phil Beauvoir

Hi, it depends what you mean by default. If you mean size and color and so on then you need to set those like this:

function resetToDefaults(object) {
   object.bounds = {width: -1, height: -1};
   object.fillColor = null;
   object.fontColor = null;
   // Set others...
}
If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

cybye

Quote from: Phil Beauvoir on May 23, 2025, 09:47:34 AMHi, it depends what you mean by default. If you mean size and color and so on then you need to set those like this:

function resetToDefaults(object) {
  object.bounds = {width: -1, height: -1};
  object.fillColor = null;
  object.fontColor = null;
  // Set others...
}



Thanks!

As the default appearance I understand the look the objects have when no specific appearance, label, figure or image settings are applied.

A bit of background: we are often mapping existing architecture descriptions - usually in form of visual drawings - to Archimate using Archi. A well working approach is to try to exactly represent the original visual description , what helps with better understanding it and enables easier communication with the stakeholders, who are usually used to work with the original.

This is working well with Archi. Most of the visual properties of the original can be represented, a few not so easily but that's quite ok as this IS actually a translation to another form / language and in most if not all cases differences in the result are caused by the source not being very precise. 

Now, when working on with the Archi view, it would be quite handy to be able to remove all the formatting (selectively) and revert to the "default". I know this can be done by selecting the elemments and drag them from the model into a blank view (or do the same in a script), but there seems no way to do this for an element inside a view. Remove and re-insert would do, I guess, but this is destructive (and changes ID).

Ownership wise, Archi should and does define the "default", not the script. So, resetting in a script can lead to conflicts with what the main app would do (.showIcon = null does not actually ... ).

IMHO this could be solved by either (ignoring the issue,) providing a setDefaults() or allowing access to the defaults.

Phil Beauvoir

Quote from: cybye on May 24, 2025, 10:47:19 AMIMHO this could be solved by either (ignoring the issue,) providing a setDefaults() or allowing access to the defaults.

You can access defaults as set in Archi's preferences, see https://github.com/archimatetool/archi-scripting-plugin/wiki/Accessing-Archi%27s-Preferences

A "setDefaults" function can be created in jArchi itself and customised as per the user's requirements.
If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.