Book a Demo

Author Topic: Inheriting SysML 1.5 Diagram Frames & Structural Synchronization in custom MDG  (Read 103 times)

royvanmarrewijk

  • EA User
  • **
  • Posts: 65
  • Karma: +1/-0
    • View Profile
Hi all,

For our Systems Engineering process, we are using SysML 1.5. To support some domain-specific modeling, we are developing our own custom MDG Technology.

For our custom Internal Block Diagrams (IBD) and Activity Diagrams, we specifically need the SysML diagram frame enabled so we can host and connect external ports and activity parameter nodes.

Currently, our Diagram Profile stereotypes extend the base UML metaclasses (CompositeStructure and Activity). Because these extend pure UML rather than the built-in SysML definitions, we run into the following limitations:
  • The diagram frame is not displayed by default.
  • The context menu options Show/Hide Diagram Frame and Synchronize Structural Elements are missing.
I have searched the forum documentation, but I cannot seem to find the correct way to either:
  • Properly extend/inherit from existing SysML 1.5 diagram types instead of the raw UML metaclasses, or
  • Set the appropriate tagged values/properties in the Diagram Profile stereotype to enable the SysML frame behavior and structural synchronization commands.
Could anyone point me in the right direction or share the required profile configuration/tagged values for this setup?

Thanks in advance!

Kind regards,

Roy

philchudley

  • EA User
  • **
  • Posts: 760
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Hi Roy

After a bit of delving I believe the show / hide diagram frames is stored in the Diagram styleex field. Specifically:

styleex contains SF=1; for showing diagram frame
styleex contains SF=0; for not showing diagram frame


To set this in a MDG for a custom diagram type you have to set an attribute in the stereotype and enter the styleex string (semicolon delimited)

You could find what to set this to with a simple SQL query, or according to Google AI (usual disclaimers)


How to Configure styleex in an MDG Diagram Profile

1. Open the Diagram Profile: In your MDG Technology project, open the Class diagram where you defined your custom diagram stereotype.
2. Locate the Metaclass: Find the Diagram_xxxx Metaclass element connected to your custom diagram stereotype via an Extension connector.
3. Edit Attributes:
   • Press F9 or right-click the Metaclass element and select Attributes.
   • Add or locate the attribute named styleex and set its type to string.
   • Enter your semicolon-separated configuration keys and values in the Initial Value field.

Hope this helps

Phil
Models are great!
Correct models are even greater!

royvanmarrewijk

  • EA User
  • **
  • Posts: 65
  • Karma: +1/-0
    • View Profile
Hi Phil,

Thanks for the quick response.

I added the attribute to the metaclass element in my diagram profile (Name: styleex, Type: string, Initial Value: SF=1;), exported the profile, and imported the updated MDG. After that, I created a new Activity diagram based on the MDG, but the diagram frame still does not appear.

Using the SQL scratchpad, I verified that both a native SysML diagram and my custom diagram show SF=1; in the StyleEx column.

Did I configure this correctly, and were you able to get the frame to display using the SF=1; attribute value?

Kind regards,

Roy

philchudley

  • EA User
  • **
  • Posts: 760
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Seems you have set styleex correctly with respect to SF=1;

Just a thought, does your styleex string contain

MDGDgm=SysML1.4::Activity;

Note even though the MDG is SysML1.5, the value above appears as SysML1.4::Activity

Phil
Models are great!
Correct models are even greater!

royvanmarrewijk

  • EA User
  • **
  • Posts: 65
  • Karma: +1/-0
    • View Profile
No it didn't but after I added MDGDgm=SysML1.4::Activity; to StyleEx it still doesn't work.

I even tried to copy the whole StyleEx from a SysML activity diagram to my profile without effect.

Maybe the problem is that I now have two MDGGgm variables in my StyleEx which are MDGDgm=My Diagrams::Activity and MDGDgm=SysML1.4::Activity. EA Automatically added the first entry based on my profile.

philchudley

  • EA User
  • **
  • Posts: 760
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
I have done a bit more digging and found:

If you extended UML::Activity directly, Sparx treats your custom diagram as a standard UML diagram, stripping away the mandatory SysML frame.
• Open your MDG Diagram Profile development package.
• Ensure your custom diagram stereotype extends the SysML Metaclass/Stereotype rather than the core UML one.
• Instead of mapping to Metaclass: Diagram_Activity, verify it accurately maps to the SysML profile diagram definitions, or explicitly uses the SysML stereotype.

