Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Bobbele on September 29, 2011, 08:18:56 pm
-
Hello,
I defined some Action items in an Activity item. Now I want to move/change/switch the item typ from Action to Activity. Is there a way to do? How I can realize this?
At the moment I define activity diagrams.
Kind regards
Answers in German are also welcome.
-
Via the main menu: Element|Advanced|Change Type
Geert
-
Many thanks. It works fine.
Do you also know, can I copy a complete strukture include all connections between the elements? I found only an option to copy the elements but withous the connections.
-
I don't think so.
-
The only way to clone an element with its relationships is trought scripting.
1. Create a temp Package
2. Move the Element to clone to the temp Package
3. Use Package.Clone method
4. Move the original Element to its original location
5. Move the cloned Element where you like
6. Delete the temp and temp_copy Packages
-
I would try it over package managing but where I can find (or how I can use) the package.clone method? Is it necessary to program a script or something like that, or I can find this over the main menu?
-
You should create a "Project Browser" type scripts group and a VB script inside.
Later, you can invoke it from the context menu over the desired element to clone.
The script is:
Dim ElementToClone
Dim OriginalPackage
Dim TempPackage
Dim i
Dim TheEnd
Set ElementToClone = GetTreeSelectedObject
Set OriginalPackage = GetPackageByID(ElementToClone.PackageID)
Set TempPackage = OriginalPackage.Packages.AddNew("Elemento clonado", "Nothing")
TempPackage.Update
OriginalPackage.Packages.Refresh
OriginalPackage.Update
ElementToClone.PackageID = TempPackage.PackageID
ElementToClone.Update
TempPackage.Elements.Refresh
TempPackage.Update
TempPackage.Clone
ElementToClone.PackageID = OriginalPackage.PackageID
ElementToClone.Update
OriginalPackage.Elements.Refresh
OriginalPackage.Update
i = 0
TheEnd = False
While i < OriginalPackage.Packages.Count And Not TheEnd
If OriginalPackage.Packages.GetAt(i).PackageID = TempPackage.PackageID Then
OriginalPackage.Packages.DeleteAt i, False
TheEnd = True
End If
i = i + 1
Wend
OriginalPackage.Packages.Refresh
RefreshModelView (OriginalPackage.PackageID)