Recent posts

#11
General Archi Discussion / Re: How to handle view lifecyc...
Last post by rchevallier - June 11, 2024, 15:05:14 PM
Use branches and versioning included with the collaboration plugin ?
#12
jArchi / Re: collection of nested views
Last post by Mate - June 11, 2024, 02:31:24 AM
 :-[ yep, that is what I meant, Phill. Thank you for helping me learn the correct terminology as well for the code snippet. It works like a charm.
#13
jArchi / Archi view to PowerPoint exper...
Last post by yveszoundi - June 09, 2024, 21:02:34 PM
This is a follow-up of the Humane image scripts thread.

Per previous notes from JB, it is nice to have diagrams in PowerPoint decks that others can finish off to their liking (audience or specific message to convey).

My general struggles
While making diagrams look less technical (via Humane image archi scripts) "works" reasonably well in my environment, there are still challenges. I've noticed that my diagrams mostly get reused by others when they're in PowerPoint format (adding legends, titles or simplifying diagrams helps but has little impact).
  • Creating manually "polished" diagrams in PowerPoint is time-consuming (costs/benefits).
  • Dealing with shape connectors, placement/size of boxes and labels is a chore.

The experiment: How it works
  • With auxiliary scripts from my "Humage image archi scripts library", I generate a "canonical model" in JSON format.
  • I then process the JSON via a small Java application to generate a PowerPoint deck (scale the diagram to fit on the "content placeholder" on a slide).
  • This leverages Apache POI to create the deck and draw shapes/connectors.

The experiment: How it looks
  • Notes
    • The prototype itself is a bit old and uses few constants for font size and other settings, instead of properly extracting it from the archi model.
    • There are sometimes issues with connections or label placement (bendpoints, java vs. native font rendering to size boxes, etc.).
  • Future plans: Improve my humane images script to include a view-to-ppt functionality.



#14
jArchi / Re: collection of nested views
Last post by Phil Beauvoir - June 08, 2024, 10:53:51 AM
Hi, I'm not sure what you mean by "nested views". Do you mean view references (shortcuts)? If so, try using "diagram-model-reference":

selection.find("diagram-model-reference").each(function(v) {
    console.log(v);     
});
#15
jArchi / collection of nested views
Last post by Mate - June 07, 2024, 19:50:03 PM
I have a top-level view with a bunch of nested views within it. How do I get the collection of nested views?

var selected = $(selection);
selected.find("view").each(function(v) {
      debug ? console.log("found: " + v.name):true;      
   });

when selection is a view, this does not list the nested views. I also tried:
selected.find("archimate-diagram-model")
with no luck  :(

I am likely doing something basic incorrectly. Any pointers are much appreciated. Thanks in advance.
#16
Hi, and welcome to Archi and ArchiMate!

Things can get a bit quiet here in the Archi forum, so please be patient if you don't get an answer right away. As this forum is focussed on the Archi tool, rather than ArchiMate the language, you could also try engaging with the ArchiMate Community Discussion Board.

Phil
#17
General Archi Discussion / Re: Merge Relationships
Last post by Phil Beauvoir - June 07, 2024, 11:54:35 AM
Yes, jArchi is able to merge relationships. For reference - https://github.com/archimatetool/archi-scripting-plugin/wiki/Relationships#merge_relation
#18
jArchi / Re: Archi Elements and Relatio...
Last post by Phil Beauvoir - June 07, 2024, 11:52:43 AM
Thanks for sharing!
#19
jArchi / Re: Collaboration Properties
Last post by Phil Beauvoir - June 07, 2024, 11:43:35 AM
Hi,

jArchi is not linked to other Archi plug-ins such as coArchi and so there is no API that exposes coArchi's methods. However, you could either add the JGit library that coArchi uses (https://www.eclipse.org/jgit/) to the class path and use that or read the contents of the "<repo_path>/.git/HEAD" file to access the current branch.

Here's some example code:

var imports = new JavaImporter(org.eclipse.jgit.api, java.io, java.nio.file);
with(imports) {
    // Path to the git repository (on Windows)
    const repoPath = new File("C:/Users/user-name/Documents/Archi/model-repository/repo");

    // Method #1 - using JGit to access the repository

    // Path to the lib folder containing JGit jar files (on Windows)
    const libPath =  new File("C:/Users/user-name/AppData/Roaming/Archi/dropins/org.archicontribs.modelrepository_0.9.2.202311181027/lib");
   
    // Add JGit jars to the class path
    libPath.listFiles().forEach(jarFile => {
        Java.addToClasspath(jarFile);
    });

    // Open the repository using JGit
    const git = Git.open(repoPath);

    // Print the current branch
    console.log(git.repository.branch);
   
    // Close the JGit repository
    git.close();

    // Method #2 - read the "HEAD" file in the .git folder of the repo

    const path = new File(repoPath, ".git/HEAD").toPath();
    const branch = Files.readString(path);
    console.log(branch.trim().split('/')[2]);
}

If all you want to do is get the name of the current branch, the second method is far simpler. Note that access to JGit and calling its methods is done at your own peril, and the jar file paths will be different for each coArchi version.
#20
jArchi / Collaboration Properties
Last post by blakesha - June 07, 2024, 01:56:56 AM
Hi Team

Is there any way to get at the collaboration properties of the model from script. Specifically, the current branch details?