Exporting Diagrams from OA and SA

Hello,
I am using capella 5.0 and try to figure out how to work with M2DOC.
I am able to extract all the descriptions from the Modellelements in the different Packages (Operational Analysis, System Analysis etc.) So far so good.
Now I want also to export my diagrams.
I started with [OCB] with:
{m:for ocb | self.eAllContents(oa::OperationalCapabilityPkg)}
{m:if cob.isRepresentationDescriptionName(‘Operational Capabilities Blank’)}
{m:ocb.asImageByRepresentationDescriptionName(‘Operational Capabilities Blank‘)}->first().setWidth(600)}
{m:endif}
{m:endfor}

This works also fine
But when I now try to extract the Operational Architecture Blank on a similar way (using the EntityPkg), then I do not get any Image to my Wordfile. There are also no errors, it simple proceed the script, but does not extract the related image.

Similar on System Analysis or Logical Architecture. Some diagrams will be extracted, some not. But here it seems that only those diagrams will be extracted, that were not created by cloning diagrams.

any advices, or is there a different way to extract diagrams?
I am trying it a few days and it is very hard for me to understand the reference documentation on M2DOC.
I have some experiences in Word/Excel VBA and Javascript, so I am not a newbie on Wordscripts, but I am absolutely lost with AQL and M2DOC.

Thanks for helping and best regards
Carsten

You can use the interpreter views to have content assist and a visualization of the result of your AQL queries:

I will use the self variable in the following queries but if you ate using the M2Doc interpreter view you will probably need to use the selection variable. Also note that the Sirius interpreter view doesn’t provide specific M2Doc services like the one you are trying to use here.
To use the asImageByRepresentationDescriptionName() service you need to know the name of the description for a diagram and also the kind of element the diagram use as root element. To find those information, you can select the background of the diagram and use the following queries:

self.description.name
self.target.eClass()

And with the first query you will see that unfortunately the name displayed by Capella and the name of the diagram description is not the same. You should use:

'Operational Entity Blank'

A cloned diagram can be accessed the same way as an original diagram. Something that might be useful is to work with the diagram itself instead of the image directly by using the representationByDescriptionName() with the same parameters as the asImageByRepresentationDescriptionName() service. You can then do something like:

someDiagram.name
someDiagram.asImage()
someDiagram.documentation

I hope it will help you work with M2Doc.

Hello Yvan,
Thank you for your quick response.
I changed the name for the Operational Architecture Blank into Operational Entity Blank.
It works as you suggested :-). Thanks a lot.
I tried the interpreter view, but had some troubles with the query. The interpreter gave me some errors back, as soon as I type "aql: ". Maybe I forgot something, I will check it tomorrow.
Also using the diagrams itself instead of images of the representations makes sense to me. I will try it and will come back, if there are any troubles.
For now: many thanks for your help
Best regards
Carsten

If you are using the M2Doc interpreter view the “aql:” is not needed.

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