Weight of Archimate Elements

Started by Gemini, October 22, 2024, 19:43:04 PM

Previous topic - Next topic

Gemini

Hello,
How can I change the weight of outer edge lines of an Archimate element? i.e. to make it more thin or thick.

Xiaoqi

Hi Gemini,

When you select the element, switch to "Appearance", you can adjust "Line Width" from default Normal to Medium or Heavy.

I suspect you don't see the right column of the settings before you drag and enlarge the Porperties window.

Regards, Xiaoqi

Xiaoqi

Hi Gemini,

Hope those "Normal, Medium, Heavy" are enough for your needs, just as experiment, if you familiar your model, you can explore the ".archimate" file from any code editor and find as attached image shows, the Line Width is actually set as "lineWidth" attribute for the element -- Default is Normal (I think = 1), Medium = 2 and Heavy = 3.

The "default" attribute is not visible, while, I tested to change that Heavy one from "3" to "10", then you can see (after save your model file and open it in Archi) the effect can be beyond the three drop down list choice from another screenshot.

With that you can have more room to customize your elements' edge width. - but please be careful as if you wrongly changed some tags, your model file will be destroyed, so only play this way once you familiar the model structure and also make sure you edit the correct element (base on ID).

Just for your interests, I've recorded short video before explaining the Archi model structure: 1) https://youtu.be/klrG1XouRfY, and 2) https://youtu.be/NmBGhDpWcTg, feel free to check to support your action.

Hi Phil and JB, I think it would be also possible to use script to change those Attributes, right?

I tried this way: $(selection).attr(lineWidth,"3"); but not work, how to point to the specific attribute? Thanks.

Xiaoqi

Good luck,
Xiaoqi

Xiaoqi

Hi Phil and JB,

I found my mistake, for using script, it should double quote the attribute name, not the value, using below way:

$(selection).attr("lineWidth",3);

it is working for change selected elements' Line Width to target value (this sample is to Heavy).

Hi Gemini,

If you have jArchi enabled, you can play around this way (also valid for any other attributes) preventing edit source code directly. Enjoy.

Xiaoqi

Phil Beauvoir

#4
Hi Xiaoqi,

thanks for your comments here.

Changing line width in jArchi is documented here - https://github.com/archimatetool/archi-scripting-plugin/wiki/Visual-Objects#linewidth

Just one thing - I wouldn't recommend setting the line width in the .archimate file directly beyond or below the values 1-3. This may cause layout problems when rendering the figures as the code doesn't do any bounds checking here.

Phil
If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Xiaoqi

Thanks Phil for the link on using jArchi for setting .lineWidth, yes, fully agree that we'd better to adjust setting through those property/attribute interface, instead of model file directly.

Xiaoqi

Hi Phil,

I've compared below two methods:

   $(selection).attr("lineWidth",3); // working

   $(selection).lineWidth = 3; // not working

The one you point in wiki (2nd one) is not get expected change in my Archi, I can only use the first way. I just use "$(selection)" to test the element I'm click to activate.

Xiaoqi

Phil Beauvoir

Hi Xiaoqi,

"attr" is a function of a collection, so it works on "selection". "lineWidth" is a function of an object so you need to get the object(s) from the selection. For example:

const selected = selection.first();
selected.lineWidth = 3;
If you value and use Archi, please consider making a donation.
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

Xiaoqi

Thanks for clarify, I mix these two, yes, now both are working.

romuald

My 2 €

// This script increases the line width size of the selected element
// Requires jArchi - https://www.archimatetool.com

try{
console.log("lineWidth increasing");
$(selection).each(function(selectedElement) {
  selectedElement.lineWidth += 1;
} );
}catch {
  console.log("No element selected.");
}
console.log("finished");

You can do this also for decreasing.
Oh, and change lineWidth by fontSize and you have two pretty scripts for changing rapidly font ize of selected elements.

Xiaoqi

Hi Romuald,

I like this, looks pretty and can be used in many settings with minor adjustment.

Thanks,
Xiaoqi

Gemini