Scripting Views

Started by bigyin, April 15, 2020, 10:38:11 AM

Previous topic - Next topic

bigyin

Would be grateful for a few pointers:
Scripting the creation of service model that links to a selected capability, and generating a) a view for each service and b) an updated Service model showing all that link to the capability.

Questions
- I want to use Grouping around some concepts - cant seem to find the correct JArch commands
- As I can be sure how many services etc, doing a fixed layout is difficult, is there any JArchi Commands to do auto layout (beautify etc)

Any other pointers in this direction gratefully received, as I am learning better by example

Phil Beauvoir

By "grouping" do you mean adding concepts to folders? If so, see https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Object#add

Or do you mean creating a visual Group in a View? See https://github.com/archimatetool/archi-scripting-plugin/wiki/jArchi-Object#createobject

There are no commands in core jArchi for auto-layout. Perhaps someone else has written a script for this? If not, then it would be possible for someone to write one (not my speciality, I'm afraid).
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

bigyin

Not folders, (have that based on your previous help) but the grouping (grey box) for readability..

Phil Beauvoir

If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

bigyin

Sorry to be a pain.

I am able to create the group as shown, what I ant to do is include series of elements e.g grouping all business services in a Group, or all the application services etc. While I can paint one on top of the other it does not mean they are included within, hence move with it, as would be the case when i do it manually.

Trying to block bits of the view (dynamically)

Phil Beauvoir

You have to add the concept to the group. For example:


// Select first view
var view = selection.first();
// Create and add a group
var group = view.createObject("group", 10, 200, -1, -1);
// Create a Business Actor concept and add to model
var actor = model.createElement("business-actor", "Oscar");
// Add this to the Group
group.add(actor, 10, 10, -1, -1);
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Phil Beauvoir

If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

bigyin

Thanks. One Step at a time ...

Jean-Baptiste Sarrodie

Hi,

For layout, you can leverage existing JavaScript libraries like dagre.

You can also look at Herve's script which uses dagre and other libraries: https://forum.archimatetool.com/index.php?topic=639.msg3563

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate