Some shapes are stretched

Hello,
i have a mastershape consisting of several hundred shapes.
If i drop this mastershape out of the vssx-file to a page by visio everything looks good. Even when I insert this master shape into a page using Microsoft.Office.Interop.Visio, it looks fine.

But if i drop this mastershape to a page by aspose.diagram some of the containing shapes are shown streched out. I haven’t noticed this behaviour with any of my other master shapes.

To give you an example, I have stripped down the master shape so that only the problematic shapes remain.

I’ve attached my vssx-file. Can you tell me why the shape looks normal in Visio when I add it to the page, but looks stretched when using Aspose.Diagram?

Diagram diagram = new Diagram();
diagram.AddMaster("test_master.vssx", "test");

Aspose.Diagram.Master master = diagram.Masters.GetMasterByName("test");
Aspose.Diagram.Page newPage = new Aspose.Diagram.Page();
newPage.Name = "MasterTestPage";

int PageWidth = 210; //mm
int PageHeight = 297; //mm

DoubleValue PageWithMeasured = new DoubleValue(PageWidth, MeasureConst.MM);
DoubleValue PageHeightMeasured = new DoubleValue(PageHeight, MeasureConst.MM);

newPage.PageSheet.PageProps.PageWidth.Value = PageWithMeasured.Value; 
newPage.PageSheet.PageProps.PageHeight.Value = PageHeightMeasured.Value; 

newPage.PageSheet.PrintProps.PrintPageOrientation.Value = PrintPageOrientationValue.Portrait;
diagram.Pages.Add(newPage);

long shapeId = newPage.AddShape(0, 0, "test");

// Position the form centrally
Aspose.Diagram.Shape masterShape = newPage.Shapes.GetShape(shapeId);
masterShape.XForm.PinX.Value = newPage.PageSheet.PageProps.PageWidth.Value / 2;
masterShape.XForm.PinY.Value = newPage.PageSheet.PageProps.PageHeight.Value / 2;

diagram.Save("mastertest.vsdx", SaveFileFormat.Vsdx);

test_master.zip (13,4 KB)

@sgruth

Hello,

Thank you for providing detailed information about your issue. It seems there might be a discrepancy between how Aspose.Diagram and Microsoft Visio handle the rendering of certain shapes.

Troubleshooting Steps

  1. Check Shape Data:
    Ensure that the shape data in your master shape is correctly configured. Sometimes, missing or incorrect shape data can cause rendering issues.

  2. Examine Shape Transformation:
    Double-check the transformation properties (XForm) of the shapes within your master shape. There might be a discrepancy in how Aspose.Diagram handles these properties compared to Visio.

  3. Review Master Shape Settings:
    Verify that the master shape settings, such as pins and controls, are correctly defined and do not have any anomalies.

Example Code Review

Here is a refined version of your code to ensure that it is correctly setting up the master shape and adding it to the page:

Diagram diagram = new Diagram();
diagram.AddMaster("test_master.vssx", "test");

Aspose.Diagram.Master master = diagram.Masters.GetMasterByName("test");
Aspose.Diagram.Page newPage = new Aspose.Diagram.Page();
newPage.Name = "MasterTestPage";

int pageWidth = 210; // mm
int pageHeight = 297; // mm

DoubleValue pageWidthMeasured = new DoubleValue(pageWidth, MeasureConst.MM);
DoubleValue pageHeightMeasured = new DoubleValue(pageHeight, MeasureConst.MM);

newPage.PageSheet.PageProps.PageWidth.Value = pageWidthMeasured.Value;
newPage.PageSheet.PageProps.PageHeight.Value = pageHeightMeasured.Value;

newPage.PageSheet.PrintProps.PrintPageOrientation.Value = PrintPageOrientationValue.Portrait;
diagram.Pages.Add(newPage);

long shapeId = newPage.AddShape(0, 0, "test");

// Position the form centrally
Aspose.Diagram.Shape masterShape = newPage.Shapes.GetShape(shapeId);
masterShape.XForm.PinX.Value = newPage.PageSheet.PageProps.PageWidth.Value / 2;
masterShape.XForm.PinY.Value = newPage.PageSheet.PageProps.PageHeight.Value / 2;

diagram.Save("mastertest.vsdx", SaveFileFormat.Vsdx);

Additional Resources

For further troubleshooting, you may refer to the following Aspose.Diagram documentation resources:

If the issue persists, please provide more details about the shape properties and any specific configurations that might be affecting the rendering. This will help us provide a more accurate solution.

Best regards,
[Your Name]
Aspose Technical Support

This answer doesn’t help me.
What does the expert @philip.zhou say about this?

in meantime i’ve tested some things. I now know where the interface is causing the problem.

For example, with the shape named Endklemme.9988

In the shapesheet at Shape Transform at Height there is the formula:

=GUARD(IF(Actions.UK4.Checked,(9.5/7 mm),(5.2/7 mm)))

As far as I have tested, the interface has a problem with division. If I omit the division and enter the numbers directly, it works:

=GUARD(IF(Actions.UK4.Checked,(1.3571 mm),(0.7428 mm)))

However, I cannot adapt all my shapes to this phenomenon. That would be several thousand shapes.

Is there another way to solve the problem?

regards
Steve

@sgruth
Thank you for providing the file and pointing out the issue.
We reproduced the problems you mentioned by running the sample code.
There is an issue with the formula parsing .We will evaluate your issue further.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53787

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as DIAGRAMNET-53787) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou