To change bounds for the existing com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement, use the method com.nomagic.magicdraw.openapi.uml.PresentationElementsManager.reshapeShapeElement(ShapeElement, java.awt.Rectangle):

    ShapeElement element = ...;
    Rectangle newBounds = new Rectangle(100,100,80,50);
    SessionManager.getInstance().createSession("Test");
    PresentationElementsManager.getInstance().reshapeShapeElement(element, newBounds);
    SessionManager.getInstance().closeSession();
Every shape element has a preferred size. The shape size cannot be smaller than the preferred size. If you will try to set smaller bounds, these bounds will be increased to the preferred size.

If shape has the Autosize property set to TRUE, bounds will be reduced to the preferred size.

Related pages