Free Support Forum - aspose.com

Recalculating shape sizes

I’m currently evaluating Aspose Diagram to replace a large Visio Automation solution with a solution that does not require Visio to run.
What I can’t figure out is if your product supports recalculating the diagram pages. Our solution contains group shapes that change their size and the positions of connection points in accordance to shape properties being set and we require the correct sizes and positions after those changes to place the next shape in relation to the previous one (a technical diagram where parts need to fit).
The search function on your website and forum did not return any results on manually triggering a recalculation. A simple test with your current code did not update results of formulas in a group shape. Is this supported by your product?

@IRRDC

Thanks for contacting support.

Would you kindly share a sample diagram file along with sample code snippet that you have tried so far. We will further test the scenario in our environment and address it accordingly.

Here is my test file and my test code. Please bear in mind that this test scenario is very simplified and does not reach the complexity our solution requires. The test file contains a group shape that has a property that, when set to true, moves one of the group shapes to the right. The code checks the position of the group shape, sets the property, and checks the position again. The value of PinX does not change during the test.

DrawBezierInPage.zip (9.0 KB)

Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(@"DrawBezierInPage.vsdx");
Aspose.Diagram.Shape shape = diagram.Pages[0].Shapes[1];
String s = $"PinX: {shape.Shapes[0].XForm.PinX.Value} & {shape.Shapes[1].XForm.PinX.Value}{Environment.NewLine}";
shape.Props[0].Value.Ufev.F = "true";
s += $"PinX: {shape.Shapes[0].XForm.PinX.Value} & {shape.Shapes[1].XForm.PinX.Value}{Environment.NewLine}";

@IRRDC

Thanks for providing additional details.

We have logged an investigation ticket as DIAGRAMNET-51756 in our issue tracking system for your requirements and issue you are facing. We will further look into details of this scenario and keep you posted with the status of ticket resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.

@IRRDC

We have investigated the ticket and found that there was no formula in the source file of the shape position. Would you please try method “shape.RefreshData()” to recalculate shape size. OR you may please share correct template file in case suggested method does not help. We will again investigate the scenario and address it accordingly.

@asad.ali I tried RefreshData(). The values did not update but the formula was removed from the subshape.

I used the attached file (the formula can be found in PinX of the subshape containing the text "C"DrawBezierInPage.zip (9.7 KB)
) and this code:
Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(@“DrawBezierInPage.vsdx”);

    Aspose.Diagram.Shape shape = diagram.Pages[0].Shapes[0];

    String s = $"PinX of {shape.Shapes[0].Text.Value.Text}: {shape.Shapes[0].XForm.PinX.Value} & of {shape.Shapes[1].Text.Value.Text} {shape.Shapes[1].XForm.PinX.Value} [BEFORE PROP CHANGE]{Environment.NewLine}";

    shape.Props[0].Value.Ufev.F = "true";
    shape.RefreshData();

    s += $"PinX of {shape.Shapes[0].Text.Value.Text}: {shape.Shapes[0].XForm.PinX.Value} & of {shape.Shapes[1].Text.Value.Text} {shape.Shapes[1].XForm.PinX.Value} [AFTER PROP CHANGE]";

    this.label1.Text = s;

    // Save diagram
    diagram.Save(@"C:\users\jk\desktop\DrawBezierInPage.vsdx", Aspose.Diagram.SaveFileFormat.VSDX);

Formulas that get deleted would also be very problematic for our solution.

@IRRDC

Thanks for sharing your feedback.

We will further investigate the ticket based on the information you provided and let you know about our feedback soon.

Can you please give me a timeframe for when I can expect a reply if this is possible or not? I have to tell our customer if migrating to your solution is possible or not.

@IRRDC

Regretfully we cannot provide any reliable ETA at the moment. However, we will surely consider your concerns during ticket investigation. The ticket will surely be resolved on first come first serve basis and as soon as we have some certain news on its resolution, we will share with you. We highly appreciate your patience in this regard. Please spare us some time.

We are sorry for the inconvenience.