Skip to content

Instantly share code, notes, and snippets.

@pmduque
pmduque / Import APQC PCF.ajs
Created August 19, 2022 11:41
Import APQC PCF files into Architool. #jArchi
// Author: Pedro Duque
// Requires: jArchi - https://www.archimatetool.com/plugins/#jArchi
// Requires: PapaParse – https://www.papaparse.com/
// Purpose: Import APQC PCF excel sheet into ArchiTool
// Date: 2022-08-19
// (credits: some code from https://gist.github.com/christhearchitect/34cde79ef73e5ee45deaaf55b1509ee1 used to import from CSV )
// Version 0.1
// Change: Initial version
/*
@smileham
smileham / HeatMapByPropertyvalue.ajs
Last active January 19, 2026 14:10
jArchi script to create Heatmap (set Red, Amber or Green background to element) based on the value of a given property. #jarchi
/*
* Smart HeatMap (Numeric Gradient + Discrete)
* * Version: 8.1
* * "VIBE CODED" with Gemini - it was quick, did it better than I could in the time I had, and seems to work...
* * Changes:
* - Added Multi-selection dialog for Scope (Components vs Relationships).
* - Detects if a property is Numeric.
* - If Numeric: Allows Min/Max color selection and generates a Gradient Heatmap.
* - If Text (Discrete): Uses standard specific value coloring (limited to 10 unique values).
* - Generates stepped legends for Gradients.
/**
*
* jArchi Library to manage Archi visual relationships in views
*
* Author: Xavier Mayeur
* Version: 1.1
* Date: May 2022
*
*
* Remarks: the code has been written to work with GraalVM, not Nashorn framework.
@markbacker
markbacker / createProjectmodel.ajs
Created March 27, 2022 08:39
#jArchi Create a project model of a reference model
/**
* Create a project model of a reference model
* save a copy of the reference model and keep only the for the project relevant objects
*
* Use case
* Use part of a reference model as a start for a project model and keep that part in sync.
* The project reuses the shared concepts of the reference model and can freely extend with project details and scenario's.
*
* How to use this script
* - Create the project model file
/*
* 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)
/*
* 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");
/*
* Information flows between applications
*
* This script is under construction!
*
* This script provides a list of information flows between application components.
* It is based strictly on the relationships found in the model and is therefore
* independent of views. In case more attributes for the flows are needed, they can be
* added easily (IntegrationPlatform is provided as an example).
*
@realFranco
realFranco / naive_graph_traversing.ajs
Created November 27, 2021 15:57
Traverse into one element to another #jArchi
// Naive Graph Traversing.
console.log("edit a property from a relation");
$("#id-733e2449d19b455db12241633b28cdab").prop("top_bottom", 0);
$("#id-733e2449d19b455db12241633b28cdab").prop("bottom_top", 0);
console.log("every input relation from the current element");
$(ID).inRels().each(function(relation) {
if (relation.name){
console.log(relation);