I believe you said in your initial post that you had extended UML::Activity, it appears that maybe the underlying cause of your issue.

1. Use an Extension connector from your custom diagram stereotype (MyCustomSysMLActivity) pointing directly to the modified Diagram_Activity Metaclass.
2. (Optional) Add a frameString attribute to your stereotype element if you want to customize the text rendered in the top-left corner of the SysML frame (e.g., act [Activity] MyCustomHeader).
 +--------------------------------+                  +---------------------------------+
 |        «stereotype»                |  Extension   |          «metaclass»                |
 |   MyCustomSysMLActivity     |------------->|       Diagram_Activity             |
 +--------------------------------+                  +----------------------------------+
                                                                 | extension = SysML1.5            |
                                                                 | styleex   = ShowFrame=1;     |
                                                                 | pdata     = HideFrame=0;      |
                                                                +---------------------------------+

Where the attributes are defined as:

• extension: Set this to the version of SysML your MDG targets (e.g., SysML1.4 or SysML1.5).
• styleex: Set this to ShowFrame=1; (This forces the native SysML diagram frame layout to always render on initialization).
• pdata: Set this to HideFrame=0; (Ensures frame visibilities are on by default).

Interestingly this states ShowFrame / HideFrame rather than SF

But I guess anything is worth a try !

Best of luck

Phil
Models are great!
Correct models are even greater!

royvanmarrewijk

  • EA User
  • **
  • Posts: 65
  • Karma: +1/-0
    • View Profile
Hi Phil, thanks again.

I tried your solution but it doesn't have the desired effect. The generated XML of the MDG shows the fields you described.

Code: [Select]
<Stereotype name="CustomActivity" notes="" cx="0" cy="0" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0">
<AppliesTo>
<Apply type="Diagram_Activity">
<Property name="toolbox" value="xxxxx"/>
<Property name="extension" value="SysML1.4"/>
<Property name="styleex" value="ShowFrame=1;"/>
<Property name="pdata" value="HideFrame=0;"/>
</Apply>
</AppliesTo>
</Stereotype>

I also tried the SysML 1.5 variant.
When I query the diagram I don't see anything about the attribute extension or the value SysML1.4 or SysML1.5.

Did this construction worked in your environment?

Roy

philchudley

  • EA User
  • **
  • Posts: 760
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Hi Again

I am trying to see if I can get this to work, but no luck so far.

Disclaimer, all the advice offered so far was from searching various sources rather than something I had achieved for myself.

I will keep trying but may not be able to post further until tomorrow.

Phil
Models are great!
Correct models are even greater!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8120
  • Karma: +119/-20
    • View Profile
The only way you can define your own diagram profile and have it inherit the SysML behavior is via an add-in that implements the EARules_Initialize broadcast.

Pseudo code would look like this:
Code: [Select]
string EARules_Initialize([in] Repository repository, [in] int index, [out] string base)
{
    switch(index)
    {
    case 0:
        base="SysML1.4";
        return "MyStereotypeProfile";
    case 1:
        base="SysML1.4";
        return "MyDiagramProfile";
    default:
        return "";
    }
}

If those two profiles have the same name then you can omit the second.

This can be implemented in a model add-in which can be marked as enabled for all users.

When EA asks if it knows about any special rules that can't be defined in a profile for the current diagram or element it will find your types. It would then call your add-in for the broadcasts in the documentation. If you haven't implemented one of those or for any of the others we don't have published it will then fall back to the SysML 1.5 behavior.

The other option that you have is to define a view definition on top of the existing diagram type. There's even an example in the help for how to define a view extending a non-UML diagram.

I'm guessing Phil's suggestion to add ShowFrame and HideFrame (along with the extension attribute) came from an LLM. If it's going to work you'll have to use the option as named in the existing values, but you already said that it didn't work with SF.

philchudley

  • EA User
  • **
  • Posts: 760
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Thanks Eve, I had forgotten the View Specification method.

To Roy

I have tried a simple MDG using the View Specification technique and confirm that it works.

Please send a Personal Message on this forum include your e-mail and I can send you my example MDG together with a simple test repository.

Phil
Models are great!
Correct models are even greater!