Skip to content

Instantly share code, notes, and snippets.

View rchevallier's full-sized avatar

rchevallier

  • LECTRA
  • France
  • 23:52 (UTC +02:00)
View GitHub Profile
@jbsarrodie
jbsarrodie / Merge multiple concepts (and delete others).ajs
Last active December 28, 2023 20:08
#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
@jbsarrodie
jbsarrodie / ConvertConcept.lib.js
Last active May 23, 2022 12:44
#jArchi script to change concepts' type (and optionally convert no more valid relationships to association)
function convert(selection, convertToType) {
var relaxed = window.confirm('By default, selected concepts are converted, and relationships involving them that would no more be valid are converted to associations. Click Ok for this behavior or Cancel if you want a "strict" mode where relationships are not changed.');
$(selection).each(function(o) {
$(concept(o)).outRels().each(function(r) {
if (! $.model.isAllowedRelationship(r.type, convertToType, r.target.type)) {
checkAndConvertRelationship(r, relaxed);
}
});
$(concept(o)).inRels().each(function(r) {