Last active
July 31, 2023 14:13
-
-
Save smileham/a989e42e8db2d811f5f1427147b39e2e to your computer and use it in GitHub Desktop.
#jarchi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Change Concept Type | |
* | |
* Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/ | |
* | |
* Updated from original to prompt for types | |
* | |
* Version 1: First release | |
* Version 2: Error handling | |
* | |
*/ | |
function convertType() { | |
console.show(); | |
console.clear(); | |
console.log("> Change Concepts"); | |
try{ | |
defaultType = $(selection).first().type; | |
var concept1 = window.prompt("Convert From Concept Type", defaultType ); | |
if (!concept1) {console.log("> Change Concepts: Cancelled"); return;} | |
var concept2 = window.prompt("Convert To Concept Type", defaultType ); | |
if (!concept2) {console.log("> Change Concepts: Cancelled"); return;} | |
var suffix = window.prompt("Include Suffix", "" ); | |
if (suffix==null) {console.log("> Change Concepts: Cancelled"); return;} | |
if (concept1!=concept2 || suffix!="") { | |
$(selection).filter(concept1).each(function(e) { | |
e.concept.type = concept2; | |
e.fillColor = null; | |
if (suffix!="") { | |
e.concept.name = e.concept.name + suffix; | |
} | |
}); | |
} | |
else { | |
console.error("> Change Concepts: Concepts not changed"); | |
} | |
} | |
catch(e) | |
{ | |
console.error("> Change Concepts:" + e); | |
} | |
console.log("> Change Concepts: Done"); | |
} | |
convertType(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey alef1986
To be honest, I never even thought about trying the script on relationships! Glad it worked though.