Getting the View from a View Reference in jArchi

Started by rheward, September 19, 2019, 08:44:47 AM

Previous topic - Next topic

rheward

I have a script that finds a number of View Reference items on a diagram. I'd like to render (renderViewAsBase64) the actual views they reference? How do I get those views in content?

Phil Beauvoir

#1
Can you provide a snippet of JS where you are getting the View reference items?

Edit: I don't think that the referenced view is exposed in the jArchi API.
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rheward


This is a snippet that finds the View References (linked views) inside a Grouping object.


// find the views this grouping composes
$(grouping).children().each(function(linkedView) {
if ((linkedView) && (linkedView.type == 'archimate-diagram-model' )) {
console.log ("View: ", linkedView.name, " > ", thisView.id); // this gives me the name and id of the View Reference, not the view itself.
var bytes = $.model.renderViewAsBase64(linkedView, "PNG"); // this therefore fails
// etc
}
});

Phil Beauvoir

Looks like the referenced View is not exposed in the jArchi API. As I'm lazy could you open a feature request? https://github.com/archimatetool/archi-scripting-plugin/issues
If you value and use Archi, please consider making a donation!
Ask your ArchiMate related questions to the ArchiMate Community's Discussion Board.

rheward