Is there a way to "automate" the selection and hiding of some collumns on the the (mass visualization) "view"? (and in general, to "automate user actions" on Capella ?)

Hello,
I discovered recently about Mass editing and mass Visualization, it is very useful to get csv files.
But my understanding, is that you need to recreate the mass visualization view setting that you need, for each project and anytime you close and re open Capella. (Problem mentionned by @Thierry_Poupon here in the second comment : Are there any plugins to export all the informations related to my capella project into an Excel type file? - Add-ons - Eclipse Capella Forum (mbse-capella.org) ), then you can click and choose “export to csv”.

I would like to know if :

  1. It is possible to automate actions inside Capella (while it is running) to obtain the proper mass visualization view you need. Meaning : You can change the User Interface with some sort of automation…

  2. If you can’t, then is it possible to create a “preset-template” mass visualization view? Which you can open anytime you need.

  3. Finally, would it be possible to obtain a csv file containing a certain type of collumns you need, maybe without having to open mass visualization manually?

Also, is it possible to automate which “elements” are added to the mass visualization?

Thank you!
Best regards,
Be KA

Hi Beka,
Right now it is not possible to automate these kinds of actions on the Mass View.
You may want to have a look at groovy for Capella here: Is there a way to automate operations in Capella by using scripts?
Stephane

1 Like

Hi Stephane,
Thanks but the links availbale inside that post are no longer available.
I tried to search for “Groovy for Capella” and i could not find a thing. (And certainly not the example)
I found Groovy for “Eclipse” though, found this : GitHub - groovy/groovy-eclipse: Eclipse Groovy Development Tools

Hi Beka,
Maybe @FDorner can help with this.
Stephane

1 Like

Beka, If you’re using Capella 1.4.x try installing capella-groovy from https://download.eclipse.org/capella/addons/capella-tools/updates/nightly/felix-v1.4.x/1.4.1.202010301040/

Here are some examples:

It is also possible to select elements, maybe even hack a way to remove columns from the mass viz view, but it would certainly be a hack. Groovy is more useful to execute certain ‘bulk’ actions, like running a spelling tool over all descriptions and alike.

1 Like

Hello Félix,

I’m trying to use Groovy with my Capella version (1.4.0). After the installation, I can open example files et I can create new files, but I can’t make one of them work on my model. Maybe the solution to my problem is very simple and I tried something very complicated, but as example I have :

  • If I want to change an Operational Actor’s Property value, I can cutomize the script PropertyValues.groovy, but I can’t make it work on my model

  • Export in an excel file (xlsx, csv etc) some data from my model based on csv_grab.groovy file

I thought that it would be possible to run the script by clicking on the “Execute” button as shown below, but it seems to be something else. So I tried some others solutions, but I can’t make the script work.

image

Thank you in advance for your answer.

Best regards,
Christian KOUMLAH

Sorry, I forgot to answer.
IIRC, you have to enable the Development/Debug capability in the preferences:

Then you can click the small triangle next to the green run button, and select “Run Configurations…”
image

There should then be a Groovy for Capella category, where you select the script file, set arguments etc and finally run the script.

Hello Felix,

did you had a chance to look if you could get groovy4capella get running with Capella 5.x.x?

kind regards

I am looking at it now

@haage first build groovy capella for 5.0/5.1 is here: https://download.eclipse.org/capella/addons/capella-tools/updates/nightly/felix-v5.0.x/5.0.0.202106110807/
This now uses groovy 3, the example works. Tell me if you need assistance.

Hello Felix,

It works very well. Thanks a lot.
I come up with some new requests.

  1. Do you have a kind of cheatsheet to help learning Groovy ?

  2. I’m looking for a way to make an import/export of excel files
    For data exportation, I can write a script based on the 3 groovy scripts given as example. But for importation, I don’t know what are the concerned libraries.

Best regards

When I need it I have the book “Programming Groovy 2”, but “Groovy in Action” seems to be good as well.

For Excel, you could install the Capella M2Doc addon first. This includes the required libraries for excel (org.apache.poi) and you could just add them to your script project’s plugin dependencies. Alternatively, you could @grab apache poi from your script (https://mvnrepository.com/artifact/org.apache.poi/poi), like in the csvgrab example.

POI is a beast of its own, but maybe you can get along with the documentation here: https://poi.apache.org/components/spreadsheet/quick-guide.html

Maybe you could get something started and create a pull request for the capella-tools repo, so we could include an excel example for others.

Hello Felix,

I tried to get it running with a clean Capella-5.0.0 installation but I am getting a Java Exception Error - any hint / idea?

Exception in thread “main” java.lang.NoClassDefFoundError: org/polarsys/capella/core/model/helpers/registry/CapellaPackageRegistry
at org.polarsys.capella.groovy.CapellaQueryMethods.install(CapellaQueryMethods.groovy:46)
at org.polarsys.capella.groovy.CapellaQueryMethods.(CapellaQueryMethods.groovy:38)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:263)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:268)
at org.polarsys.capella.groovy.CapellaScriptBase.(CapellaScriptBase.groovy:42)
Caused by: java.lang.ClassNotFoundException: org.polarsys.capella.core.model.helpers.registry.CapellaPackageRegistry
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
… 13 more

got it - used the “Groovy-Script” instead of the “Groovy for Capella” run configuration…
my fault…
:man_facepalming:

Copyright © Eclipse Capella, the Eclipse Capella logo, Eclipse and the Eclipse logo are Trademarks of The Eclipse Foundation.