Skip to content

Instantly share code, notes, and snippets.

@jfdeclercq
jfdeclercq / ExportImage.ajs
Last active January 13, 2023 05:50
Export View as image (PNG) with date and diagram name in filename. #jarchi
//Export View as image (PNG) with date and diagram name in filename.
// Get the first view in the model
//var view = $("view").first();
var view = selection.filter("archimate-diagram-model").first();
// Get the Base64 bytes of the view in PNG format. Can use "PNG", "BMP", "JPG" or "GIF"
// Options are scale (1 - 4) and margin (pixel value)
var bytes = $.model.renderViewAsBase64(view, "JPG", {scale: 1, margin: 20});
var date = new Date();
@jfdeclercq
jfdeclercq / DiagramNote.ajs
Created December 9, 2018 11:53
DiagramNote.ajs #jArchi
//Script to add a note to a view with name of the view, date and your name
//Thank you to J-B Sarrodie
// Get the first view in the current selection
var view = selection.filter("archimate-diagram-model").first();
// Get current date
var currentDate = new Date();
// Create a new note and set its text