Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: RainerQ on November 06, 2010, 12:10:44 am
-
Hi
I would like to move a couple of diagram objects on a diagram
My attempt to do so looks as follows:
private static void MakeRoom(Diagram diagram, Rectangle rect)
{
DiagramObject[] objectsToMove = (from DiagramObject dgobj in diagram.DiagramObjects
where dgobj.left < rect.Right
select dgobj).ToArray();
foreach (DiagramObject dgObject in objectsToMove)
{
dgObject.top -= rect.Height + 10;
dgObject.bottom -= rect.Height + 10;
dgObject.Update();
}
diagram.Update();
}
In my case I receive 3 diagram object as a result of the LINQ statement, but changing top and buttom properties of them does not result in a move on the diagram.
What is wrong with my code?
Thanks for help and hints.
Regards
Rainer
-
do you reload the diagram?
like this:
repository.ReloadDiagram(actDiag.DiagramID);
stao
-
Hi Stao,
thanks for the hint. That was it.
Regards
Rainer
-
The dependancy on reloading the diagram to see the changes made to diagram objects should hopefully be removed in the next major release. Diagram Objects will have their style and position automatically applied in the UI when Update() is called on the DiagramObject object.
-
That would be a nice improvement.
Geert
-
Yes, that would be great!
Regards
Rainer