Skip to content

Instantly share code, notes, and snippets.

@yveszoundi
yveszoundi / AlignSpread.ajs
Created May 10, 2024 12:01
#jArchi script to align and spread components
// Author: Yves Zoundi
// Requires: jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
// Purpose: Align to lowest, spread the selected elements horizontally or vertically
// Date: 2024-05-10
// Version 0.0.1
// Change: Initial version based on similar previous jArchi scripts on GitHub
console.clear()
console.show()
console.log("START: AlignSpread")
@smileham
smileham / HeatMapByPropertyvalue.ajs
Last active May 14, 2024 20:37
jArchi script to create Heatmap (set Red, Amber or Green background to element) based on the value of a given property. #jarchi
/*
* HeatMap by Property Value
*
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
*
* Version 1: Set colour to red, amber or green based on value of given property.
* Version 2: Pull out all Properties used in Elements in view, present all possible values of that Property to assign RAG colours
* Version 3: Error handling and key generation
* Version 4: Updated for dynamic colour selection and support for more than 3 colours
* Version 5: If there are less than 5 values, buttons are used instead of the menu.
/*
* This script attemps to import a draw.io (aka diagrams.net) diagram into an Archi model by
* empirically mapping the observable attributes of the XML elements exported from draw.io to Archimate
* elements and relationships. Please note that this mapping is fragile, because draw.io doesn't seem
* to generate the XML attributes in a very consistent way; also, we must unfortunately use element color
* as a key differentiator, to compensate for the lack of usable archimate information in the XML file.
* All of this means that minor changes in the draw.io XML format can break the mapping...
* Notes:
* -- To generate the draw.io file, export it as an *uncompressed* XML file.
* -- When running the script, make sure you have set the current model to import it in (e.g. by selecting a view in the model)
/*
* Distribute the selected (visual) elements horizontally, vertically, or both (based on response to prompt)
* Notes:
* - the center point of each element is taken as reference for the distribution
* - the overall visual order (left-to-right and top-to-bottom) of the elements is not modified
* - if a non-visual element is part of the selection, the script will crash :-(
* Author: christhearchitect, 2022
* Version: 0.1
*/
/*
* This script reads a CSV file with the following columns: Relationship type, Relationship name, Source Element name, Source Element type", Target Element name, Target Element type, {<property-name>}. Each row represents one element along with its main attributes,
* and is loaded into the current model according to these rules:
* -- if the relationship (defined by the Name/Type pair) exists in the current model, its properties are updated (subject to "overwriteAttributes" and "blankMeansDontChange" below)
* -- if not, a new relationship is created (along with its properties)
* -- the Type field is mandatory, but Name and properties can be empty
* -- if a relationship in the CSV matches several existing relationship, it is ignored
* -- the script does not create any views or visual diagram objects for the imported elements; therefore, it cannot load any visual attributes, such as style or label
*
* Author: christhearchitect
/*
* This script reads a CSV file with the following columns: Name, Type, Documentation, {<property-name>}. Each row represents one element along with its main attributes,
* and is loaded into the current model according to these rules:
* -- if the element (defined by the Name/Type pair) exists in the current model, its Documentation and properties are updated (subject to "overwriteAttributes" and "blankMeansDontChange" below)
* -- if not, a new element is created (along with its Documentation and properties)
* -- the Name field is mandatory, but Type and Documentation can be empty
* -- the script does not create any views or visual diagram objects for the imported elements; therefore, it cannot load any visual attributes, such as style or label""
*
* Author: christhearchitect
* Version: 0.2
/*
* Logs all Archi objects in the current selection to the console, in tree format.
* For each object, we list its type and name (which may be empty), plus all of its properties, if any (prefixed by "+").
* Author: christhearchitect, 2022
* Version: 0.2
*/
console.clear();
console.log("ListAllObjectsInSelection\n-------------------------\n");
@nfigay
nfigay / ExportToOWL.ajs
Last active May 14, 2024 20:30
This #jArchi script export the content of a selected model as an OWL2 file.
/*
* ArchiMate Model export as OWL2 file
* Author: Nicolas Figay 2021
* Version: 0.1
* This script creates a vis.js graph
*/
console.log("Export to Ontology Web Language");
load(__DIR__ + "lib/archimate.js");
@timolaine
timolaine / Insert Labels of Related Elements.ajs
Last active May 14, 2024 20:34
Insert Labels of Related Elements in Archi
@jbsarrodie
jbsarrodie / Merge multiple concepts (and delete others).ajs
Last active May 14, 2024 20:34
#jArchi script to merge multiple concepts (and delete others)
// Merge multiple concepts (and delete others)
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script merges multiple concepts (and delete others)
//
// Version 1.1 (2020/01/20) Add an option to keep only the content of the "target" concept
// Version 1.0 (2019/11/12) First version published
//
// Known limitation: works only on elements, not relationships