Creating sketch and canvas views

Started by ChampagnePerry, June 21, 2023, 14:19:32 PM

Previous topic - Next topic

ChampagnePerry

As a bit of background I have a script that replicates all or part of a model into another model (not perfect yet but works quite well even replicating the views).
To see if I can detect changes and propagate them to the parent model I do this with a JSON representation of the model or model elements.
However recreating the canvas and sketch views isn't working the way I expect.
I use <<canvas-model>>.createObject("canvas-model-block",1,1,-1,-1,true) on the canvas-model view and it just throws an error saying "Unsupported type".
I notice creating these things in code isn't mentioned anywhere that I can find on the Wiki so am I doing something obviously wrong, is it not supported, have I got the syntax wrong?
Has anyone been daft enough to try this before?
Any help appreciated.

Here is a snippet of the code:
// if there is a refView then it is a view reference
if (oSource.refView!=null){
console.log("Adding a view reference to ",thisTarget.name," for ",thisConcept);
//console.log("name :",thisConcept.name," type:",thisConcept.type," id :",thisConcept.id);
newElement = thisTarget.createViewReference(thisConcept,newBounds.x,newBounds.y,newBounds.width,newBounds.height);
// if there is no concept it is a non archimate element
} else if (thisConcept==null){
newElement=thisView.createObject(oSource.type,newBounds.x,newBounds.y,newBounds.width,newBounds.height,true);
// all other cases where a concept exists should be archimate elements
} else if (thisConcept!=null){
newElement=thisTarget.add(thisConcept,newBounds.x,newBounds.y,newBounds.width,newBounds.height);
}

Phil Beauvoir

Hi, Canvas and Sketch objects haven't yet been implemented in jArchi. Lots of things on the backlog....jArchi, coArchi, coArchi 2, Profiles, Table Views, maintenance....etc....(too much for one person)

Phil
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

ChampagnePerry

OK understood, thanks Phil - I realise you're very busy.
I will just exclude the contents of the sketch and canvas views - thanks