Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jamo

Pages: [1]
1
Thanks, Geert!

Using external input (for example the MDG file) was also something I considered but I hoped that there was a different way.
But then I will follow that approach.

2
Hi all,

I have two questions:
  • Why does EA allow typing of TaggedValues via MDGs if it only respects typing of enums
  • Is there a way to query MDG datatypes like enums via the API or via sql query?

According to documentation, TaggedValue.Value always returns a string. So even if I defined a TaggedValue type as an int, for example, the value is returned as string via API and also in the EA GUI, I can just type in whatever I want. The only somewhat exception is the enum type. In the GUI I can ONLY select pre-defined values (as intended) but with the API I can also add a not pre-defined value (which should be forbidden).
Here I'm wondering: Why even offer typing of TaggedValues if it is not respected anyway (except for enums)? Or is there a way to type constraint a tagged value that I'm just not seeing?

Regarding the second point: I have not found a straightforward way to query the datatype of a TaggedValue. As previously mentioned, I assume it's always string anyway, but for Enumerations it would be nice to get this information somehow. How I'm doing it currently is by checking if the content of the TaggedValue notes field matches the style of how EA stores literals (e.g. "Values: A,B,C,D Default: Select Value"). That's of course not a nice and clean way but the only practical way I found.

I also checked t_datatypes, but this does not store any MDG defined datatypes if I understand it correctly (at least I didn't find the MDG defined enumerations here).


Looking forward to your suggestions and insights!

3
Thanks, Geert, I will keep that in mind.

So far, I haven't worked with creating add-ins, I only used python scripts. My workaround for the MDG issue is, to open a dialog box that pauses the script until the user has manually exchanged the MDGs. It's not pretty, but it works.

4
Must have had tunnel vision when I read the documentation on the function.

Then I would like to join Geert's question: When will this be available again?
These functions (install/delete MDG by API) are really useful to write a migration script for custom MDGs.

5
Hello all,

I wrote a python script to load in a new MDG into my project (as part of a bigger automatization script). Now, I have encountered some weird behaviour that I just can't explain.

First of all, if I load in the MDG via 'repository.ImportTechnology(MDG.xml)' instead of the manual 'Import Technology' dialog, the technology can then be expanded/collapsed in the resource browser which let's you inspect the full content of the MDG. That's pretty cool and helpful, but why does this not happen when I manually import the technology?

But the actual problem I'm encountering is the following:
If I install the MDG manually, everything works fine. Toolbox and elements appear and behave correctly. If I install the MDG via API, the Toolbox does not appear in the toolbox browser with its own name but with the Profile's name (e.g. in the toolbox dropdown menu I have to look for 'TheProfile' instead of 'TheToolbox'). Furthermore, the elements do not appear correctly in the toolbox.
In my example, I have 4 different stereotyped elements of type 'Requirement' in my toolbox. Again, if the MDG is manually installed everything works fine. If it's installed via API, I have 4 objects called 'Requirement' in my toolbox with a little open folder as an icon instead of the standard requirement icon. If I drag and drop those elements into a diagram, a dropdown dialog appears that let's me choose between 'Requirement' or 'Requirement'. For both selections, I get the same element stereotype and each of the 4 'Requirement' elements yields one of the stereotypes I have defined.

So, the information is still there and correctly saved, it just gets displayed very weirdly. Funnily enough, the elements are correctly displayed in the resource section of the project.

And lastly: Yesterday, everything worked fine except for EA not 'listening' to the repo.GetProjectInterface().ReloadProject() command. Today, it executes the command correctly, but does not implement the MDG correctly.


I attached my code, in the case I've overlooked a dumb mistake.
Code: [Select]
    if os.path.isfile(filepath):
        print("Importing mdg...")
        with open(filepath, 'r') as MDG:
            # Load xml as ordered dictionary
            MDG_dict = xmltodict.parse(MDG.read())
            #print(json.dumps(MDG_dict, indent=2))  # For inspection
            # Fetch MDG ID and Version for EA interaction
            newMDG_ID = MDG_dict["MDG.Technology"]["Documentation"]["@id"]
            newMDG_Version = MDG_dict["MDG.Technology"]["Documentation"]["@version"]
            # Try to load technology
            if not repo.IsTechnologyLoaded(newMDG_ID):  # is MDG technology loaded into the model?
                # Unparse dict to xml as input for EA
                techIsInstalled = repo.ImportTechnology(xmltodict.unparse(MDG_dict))
                print("Is tech installed: "+str(techIsInstalled))
            else:
                if not repo.GetTechnologyVersion(newMDG_ID) == newMDG_Version:
                    # Unparse dict to xml as input for EA
                    techIsInstalled = repo.ImportTechnology(xmltodict.unparse(MDG_dict))
                    print("Is tech installed: "+str(techIsInstalled))
                else:
                    raise Exception("New MDG is already installed")
        repo.GetProjectInterface().ReloadProject()

    else:
        raise Exception("Bad filepath for new MDG technology")

6
Indeed. While going through all the different possibilities to refer to a custom toolbox, I figured out that it was in fact just the toolbox name I had to refer to, without the name of the profile or the MDG technology.

So instead of MyProfile::MyToolbox, the string MyToolbox is sufficient. That's a bit confusing since you cannot refer to the UML Component toolbox with Component but have to use UML::Component.

7
Thanks for the clarification. A bit confusing, but it's good to know how to find the "true names" of diagrams.

But how do I find the true name of a toolbox? I couldn't find a corresponding console query.
Especially if I built the toolbox myself, I figured it should just be name I've given it. If I check the xml file for my toolbox I don't see any metatype attribute.

8
Addition to the Custom Diagram Profile:

Managed to make it work after all, but have a follow-up question. In step 5 of the documentation it is described how to set the properties of the custom diagram. With the attribute "toolbox", you can select the default toolbox that is displayed when switching between different diagrams.

Setting this value to UML::Component or Extended::Construction correctly leads to the Class or Component toolboxes being displayed when selecting the diagram. However, this does not seem to work with "non-basic" toolboxes such as SysML 1.5::SysML 1.5 Internal Block. (All toolbox references where taken from the Find Toolbox Item tool)

I was wondering if this finding is correct and the normal user cannot set custom toolboxes for custom diagrams or if, once again, I'm just missing something.

Documentation: https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/modeling/custom_diagram_types.html

9
Hi all.

I've been trying to build a custom metamodel diagram view according to the documentation (https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/custommetamodelview.html) but I can't get it to work and I wonder why. Maybe I'm misunderstood or overlooked something.
My Model is built as follows

Model
-Package1
--(PackageDiagram) Package1
--<<profile>> MyProfile
---(PackageDiagram) MyProfile
---<<profile>> MyView
----(ClassDiagram) MyView
----<<view specification>> MyView
----<<stereotype>> SysML1.4::Block
----<<stereotype>> SysML1.4::Block Definition

MyView extends SysML1.4::Block Definition and exposes SysML1.4::Block as shown in the documentation in the last row of the table. Both stereotypes are abstract. I omitted the other elements, since they are just more extensions for elements in the toolbox.

I saved all diagrams and then exported the profile MyProfile via "Publish Package as UML Profile". Then I generated the MDG file and included the profile. I did not select any other functions like Toolboxes etc. When I import the MDG, I can find the technology in the MDG Technologies overview and I can also select it in the toolbox (Although no toolbox is defined for it, it just shows Common, Common Relationships, and Artifacts all folded in). When I try to create a new diagram, my custom view should appear under SysML 1.5, Block Definition as MyProfile::MyView, but it is not there.

I also tried out the instructions to "Create Custom Diagram Profiles" (https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/modeling/custom_diagram_types.html, which seems really similar Custom Metamodel Diagram Views), but did not have any success with it either.

Any suggestions?

10
Solved the most important part of it. The problem was (as often) in front of the computer.

1. Typo in the attribute definition of my toolbox
2. Forgot that I had to publish my toolbox diagram as UML profile so that the changes actually take effect.


But still, installing the MDG does not install the pattern although it is selected in the MDG wizard. I have to add the pattern manually to the resources so I can use the toolbox element.

11
Hey, thanks for both suggestions. I looked into it, but I don't think "Context Item Events" can really help me here.

Patterns however seem to be the way to go. I had success in replicating my script with a pattern, but I struggle to implement it in the MDG.
And I think this is was Geert meant with awkward.

I published the pattern and imported it into my .eapx file with which I build my MDG. Then I followed the instructions (in particular, step 6) here:
https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/modeling/toolbox_profiles.html

Then, I save the updated UML Diagram of my toolbox profile as an .xml file and generate the MDG. In the Contents window of the MDG wizard the box for "Pattern" is checked and all .xml files (Profiles, Patterns, Toolboxes) are selected in the subsequent windows. When I import the MDG file into a new project, my new pattern appears in the toolbox but DOES NOT appear in the Resources/Patterns folder.

If I drag&drop the pattern into a suitable diagram, I get an error message "Pattern not found in model's resources."
If I now manually import the pattern and repeat the drag&drop from the toolbox I get the same error message.
If I drag&drop from the resources window, it works without problem.


Any ideas?

12
Hello all,

I am working on a custom toolbox and was wondering if it's possible to create a toolbox element that, when dragged into a diagram, actually creates two objects that are connected with each other. For example: A requirement and its justification.

I already have a script at hand that can do this, so the question might rather be: Can I trigger such a script when dragging an element from a toolbox into the diagram.

And if you are wondering why I want a toolbox element for this, if I can do this by script: Drag-and-drop is just a bit more convenient then right-click/hover/left-click. ;D
Also I want to learn what else is possible with MDGs

Best,
Jamo

13
Hey Geert,

thanks for the quick reply! Then I guess for now, I'll deal with this by using one or more input boxes one after the other.

Regarding the html form: Do you happen to know how to create a html file from a script within EA? I checked the documentation a bit but couldn't find any hint. I did find out that, for example, XML files can be created with CreateObject() and such, so I suppose it might work similarly. Just need to find the correct commands.

Best,
Jasper

14
Hi all,

I recently started to work with VB scripts to create elements in requirement diagrams and thanks to the examples present in EA itself this worked fine so far.

What I would like to do now, is having a custom dialog window open up, whenever I call the script so I can enter data like Name, Alias or Notes in one go (or rather with multiple input lines available).

I'm already using the VB native InputBox and I know that I could use it as a workaround by passing all data in just one line. I was just wondering if it is possible to create custom dialog windows in EA and call them from a script.

Best,
Jamo

Pages: [1]