1
Automation Interface, Add-Ins and Tools / Unknown element in DiagramObjects
« on: December 17, 2020, 03:54:55 am »
Hi Specialists!
In my addin I'm facing a behaviour which I can't explain.
I'm iterating the DiagramObjects of a diagram and then for each DiagramObject I try to retrieve the related Element from the repository using the GetElementByID(ElementID)-Function of the Repository class to get further information about the element. The diagram is of course in the same repository.
This works very well for many diagrams but in one diagram the GetElementByID-Function throws an exception saying that it could not find the element ("Can't find matching ID"). The ObjectType is - of course - otDiagramObject and the GetType-Function of the DiagramObject class tells me it is a System_ComObject. The user (I don't have access to the EA project myself) searched the diagram and it's Elements and could not find any COM object. Re-saving the diagram (after a slight change) did not change anything. When he exports the package and imports it into a new project, the error is gone.
So I have the following questions (and hope for answers
):
1. Can anyone explain this behaviour?
2. How can I find out which element is causing the error?
3. Why is the error persistant over re-saving but disappears after exporting and re-importing into another project?
Question 2 is the most important one which I need an answer for. The others are for my curiosity
Thanks in advance,
Jörg
In my addin I'm facing a behaviour which I can't explain.
I'm iterating the DiagramObjects of a diagram and then for each DiagramObject I try to retrieve the related Element from the repository using the GetElementByID(ElementID)-Function of the Repository class to get further information about the element. The diagram is of course in the same repository.
This works very well for many diagrams but in one diagram the GetElementByID-Function throws an exception saying that it could not find the element ("Can't find matching ID"). The ObjectType is - of course - otDiagramObject and the GetType-Function of the DiagramObject class tells me it is a System_ComObject. The user (I don't have access to the EA project myself) searched the diagram and it's Elements and could not find any COM object. Re-saving the diagram (after a slight change) did not change anything. When he exports the package and imports it into a new project, the error is gone.
So I have the following questions (and hope for answers

1. Can anyone explain this behaviour?
2. How can I find out which element is causing the error?
3. Why is the error persistant over re-saving but disappears after exporting and re-importing into another project?
Question 2 is the most important one which I need an answer for. The others are for my curiosity
Thanks in advance,
Jörg