Broken diagram when using master with multiple shapes

I’m evaluating Aspose.Diagram for Dotnet since I’m creating an app to generate Visio files. While testing I stumbles upon one problem with master shapes and would like to know, what I do wrong or where the problem could be.

I checked out the project GitHub - aspose-diagram/Aspose.Diagram-for-.NET: Aspose.Diagram for .NET examples, plugins and showcase projects and called Aspose.Diagram.Examples.CSharp.Working_Shapes.AddingNewShape.Run() in the Aspose.Diagram.Examples.CSharp.RunExamples class.

This created successfully the file AddShape_out.vsdx which looks like this:
1_WorkingVsdx.jpg (190.5 KB)

The shape has the following ShapeSheet data:
2_WorkingShapeSheet.jpg (358.3 KB)

Now I changed the master shape “Rectangle” in the file Basic Shapes.vss and added a circle to it which is inside the rectangle:
3_EditMasterShape.jpg (117.4 KB)

When I now generate the AddShape_out.vsdx file again, it looks like this:
4_BrokenVsdx.jpg (181.9 KB)

As you can see, there is no “Created with Evaluation version of Aspose.Diagram (c).” text anymore. Also, there are two rectangles even though I only added one shape.

Another difference can be seen in the ShapeSheet data, there is a new group:
5_BrokenShapeSheet.jpg (387.4 KB)

I reproduced this problem in the example code because originally I was working with a more complex master with many shapes and more geometries. After Aspose generated a diagram with that master, all shapes were distorted and broken.

To me it seems like if there is more than one shape in a master, when Aspose uses this master it breaks somehow and produces unexpected results.

@codingmicha

It seems you are encountering issues with master shapes in Aspose.Diagram for .NET, particularly when modifying a master shape that contains multiple shapes. Here are some steps and considerations that might help you troubleshoot the problem:

  1. Master Shape Modification: When you modify a master shape (like adding a circle inside a rectangle), ensure that the new shape’s properties and geometry are correctly defined. Sometimes, if the new shape’s properties are not set properly, it can lead to unexpected results when the master is used.

  2. Shape Grouping: The appearance of a new group in the ShapeSheet data suggests that the shapes may be getting grouped together when the master is applied. This can happen if the master shape is not properly configured. Check the grouping settings in your master shape to ensure they are as intended.

  3. Shape Distortion: If you notice that shapes are distorted or duplicated, it may be due to how the shapes are being added or how the master is being applied. Make sure that the coordinates and dimensions of the shapes are set correctly when you add them to the diagram.

  4. Testing with Simple Shapes: To isolate the issue, try creating a simpler master shape with just one or two basic shapes. If this works correctly, gradually add complexity to identify what specifically causes the problem.

  5. Review Example Code: The example code you referenced demonstrates how to add a shape to a diagram. Ensure that your implementation follows a similar structure, especially in how you handle the master shapes and their properties.

  6. Consult Documentation and Community: If the problem persists, consider checking the Aspose documentation for any specific notes on using master shapes. Additionally, engaging with the community on forums may provide insights from others who have faced similar issues.

If you continue to experience difficulties, please provide more details about the specific modifications you made to the master shape and any error messages or unexpected behaviors you observe.

Sources:
[1]: AddingNewShape.cs

@codingmicha
Thanks for the screenshots.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file. I found there’s additional shape in the output file.

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-53667

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.

Thanks a lot for looking into it, much appreciated!

@codingmicha
You are welcome.Please feel free to contact us if you have any further queries or comments. We’ll be happy to assist you soon.

1 Like

@philip.zhou
I have investigated further and can add the following insights:

In my previous report, I used Aspose to add a new instance of a master with multiple shapes, which is then broken. I discovered that there is the same behavior when calling .RefreshData() on an existing instance which references a master. So what I did was:

  1. In Visio, create a new diagram and add a master
  2. Add an instance of that master on the drawing pane
  3. Save as input.vsdx file
  4. Execute the following Dotnet code with Aspose:
var diagram = new Diagram("input.vsdx");
diagram.Pages[0].Shapes[0].RefreshData();
diagram.Save("output.vsdx", SaveFileFormat.Vsdx);
  • If the master has only one shape, everything is fine (also the text “Created with Evaluation version of Aspose.Diagram (c).” is visible).
  • But if the master has more than one shape, then the text “Created with Evaluation version of Aspose.Diagram (c).” is not visible which indicates that something went wrong.

@codingmicha
Thank you for additional information.
We will evaluate your issue further.
Thanks.

@codingmicha
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-53669

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-53667,DIAGRAMNET-53669) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou