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 :
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…
If you can’t, then is it possible to create a “preset-template” mass visualization view? Which you can open anytime you need.
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?
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?
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
Maybe @FDorner can help with this.
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/184.108.40.206010301040/
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.
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.
Thank you in advance for your answer.
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…”
There should then be a Groovy for Capella category, where you select the script file, set arguments etc and finally run the script.
did you had a chance to look if you could get groovy4capella get running with Capella 5.x.x?
@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/220.127.116.11106110807/
This now uses groovy 3, the example works. Tell me if you need assistance.
It works very well. Thanks a lot.
I come up with some new requests.
Do you have a kind of cheatsheet to help learning Groovy ?
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.
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.
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 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Caused by: java.lang.ClassNotFoundException: org.polarsys.capella.core.model.helpers.registry.CapellaPackageRegistry
… 13 more
got it - used the “Groovy-Script” instead of the “Groovy for Capella” run configuration…