Archi Forum

Discussion Boards => jArchi => Topic started by: casacde on July 01, 2019, 06:50:27 AM

Title: jArchi script to set properties?
Post by: casacde on July 01, 2019, 06:50:27 AM
I take my first steps with jArchi and wondered if there is an approach or a finished script that allows me to set the properties of several (or all) elements in my model? Can someone give me an indication of how I come to a solution? Many Thanks!
Title: Re: jArchi script to set properties?
Post by: Phil Beauvoir on July 01, 2019, 09:16:30 AM
The general approach with jArchi is to use the various selectors that return a collection of objects and then set or read the properties on those.

For example to set a property on all elements in a model:

$("element").prop("key", "value");

You could also filter the collection further to select only certain types of elements, or those that meet a certain condition.

More examples - https://gist.github.com/search?utf8=%E2%9C%93&q=%23jarchi+extension%3Aajs&ref=searchresults

Reference - https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Collection