Book a Demo

Author Topic: ObjectType, UMLDiagram, and DiagramFrame  (Read 4427 times)

rothnic

  • EA User
  • **
  • Posts: 91
  • Karma: +0/-0
    • View Profile
ObjectType, UMLDiagram, and DiagramFrame
« on: December 13, 2013, 09:18:39 am »
In my EA to PowerPoint script, I set it up so you could organize a single diagram with diagram frames in the way you want your presentation to work. So it gets all diagram objects, and for each in the diagram it checks to see if the diagram objecttype is equal to 19. If I remember correctly, 19 corresponded to the diagram frame type.

I had someone encounter a bug and recently encountered it myself finally and fixed it. I'm not sure, but I think there may be a bug with EA.

99% of the time I have had no issues with it. This time that I encountered the bug, I also encountered strange behavior with the diagram frame. I created a Use Case diagram. The Use Case was added that extended the base use case. The base use case has extension points added, which then showed up in a note-like element as an extension point. These were attached to the extension path.

When I drag the diagram into my "presentation" diagram and show it as a diagram frame, I get an issue was the extension point notes show up within the diagram frame, but also within the actual diagram. So you see a copy of them actually in the diagram which should only have diagram frames as note elements. I found that the script ended up crashing when it tried to get the referenced diagramID using "theFrameElement.MiscData(0)", since the note doesn't have this or it was null. So even though I was checking to see if objectType=19, the note that shouldn't be in the diagram to begin with was getting inside the loop.

Here is the code that ended up fixing the issue:
Code: [Select]
   For Each theDiagramFrame In slides
        ' Get diagram by using diagram frame's reference to diagram id
        If (theDiagramFrame.ObjectType = 19) Then
            Dim theFrameElement As EA.element
            Set theFrameElement = eaConn.getElementByID(theDiagramFrame.ElementID)
            If (theFrameElement.MetaType = "UMLDiagram") Then
                preSortedSlides.Add eaConn.getDiagramByID(theFrameElement.MiscData(0)), CStr(theDiagramFrame.Top)
                ReDim Preserve framePositions(i)
                framePositions(i) = theDiagramFrame.Top
                i = i + 1
            End If
        End If
    Next

Before, I didn't have the most inner If statement to check for the metatype of UMLDiagram.

Another side issue I found is that the random extension point notes that are added to the diagram end up getting added to another separate diagram frame's output diagram that I end up saving, even though they don't actually appear in the diagram. The original exporter tool is available in the community area.