Author Topic: Create a copy of a sequence diagram  (Read 3264 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Create a copy of a sequence diagram
« on: March 17, 2012, 12:38:39 am »
Does anyone have ready made code to copy a sequence diagram?
From what I see now I'll have to:
  • copy owned elements (notes and fragments)
  • copy diagramObjects
  • copy messages
  • copy diagramLinks

Geert

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Create a copy of a sequence diagram
« Reply #1 on: March 23, 2012, 09:54:02 am »
If the Sequence diagram is alone into a Package containing the diagram and the collaborating objects (instances of classes), then use the "Package.Clone()" method.

Else, if the diagram is under an "Interaction" object containing the diagram & objects, move temporarily the Interaction (Element.PackageID) to a temp package, clone it, and relocate the Interaction object.

Regards,

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +564/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Create a copy of a sequence diagram
« Reply #2 on: March 23, 2012, 07:33:19 pm »
Thanks Luis,

That is a great workaround!
(I sort of feel bad that I didn't think of it :-[)

Geert