Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Polarsys » M2Doc » display diagrams(M2doc too complex)
display diagrams [message #1828662] Tue, 16 June 2020 08:08 Go to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
Hi,
I have been trying to function m2doc since days just to display the diagrams (system architecture, etc).
Too complex for systems engineers who cannot afford loosing time for creating a word document! There are no clear documentation...

I ended up with this piece of code attached.

I have no errors, but no image is displayed, only the logical elements names are there.

What should I do?

Thank you.
Re: display diagrams [message #1828675 is a reply to message #1828662] Tue, 16 June 2020 11:34 Go to previous messageGo to next message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
Hi,

Did you follow the Capella tutorial ?
With that you should be able to generate a document with diagrams in a matter of minutes.

You can double check the name of available representations name with availableRepresentations(). You can use the names listed in the table with other services such as asImageByRepresentationDescriptionName() or asImageByRepresentationName().

I will be glad to improve the documentation if you have any constructive remakes.
Re: display diagrams [message #1828685 is a reply to message #1828675] Tue, 16 June 2020 15:12 Go to previous messageGo to next message
Samuel Rochet is currently offline Samuel RochetFriend
Messages: 21
Registered: November 2014
Junior Member
Hi,

To complete Yvan's answer, there is also an extremly usefull MS Word add-in to edit your templates. It will provides you with autocompletion, expression evaluation, etc.
All details are available in the dedicated section here: https://www.m2doc.org/ref-doc/nightly/index.html#generating-a-document

Samuel
  • Attachment: Add-in03.png
    (Size: 83.15KB, Downloaded 146 times)
Re: display diagrams [message #1828689 is a reply to message #1828662] Tue, 16 June 2020 15:43 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Hi,
First, you have to add these additional nsURI packages to your m2Doc template. To do so, right click on your m2doc template (under Capella) and select "Edit Template properties" amd then go to the nsURI(expert) tab, click on "add" and search for *sirius.
http://www.eclipse.org/sirius/1.1.0
http://www.eclipse.org/sirius/diagram/1.1.0
http://www.eclipse.org/sirius/diagram/sequence/2.0.0
http://www.eclipse.org/sirius/table/1.1.0
http://www.eclipse.org/sirius/tree/1.0.0

Then please find attached an image of a m2doc template that generates all LAB, LCBD, FS and ES for the logical architecture.

I hope this helps.
  • Attachment: m2doc.png
    (Size: 37.64KB, Downloaded 197 times)


Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828698 is a reply to message #1828689] Wed, 17 June 2020 00:45 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
Thx Stephane,
This does not work.

_I have added the nsuri stuff. Where is this documented, how can we know that we need to untick the capella option and that we need to add what you suggested with those specific versions 1.0.0 and not the 1.1.0 ( for example for the tree one it seems we cant have both).
Why don't we add them all?


_Where is it documented that we need to use one function asImage and not another (e.g. ASIMAGEBYREPRESENTATIONDESCRIPTIONNAME) as described in other forums?

_I have changed the code accordingly but this still does not work i.e I have the names of the component generated but not the diagrams and no validation errors.

M2doc is unprecedently confusing... I have read all the documentations available, and many, many forums pages...I mean just basic stuff like: define your main variable as the name of the project is written nowhere!

Thank you again for your help!

[Updated on: Wed, 17 June 2020 00:55]

Report message to a moderator

Re: display diagrams [message #1828699 is a reply to message #1828698] Wed, 17 June 2020 01:07 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Hi,

Well, all this is documented in the documentation:
- The entry point for the M2Doc documentation: https://www.m2doc.org/ref-doc/3.0.0/index.html
- The M2Doc services you are using to get diagrams are documented here: https://www.m2doc.org/ref-doc/3.0.0/m2doc_service_m2docsiriusservices.html
- The fact that you have to add the NSUris is documented here: https://www.m2doc.org/ref-doc/3.0.0/index.html#services

But indeed, being able to write your own Word template with m2doc will require you to learn a few things including the AQL query language, so if you don't have time to do this, we offer training services or sub-contracting services to write templates for you.

Nevertheless, I am sorry that what I sent you is still not working for you. If you want more help, I would like to know which Capella version you installed and which m2doc version you installed, and then maybe you can attach your word template so that I can see if there is something wrong.

You can use asImage() and ASIMAGEBYREPRESENTATIONDESCRIPTIONNAME(), they will both get you an image, but these function does not apply on the same object. The reason why I am using asImage is that I used representationByDescriptionName which enables you to get the Diagram Representation object, not the image. On this object you can apply the asImage() to get the diagram image, but also .name to get the actual diagram name.

I hope this helps
Stephane


Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828700 is a reply to message #1828699] Wed, 17 June 2020 02:37 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
Thanks.

I also noticed that the example "in flight entrertainment" this option in the tab service expert in "edit the template": "Org.obeonetwork.capella.m2doc.aql.queries.M2DocGenServices".

Is this another tricky compulsory option to be aware of?

I cannot add anything in the tab service expert ( no suggestions and no ability to add it manually in the filter).
What should I do?
Is this necessary for m2doc to function?

What is an explicit constructor described in the m2doc documentation ? Do I have to use the explicit or the default to display nominal diagrams?

The m2doc documentation specifies this:
" When there is an explicit constructor with at least a parameter M2Doc can't instantiate your class since there is no default constructor. You need to implement the IServicesConfigurator interface. This interface link one or more options in the generation configuration to the service class in order to instantiate it. You need to use the org.obeonetwork.m2doc.ide.servicesConfigurator extension point to declare your implementation of IServicesConfigurator. If you want to use your implementation in standalone you can register it programmatically using M2DocUtils.registerServicesConfigurator()."

Again thank you so much, this is really making me crazy I was supposed to work on my complex engineering model...and I end up loosing time on ...a word template...

[Updated on: Wed, 17 June 2020 04:08]

Report message to a moderator

Re: display diagrams [message #1828701 is a reply to message #1828700] Wed, 17 June 2020 04:05 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
I understand now why you are struggling, you started over from an empty word document.
What I would suggest you is to start over reusing one of the example word document provided with the example project, it would make it simpler, just empty the content and start writing your document.

Nevertheless, if you still want to use your own word document from scratch, then this is feasible, here is the list of what you have to do, using "Edit Template properties", to add Capella's metamodels and other services.:
- add all Capella's metamodels in the "nsuri (expert)" tab (In the add dialog you can enter "capella" in the filter field then select every nsuris and add them), also keeping the one you already added previously
- add services you can use the "services (expert)" tab on the same wizard page and add: org.obeonetwork.capella.m2doc.aql.queries.M2DocGenServices
- click next and add a self variable with the value capellamodeller::SystemEngineering
Click finish to save your changes, you can now open the template in MS Word to edit it.

If you can't edit some of the properties, you can do it in word. Go to File->info and on the right, you'll see "Properties" and just at the end of this word, an arrow, click on it and go to "Advanced Properties" and then custom and there you can add properties.

Once again, it is much simpler to start with a word document already provided as an example...

A Custom Constructor is a Constructor you provide yourself in a Class.

I hope this helps


Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828702 is a reply to message #1828701] Wed, 17 June 2020 04:43 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
I am sorry but I have tried everything: the M2doc template and/or project and the creation of word myself.

The wizard is not acting so much as a wizard as as I never have the Org.obeonetwork.capella.m2doc.aql.queries.M2DocGenServices.

As I said...I cannot select anything here, and there are no suggestions in the filter, not even the possibility to type manually " org.obeonetwork.....". see attached.

Regards,

[Updated on: Wed, 17 June 2020 04:44]

Report message to a moderator

Re: display diagrams [message #1828703 is a reply to message #1828702] Wed, 17 June 2020 04:45 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Please attach your word document and I will fix this.

Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828705 is a reply to message #1828703] Wed, 17 June 2020 05:52 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
Thank you very much. Please see attached.

Re: display diagrams [message #1828726 is a reply to message #1828705] Wed, 17 June 2020 17:18 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Please try with this one, I should have fixed the template properties.

Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828736 is a reply to message #1828726] Wed, 17 June 2020 23:26 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
Thank you and thank you for being reactive.
Still no diagrams are displayed though... :(

[Updated on: Wed, 17 June 2020 23:28]

Report message to a moderator

Re: display diagrams [message #1828737 is a reply to message #1828736] Wed, 17 June 2020 23:39 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
ok, this is working on my end. Any error on your end? Could you sent de genconf file as well?
Can you tell me what Capella version you are using and what m2doc version you've installed?


Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1828880 is a reply to message #1828737] Sun, 21 June 2020 05:10 Go to previous messageGo to next message
Ka Ha is currently offline Ka HaFriend
Messages: 9
Registered: June 2020
Junior Member
I am using Capella 1.4 and M2doc 3.0.
I have no error when I use your suggested code. But I still cannot display anything with it.

However, I just found out that for the system analysis if I use this function:

"self.containedSystemAnalysis.ownedSystemComponentPkg->closure(cPkg | cPkg.ownedSystemComponentPkgs).asImageByRepresentationDescriptionName('System Architecture Blank').
"

I can manage to display the system architecture.

and with this:
"self.containedSystemAnalysis.containedCapabilityPkg
package.asImageByRepresentationDescriptionName('Missions Capabilities Blank').

I can display the capabilities diagram.

Why do you think the function asimagerepresentationdescriptionname works and not the function asImage as you suggested?
Does that mean we need different functions for different analysis for ops, system, local analysis?

For me at this point for my project, the most critical ones will be displaying the exchange scenarios of the logical and system analysis.
Thank you.

King regards,




Re: display diagrams [message #1828897 is a reply to message #1828880] Sun, 21 June 2020 17:16 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Could you make a zip of your project and send it to me? I would like to see why it is not working for you and give you the right code so that it works for you.

About the asimagerepresentationdescriptionname and asImage functions: they would both work I assume, but there must be something wrong on the code before this...

Stephane


Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1835862 is a reply to message #1828897] Tue, 15 December 2020 11:21 Go to previous messageGo to next message
fares kallel is currently offline fares kallelFriend
Messages: 10
Registered: May 2020
Junior Member
Hi Stephane,

I am having the same problem as Ka Ha. I created a Service class but when I open the Services(expert) no options are displayed.
Can you please let me know how you fixed the problem ?

Thanks

Re: display diagrams [message #1835893 is a reply to message #1835862] Wed, 16 December 2020 00:02 Go to previous messageGo to next message
Stephane LACRAMPE is currently offline Stephane LACRAMPEFriend
Messages: 217
Registered: July 2009
Senior Member
Please ask you question on the new Capella forum: https://forum.mbse-capella.org/

Stephane LACRAMPE
Obeo Canada
Re: display diagrams [message #1858312 is a reply to message #1828662] Tue, 28 March 2023 14:39 Go to previous message
Félix Pannaud is currently offline Félix PannaudFriend
Messages: 1
Registered: March 2023
Junior Member
Hello, I know it's an old subject but I've been using CAPELLA M2DOC recently and i had the same probleme you did. However, i found a way to display a diagram LAB for exemple, in an M2DOC generated document. Use the following request :
{m:'NameOfYourDiagram'.asImageByRepresentationName().fit(500,500)}
It worked for me
Previous Topic:Implementing MSM diagram
Goto Forum:
  


Current Time: Sat Nov 11 06:10:20 GMT 2023

Powered by FUDForum. Page generated in 0.02240 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top