4
« on: January 18, 2019, 05:18:05 am »
Hi Q,
I know it looks like I threw everything at it but the kitchen sink! I added lines incrementally as I was attempting to have the diagram object return the position properties I expected.
Regarding your first point, although the documentation says the second parameter for diagram.GetDiagramObjectByID, the DUID, is optional, visual studio was insisting it was required, so I used null to satisfy visual studio.
this code: diagram.DiagramObjects.Refresh();
Repository.SaveDiagram(diagramID);
Repository.RefreshModelView(0);
Repository.ReloadDiagram(diagramID);
Repository.RefreshOpenDiagrams(true);
diagram = Repository.GetDiagramByID(diagramID);
... comes after creating the diagram objects. The only reason I'm trying all this refreshing, saving, and reloading is to attempt to have the diagram objects return non-zero position (top, bottom, left, right) properties.
When I create the diagram objects, I don't supply any position information. This results in them all being situated in the top left of the diagram, overlapping each other. What they do have at this point is non-zero position values, as evidenced by their placement on the diagram, and, if I look at them in the t_diagramobjects table by opening the .eapx file in MS Access, I can see that they have non-zero values in the RectTop, RectBottom, RectLeft, RectRight fields.
... So my question is, how can you add a diagram object in a diagram (supplying no coordinate information), then retrieve the coordinate information that EA somehow generates?
Jason