Enterprise Architect: How to show packages as groups in a diagram - enterprise-architect

I'm trying to import some source code into EA, and make packages. In my root class diagram, I want to show each package as a visual grouping and have all classes inside that package in one group.
Can this be done?
Thanks

Not automatically. When you reverse-engineer source code, you have the option of creating either one class diagram in each package, or no diagrams at all.
Doing it manually, you can create a diagram which simply contains the packages: by default, EA lists the contents of each package when the package is placed in a diagram.
You could also drag the classes into the diagram and group them using boundaries or swimlanes. Boundaries are created from the "Common" diagram toolbox, while swimlanes are accessed by right-clicking an empty area of the diagram.
Finally, you can play around with the diagram's properties (also accessed by right-clicking an empty area), specifically the ones concerning namespaces and fully-scoped object names; these affect how EA displays packages and elements in a diagram.

Related

How to inherit attributes in class/block diagram using Eclipse Papyrus?

I'm creating a very simple class diagram using the Eclipse Papyrus but I'm not able to represent instances correctly.
First of all, I'm using the SysML 1.6 profile, so my classes are actually represented in a Block Diagram instead of classes, but I believe that this does not change anything in my problem.
After creating a simple class/block in my block definition diagram (bdd) I defined some attributes for my block like the example below:
When I tried to create some instances of my block ("parts" in SysML naming convention) using an "Instance Specification" I'm not able to inherit these attributes and fill them with actual information like the "name" and "quantity" in this example.
It's possible to see that my classifier is correctly set as "My component".
The Papyrus documentation for the Object diagram is clear and says that these Instance Specification should include my attributes so I don't know what I'm doing wrong.
I've tried since now:
Create instances in the same block diagram (bdd);
Create instances in another dedicated diagram of the type internal block definition (ibd);
Use the Papyrus context menu to show/hide all my compartments. Any of them works to show my attributes.
Apparently, the same problem occurs without any SysML profile and using pure UML like this question here (from 2016!!)
Papyrus version: 6.1.0

Create a package in Modelica

I am using Modelica in my work, where I have modeled a system that contains many models. I want to make it simple to use by creating a package using " within" so this package contains all the models. What I want is to open the package instead of opening many models, which takes time.
Instead of doing everything by hand, I suggest to create your packages with a Modelica tool (OpenModelica, Dymola, SimulationX, ...).
The tool will automatically create the folder structure and the within lines in the .mo files for you. Doing it manually is not much fun.
You could e.g. use OMEdit (part of OpenModelica) to create your package structure as follow:
create your top-level package via File > New Modelica Class
insert sub-models and sub-packages in existing packages via right-click > New Modelica Class
According to this website http://omwebbook.openmodelica.org/
A package is simply a container or namespace for names of classes, functions, constants, and other allowed definitions. The package name is prefixed to all definitions in the package using standard dot notation. An import language construct is provided for Modelica packages.
the package can help us to gather components that build the main model together in same place inside it , just by clicking on the package you open all your components inside it.
to open a package in Modelica we follow the follwing instructions:
After creationg the package you will get a folder with the package name in the place that you chosed to saved it in it , when you open the folder you click on package in order to open your package .
hope this can be helpfull

Deep Copy diagrams from enterprise architect

Hi Its possible to deep copy a diagram manually in EA . But is it possible to do it programmatically from an addin .
somethind like
diagram.cop() or diagram.duplicate() ? .
Or any other ways to copy an entire diagram with its diagram objects and diagram links .
There is no genuine method for that. You have to use the "manual" tedious way by iterating DiagramObjects and creating them new in the second diagram.
I thought of using EaPackage.Clone to create a full copy of the package that contains the diagram and the removing the unneeded stuff. But unfortunately the diagram points to the cloned elements.
Solution
Now that I write that: You can move the diagram to a temporary package. Now you use EaPackage.Clone and voila you have an exact copy of the diagram. Move the original diagram back to where it came from and delete the temp package.

Baseline a package and include out of package elements

I currently have a package that contains model diagrams only. These model diagrams include elements from a common library that other packages include in their diagrams. I want to avoid baselining the library package and diagram package separately since the library is very large.
What would be the best way to baseline the package with the model diagram to include all the elements in its diagram?
One solution I made was a VBS script to read the diagrams in the specific package for all elements and bring them into the package to baseline, it will then baseline the package. After baselining, it returns those elements to their original parent packages.

Enterprise Architect: Change diagram type (MetaType) by script

i have to change the diagram type of a lot of diagrams within my Enterprise Architect model. The change can be made manually using following option (that works as expected):
Select diagram - Diagram - Advanced - Change Type...
As I have to change a lot of diagrams I have created a script which searches for all concerned diagrams and change the type automatically. I wrote already a lot of JScript EA scripts for changing some modeling elements. Unfortunately, this feature seems not be available over the scripting interface.
I have to change the "MetaType" of the the diagram object. But this is read-only (see http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/diagram2.html). Therefore, I got an error.
var currentDiagram as EA.Diagram
currentDiagram = theDiagram
currentDiagram.MetaType = MY_DIAGRAM_METATYPE // ERROR
In the next step I searched for appropriate functionalities in the Repository interface (http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/repository3.html) and in the project interface. But I found nothing appropiate.
I am using Enterprise Architect 12.0.1215 and I used JScript.
Has anyone already tried this by script?
Have I missed something?
Is there another approach to achieve the diagram type change by script?
Thanks in advance!
You have to do that in two steps (if you change to different MDG diagram types). E.g. to change a Class diagram to a BPMN2.0::BPEL you first change Diagram_Type from Logical to Analysis. Additionally you need to add MDGDgm=BPMN2.0::BPEL; to StyleEx. In case your old diagram is from another MDG you need to modify the existing MDGDgm attribute in StyleEx.
As Uffe noted, the diagram type in the API is r/o. So if you need to change that you would need to do something like
Repository.Execute("UPDATE t_diagram SET Diagram_Type='Analysis' WHERE Diagram_ID=<theId>")
where <theId> would be the correct diagram ID.