Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Eric Johannsen on May 06, 2007, 09:01:34 pm
-
I pulled my hair out for a bit on this one, so thought I would share the solution in case anyone else runs into the problem.
I'm creating a new diagram through automation, and found that all of the new DiagramObjects I was creating ended up in the upper-left corner of the diagram rather than where I tried to position them.
Here's a code fragment to illustrate the issue:
string position="l=0;r=100;t=200;b=300;"
EA.DiagramObject diagObj = (EA.DiagramObject)diagram.DiagramObjects.AddNew(position, "");
diagObj.ElementID = elem.ElementID;
diagObj.Update();
The PROBLEM was that I was positioning the left edge of my DiagramObject at zero (l=0). Apparently the diagram starts at one (l=1) and passing a left coordinate of zero causes the positioning information to be ignored entirely.
To solve the positioning problem, use a left coordinate of at least one.
Eric
http://canoniccorp.com