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?
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
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.
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.
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