Archi Forum

Archi Plug-ins => jArchi => Topic started by: rheward on September 19, 2019, 08:44:47 AM

Title: Getting the View from a View Reference in jArchi
Post by: rheward on September 19, 2019, 08:44:47 AM
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?
Title: Re: Getting the View from a View Reference in jArchi
Post by: Phil Beauvoir on September 19, 2019, 08:51:18 AM
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.
Title: Re: Getting the View from a View Reference in jArchi
Post by: rheward on September 19, 2019, 09:30:47 AM

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
}
});
Title: Re: Getting the View from a View Reference in jArchi
Post by: Phil Beauvoir on September 19, 2019, 09:51:13 AM
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
Title: Re: Getting the View from a View Reference in jArchi
Post by: rheward on September 19, 2019, 09:55:02 AM
Will do. :)
Cheers.