-
Notifications
You must be signed in to change notification settings - Fork 4
Tutorial
This section describes how to make a mixed diagram with classes, use cases, actors and notes. Here is the final diagram:
Start with a blank diagram File New or launch PyUt
The first step is to add the four classes to the diagram. Click on the class icon on the toolbar and place the Vehicle
class in the top left corner. Now you should see the following class editor dialog:
- Set the class name
Vehicle
and the stereotypeabstract
. - Next, set the class fields. To do this, click on the first
Add
button and enter the- field name,
- type
- and default value (for the example,
maxSpeed - int
.
- Click
Ok
to return to the class editor. - Next, add the method, just like we do it for fields.
- You may also add a description to your class with the button
Description...
. - Once you have entered all the parameters, click
Ok
to exit the class editor.
You should see your first class on your diagram. Repeat the same steps to place other three classes on the diagram.
Ok, now we are ready to insert a note to describe the Vehicle class. Click on the note tool and place the note on the right of our considered class. Enter the note text and press Ok. You will see that you can't read the whole text in the note if the text is too long. Just resize the note to see all text.
We are now ready to place the actor and use cases to describe the interactions between users and the system. Just click the actor tool, place one and give him a sweet little name. Add two use cases on the right of the actor, with a little description of what the actor may do.
In this section, we are going to make the links between our different components :
Class Car inherit from class Vehicle :
- Click on the inheritance link button in the toolbar
- Click on the class Car, then click on the class Vehicle
Now we have our first relationship.
By the same way, insert the next links :
- Composition link from Car to Wheel.
- Agregation link from Car to Passenger class.
- Note link between Vehicle and the note
- Association link between Conductor and the two use cases.
We can redefine or remove a link parameters by clicking the link.
Now we have a basic UML diagram. We can save it, print it, export it, or modify the different component by double-clicking on them.
You can now save your diagram using the default PyUt file format .put or use a plugin to export your diagram. Supported plugins are :
- Import/Export XML
- Import XMI
- Import/Export Python (Reverse/Generation)
- Import/Export Java (Reverse/Generation)
- Export C++ (Generation)
- Export BMP, JPG
You did it ! We saw that creating a UML class diagram with PyUt is easy !