Book a Demo

Author Topic: Updating Diagram Appearance After Deletion from Model  (Read 4734 times)

djdejong

  • EA User
  • **
  • Posts: 32
  • Karma: +2/-0
    • View Profile
Updating Diagram Appearance After Deletion from Model
« on: December 30, 2016, 04:52:00 am »
Hey,

I was wondering: is there a way to update the diagram after deleting things from the model? For examlpe it's really easy to delete some selected connectors:

Code: [Select]
dim i
dim element as EA.Element
dim diagramObject as EA.DiagramObject

for i = 0 to (selectedObjects.Count - 1)
set diagramObject = selectedObjects.GetAt(i)
set element = getElementByID(diagramObject.ElementID)
dim allConnectors : allConnectors = element.Connectors.Count-1
element.Connectors.Delete(allConnectors)
element.Update

'can't seem to update diagram appearance...
currentDiagram.Update
currentDiagram.DiagramLinks.Refresh
next

But even though -- in this case -- the relationship is removed, the connector still meaninglessly appears in the diagram.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Updating Diagram Appearance After Deletion from Model
« Reply #1 on: December 31, 2016, 03:45:26 am »
Use Repository.ReloadDiagram (long DiagramID) or Repository.RefreshOpenDiagrams (boolean FullReload)

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Updating Diagram Appearance After Deletion from Model
« Reply #2 on: September 11, 2018, 08:37:18 pm »
FYI -  when an add-in is responding to a 'EA_OnPostNewConnector' event, calling either of these causes EA to crash. Unless anyone knows how to delete the connector which just got passed by EA.
Probably not a big surprise, I guess - deleting the subject of the event probably isn't what EA was expecting to happen.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Updating Diagram Appearance After Deletion from Model
« Reply #3 on: September 11, 2018, 09:39:14 pm »
@Ian, therefor you have a PRE operation...

q.

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Updating Diagram Appearance After Deletion from Model
« Reply #4 on: September 17, 2018, 07:57:59 pm »
Ah - so that's what those are for.
Pure genius, as always Q.
Thanks
Ian
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com