Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Change Concept Type
* Requires jArchi -
* Updated from original to prompt for types
* Version 1: First release
* Version 2: Error handling
function convertType() {;
console.log("> Change Concepts");
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!="") { = + suffix;
else {
console.error("> Change Concepts: Concepts not changed");
console.error("> Change Concepts:" + e);
console.log("> Change Concepts: Done");
Copy link

alef1986 commented Mar 28, 2020

Thanks a lot for this script!
A question: I've just tried to use it to convert relationship types in a view. Didn't work :( It seems formally the script supports elements, not concepts? Or am I doing it wrong, using wrong naming of relationships? (i.e. "InfluenceRelationship", "RealizationRelationship" - clearly without bracets)

// Edit>
Yes, I did use wrong names! It's "influence-relationship", "realization-relationship". Thanks again, cool thing!

Copy link

smileham commented Mar 28, 2020

Hey alef1986

To be honest, I never even thought about trying the script on relationships! Glad it worked though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment