Unwanted rotation of a shape

Hello,
i have a mastershape consisting of several shapes.
If i drop this mastershape out of the vssx-file to a page by visio everything looks good.

But if i drop this mastershape to a page by aspose.diagram it is rotated 90 degrees counterclockwise.

To give you an example, I have stripped down the master shape so that not much remains. I can’t explain this behaviour. In my opinion, there are no complex Visio properties that could cause problems for the interface.

I’ve attached my vssx-file. Can you tell me why the shape is suddenly displayed rotated?

Diagram diagram = new Diagram();

string EG23 = "WhyRotated";
diagram.AddMaster("UnwantedRotated.vssx", EG23);

Aspose.Diagram.Page newPage = new Aspose.Diagram.Page();
newPage.Name = "My Page";

// Set Page to A4
int PageWidth = 210;
int PageHeight = 297;
DoubleValue PageWithMeasured = new DoubleValue(PageWidth, MeasureConst.MM);
DoubleValue PageHeightMeasured = new DoubleValue(PageHeight, MeasureConst.MM);
newPage.PageSheet.PageProps.PageWidth.Value = PageWithMeasured.Value; //8.27; // A4 Width
newPage.PageSheet.PageProps.PageHeight.Value = PageHeightMeasured.Value; //11.69; // A4 Height
newPage.PageSheet.PrintProps.PrintPageOrientation.Value = PrintPageOrientationValue.Portrait;
diagram.Pages.Add(newPage);

newPage.AddShape(0, 0, EG23);

// Shapes position center
foreach (Aspose.Diagram.Shape shape in newPage.Shapes)
{
	shape.XForm.PinX.Value = newPage.PageSheet.PageProps.PageWidth.Value / 2;
	shape.XForm.PinY.Value = newPage.PageSheet.PageProps.PageHeight.Value / 2;
}

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

UnwantedRotated.zip (41,9 KB)

@sgruth

It sounds like you’re experiencing an issue with the rotation of a master shape when using Aspose.Diagram. This can occur due to various reasons, such as properties set in the Visio file or how the shape is being added to the page.

Cause: The rotation issue may stem from existing rotation properties in the Visio file or incorrect settings during the shape’s addition to the page.

Solution: Here are some steps to troubleshoot and resolve the issue:

  1. Check Shape Properties: Ensure that the master shape does not have any rotation properties set in the Visio file that might affect its orientation when added through Aspose.

  2. Set Angle Manually: After adding the shape to the page, explicitly set the angle to 0 degrees to correct any unwanted rotation. You can do this using the SetAngle method of the Shape class. For example:

    shape.SetAngle(0); // Set the angle to 0 degrees
    
  3. Verify Page Orientation: Ensure that the page orientation and size are correctly set before adding the shape. Mismatched dimensions can lead to unexpected behavior.

  4. Test with Different Shapes: Try adding a different shape from the same master or a simple shape to see if the issue persists. This can help determine if the problem is specific to the master shape.

  5. Update Aspose.Diagram: Make sure you are using the latest version of Aspose.Diagram, as updates may include bug fixes related to shape handling.

Next Steps: If you follow these steps and the issue persists, please provide additional details about the master shape’s properties or any specific settings you are using.

Let me know if this resolves your issue!

Please, dear AI, refer to my specific question and my VSSX file. Otherwise, ask @philip.zhou he will certainly know where the problem lies.

One more thing caught my attention. The master shape has several layers. After I insert the shape into a page and save it as Vsdx, the layers are no longer there.
I haven’t noticed this when using other shapes. Why is that?

@sgruth
Thanks for the template file and sample codes.
We reproduced the problems you mentioned .
We found an issue with rotation of the shape and the issue of losting the layers.

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-53790,DIAGRAMNET-53791

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