Unable to visualize diagrams / Sirius service doesn't seem to work

Hi everyone,

I am completely new to M2Doc and this is my very first attempt at generating documentation from a Capella model, so I apologize if I am overlooking something obvious.

I am currently using:

  • Capella 7.0.1

  • M2Doc 4.0.2

  • M2Doc Sirius Integration

My goal is to generate documentation from my Operational Analysis model and include Capella diagrams directly in the generated document.

After quite a bit of debugging, I have reached a point where I can successfully access the Sirius model from M2Doc:

  • The .aird file is loaded correctly

  • A DAnalysis object is available

  • ownedViews can be accessed

  • DRepresentationDescriptor objects can be accessed

  • DSemanticDiagram objects can be accessed

For example, the following works:
{m:d.representation.eClass().name}

and returns:
DSemanticDiagram
I can also iterate through all representation descriptors and find specific diagrams such as:
[OAIB] Mission Planning

However, all Sirius-specific M2Doc services seem to be unavailable.

The following examples all fail with a “service not found” error:
{m:‘’.availableRepresentations()}
{m:d.representation.asImage()}
{m:‘[OAIB] Mission Planning’.representationByName()}
{m:‘[OAIB] Mission Planning’.asImageByRepresentationName()}

Typical error message:
Couldn’t find the ‘asImage(EClassifier=DSemanticDiagram)’ service
or
Couldn’t find the ‘availableRepresentations(java.lang.String)’ service

Things I already checked:

  • SiriusSession option is set to the .aird file

  • Sirius nsURIs are registered

  • org.obeonetwork.m2doc.sirius is installed

  • org.obeonetwork.m2doc.sirius.ui is installed

  • Diagrams can be accessed through DRepresentationDescriptor

One thing that seems strange to me:

When I open the Generation Configuration and go to Services (expert) → Add the list is completely empty.
Here are a few screenshots:

Has anyone seen this behaviour before?

Is there an additional step required to register or enable the M2Doc Sirius Services in Capella 7.0.1 / M2Doc 4.0.2?

Any help would be greatly appreciated, been struggling with this for the last few days.

Thank you very much!

I think your Sirius session can’t be loaded. That might be the URI. Can you try a relative URI from the .genconf file and also don’t encode spaces with %20 to see if it helps (you might need to test both).
When Sirius services are not registered that’s most likely an issue with the SiriusSession option.

1 Like

Thanks for the hint and the quick response!

I tried the following SiriusSession values:

  • SOURCE-2 MBSE.aird
  • ./SOURCE-2 MBSE.aird
  • platform:/resource/source-2-capella-model/SOURCE-2 MBSE/SOURCE-2 MBSE.aird

Unfortunately, the result is still the same. I can still access the DAnalysis, the views, and the DSemanticDiagram, but asImage() is still not registered and gives:

Couldn’t find the ‘asImage(EClassifier=DSemanticDiagram)’ service

Is there anything else I can check to see whether the SiriusSession option is actually loaded correctly?

Can you try to create a new *.genconf file inside of the Capella project. It should set the SiriusSession automatically.
Can you also import the IFE sample project with the M2Doc templates to check if the generation works. You don’t need to edit anything just launch the generation on one the *.genconf files. Maybe something else is missing in your installation… Even if everything looks good from your screenshots.

1 Like

Thanks again for the suggestion!

I imported the IFE sample project and the M2Doc generation works there without any issue, including diagram generation.

I also tried creating a new .genconf (sirius_test/sirius_test_2 in the screenshot bellow) inside my own project at different levels. However, the SiriusSession is still not set automatically, and even if I set it manually I get the same issue: I can access DAnalysis, views and DSemanticDiagram objects, but asImage() is still not available.

One thing I noticed is that my project might not be a proper Capella project. In the Project Explorer it looks like a generic Eclipse project, while the IFE sample project has the Capella-specific project structure/icon. Also, in my project the .aird/.capella files are inside a subfolder instead of directly at the project root.

Could this project structure or missing Capella project nature prevent the SiriusSession from being detected correctly?

One additional thing I noticed:

When I set the SiriusSession option to:

platform:/resource/source-2-capella-model/SOURCE-2 MBSE/SOURCE-2 MBSE.aird

(I also tried: SOURCE-2 MBSE.aird, ./SOURCE-2 MBSE.aird, platform:/resource/source-2-capella-model/SOURCE-2%20MBSE/SOURCE-2%20MBSE.aird)

the generation behaves slightly differently. I no longer get the second message saying that a validation file was created, and the error in the generated document appears in yellow/orange instead of red.

The error itself is still essentially the same:

Couldn't find the 'asImage(EClassifier=DSemanticDiagram)' service

So this URI seems to change the behaviour somehow, but the Sirius image service is still not available.

I think the project nature and structure is important to open the Sirius session from a Capella project. You should start from a Capella project and make sure the model can be opened by Capella.
The SiriusServices class is initialized with the Sirius session, but only if the session is not null. If no session is found from the option Sirius services are not registered.

1 Like

It’s finally working :tada:

What I changed:

  • I added the Capella project nature to my project (properties → project natures ->add)
    ->After that, the Sirius session was automatically available.

  • I was then able to select the correct root variable (in my case “SOURCE-2 MBSE”) instead of using the DAnalysis variable I had been working with before.

  • I also moved the M2Doc templates and .genconf files into the same folder where the .aird file is located.

After these changes, I was able to generate and display my first diagram successfully.

So it seems that Sirius access is now working correctly. I still need to understand why some services such as asImage()sometimes are not available, but at least diagram generation itself is working now.

Thank you again for your help!

1 Like