Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bizna

Pages: [1]
1
Bugs and Issues / ArcGIS xml export has duplicate attributes - EA 16 beta
« on: December 03, 2021, 02:04:54 pm »
When I export my ArcGIS model to XML, it contains duplicate attributes (aka Fields in ArcGIS).  When I import this XML schema into an ArcGIS geodatabase, it creates the duplicated fields with the name plus an "_1" appended at the end of the name. I suppose I could revert back to the EA version 15.2, but I've made a bunch of progress on my model in v16.0 and would like to carry on with it.  I suppose I should log a bug report with EA, and in the meantime maybe I'll try to find a way to remove the duplicate entries in the .XML file.  If anyone knows of a better way to fix this, please let me know.

2
Hi Q,

Thanks for the suggestion, I tried it out like so:
Code: [Select]
                    string addNewString = "l=0;r=0;t=0;b=0;";
                    EA.DiagramObject diagram_object = diagram.DiagramObjects.AddNew(addNewString, "");
                    diagram_object.ElementID = el.ElementID;
                    diagram_object.Update();
                    Repository.ReloadDiagram(diagram.DiagramID);
                    Debug.WriteLine(diagram_object.right); // returns zero, not a positive number

Unfortunately, it still gives a zero.  Yes, I'm using version 14.1.1427.  So perhaps this is just a bug.

I will change the add-in so that it requires the diagram objects to be created ahead of time, and just does the repositioning I'm after.

thanks Geert and Q for your assistance.
Jason

3
Hi Geert,

Thanks for your response.  I've tried to add the position arguments as you've shown in your code. So now I have this, but the 'right'
property is still returning zero:

Code: [Select]
                    string addNewString = "l=0;r=0;t=0;b=0;";
                    EA.DiagramObject diagram_object = diagram.DiagramObjects.AddNew(addNewString, "");
                    diagram_object.ElementID = el.ElementID;
                    diagram_object.Update();
                    Debug.WriteLine(diagram_object.right); // still shows zero!

Am I missing something else in my translation from your example to my code?
Thanks
Jason

4
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:
Code: [Select]
            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

5
Hi Geert,

Yes, I've tried reloading the diagram.  Out of desperation,I've also tried a few combinations of the following lines of code, none of which work:

            diagram.DiagramObjects.Refresh();
            Repository.SaveDiagram(diagramID);
            Repository.RefreshModelView(0);
            Repository.ReloadDiagram(diagramID);
            Repository.RefreshOpenDiagrams(true);
            diagram = Repository.GetDiagramByID(diagramID);

I've also tried retrieving the diagram like this, just in case it is somehow different:

            diagram = Repository.GetCurrentDiagram();

thanks,
Jason

6
hello, I'm writing an add-in using c# that adds new "DiagramObjects" to the active diagram, then re positions them in alphabetical order.  The trouble I'm having is that the diagram object's Top, Bottom, Left, and Right properties are all showing up as zero when I try to reposition them.  If I run only the code that creates the diagram objects on the diagram, then shut down EA and run the code that re-positions the diagram objects, the Top, Bottom, Left, and Right properties show up with their proper, non-zero values and the code is able to work as expected.  While I could simply write two add-ins to achieve this, I wonder if I need to.  I have tried inserting all sorts of diagram.Update() and diagram.Refresh statements, to no avail.

Here is the code where I create the diagram object:

                    EA.DiagramObject diagram_object = diagram.DiagramObjects.AddNew("", "");
                    diagram_object.ElementID = el.ElementID;
                    diagram_object.Update();
                    diagram.Update();

I am purposely leaving out any position arguments, as I want EA to create the initial size of the diagram object for me.

Later in the code, I retrieve the diagram object, like so:

                EA.DiagramObject diagram_object = diagram.GetDiagramObjectByID(diagram_object_ID, null);

Then try to access it's position properties, e.g. diagram_object.bottom, but the values are all zero.

Does anyone know what I should do to be able to retrieve the values as expected?

Pages: [1]