Shape rotation setting is not saved when setting shape to a stencil

Good day, everyone!

Please see the short code snippet I uploaded.
This program draws one rectangle “Switch” and two rectangles: “Port1” and “Port2”. “Ports” are 90 deg. rotated.

_port1Shape.SetAngle(1.5708);

When you launch the program you will see in the generated file the correct result: both port shapes are properly rotated.
The problem comes when I try to place the complex shape to a stencil. After pasted to a stencil one of the ports throws away rotation settings and returns to the horizontal position. It happens with Port2 which was drawn with with AddShape from the Master shape. Port1 was drawn with DrawRectangle method and its rotation setting retains.

I can stand with DrawRectangle variant but using standard shape from BASIC_M.VSSX is better for me because it already includes standard connection points. Can you solve this bug?
Shape_SetAngle_Problem.zip (713 Bytes)

@Viktor1983
Thanks for providing us the sample code.
Could you please also share the template file (“BASIC_M.VSSX”).
When we add shapes using our own template file (Basic Shapes.vssx), we did not find this issue.
Thanks.

Yes, sure.
BASIC_M.ZIP (108.5 KB)

@Viktor1983
Thanks for the template vssx file.
We generated the output file using the entire code and template file, as you mentioned. As you said, the two shapes in the output file appear normal. However, when we manually copy and paste many shapes into this file using MS Visio, we still cannot find the issue you described. Could you please provide a more detailed description with “The problem comes when I try to place the complex shape to a stencil.” or share some screenshots to help us understand the problem better?
Thanks.

To fill my custom stencil I use simple “copy” and “paste”.

  1. Open the generated .vsdx.
  2. Select all elements (3 rectangles).
  3. Copy to clipboard.
  4. Open my custom MyStensils.vssx.
  5. Paste the clipboard to the file.
  6. I see a new object is added to the list of miniature drawings. And already on this drawing I see that one of the rectangles is rotated back to its default horizontal position.
  7. When I copy this shape from the stencil file by copy-paste or programmatically and paste it to a new .vsdx document I see the incorrect rotation angle on that rectangle.

@Viktor1983
Thanks for the detail.
We could find this issue when adding these shape to the master.
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-53169

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.

I have found one more related thing. When I paste from my custom master shape a complex shape where single shapes have been drown with “DrawRectangle” they retain their positions. But the shape metadata, as I see, indicates it has not been rotated. The screen ‘original’ shows the program result. My algorithm orders the straight line to start from the top side of the “LOG2” rectangle. But we see that the coordinates of the start point were calculated as if “LOG2” had not been rotated. In “manually roatated” is the layout after my manual rotation. So it seems that if a shape is taken from a stencil it retains the original shape visual but loses the shape actual rotation condition. It concernes the case when the original child shape was made with DrawRectangle. If the original child shape was made with AddShape, in the complex shape taken from a custom stencil loses both visual and rotation state.
manual_rotated.png (4.2 KB)
original.png (3.4 KB)

@Viktor1983
This appears to be the same issue that shape loses the rotation state caused by the same source.
We will look into your issue further soon.

Thanks.

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

Hi, Philip!

Now I see that shapes retain rotation status when added to a stencil. But the second issue I mentioned has not been resolved. Connector is still connected to an empty space as if the shape has not been rotated.shapes_initial.png (3.6 KB) The idea on the layout shown on the snippet was to connect two connectors to the right connection points (ID = 1) on rectangles ‘Ge-1’ and ‘Ge-2’. Connectors connect to places where right sides of these two shapes shoud have been if shapes were not rotated.

When I ungroup the complex shape (all rectangles are united to a group) I see the following picture: shapes_after_ungroup.png (3.5 KB). All rectangles drawn with AddShape (all 4 port shapes) lose border lines. The ‘chassis’ rectangle retains borders because it was drawn with DrawRectangle. I do not see a way to manually restore port shapes borders. Also both connectors lost connections even to intitial places.
Please, support.

@Viktor1983
Thanks for the screenshots.
We are sorry that we could not find the fragment of adding connector in the previous code, Please provide the above complete code.
We will evaluate your issue further and get back to you.
Thanks.

Hi!

I checked it better and found that I had not removed some hardcode that was placed initially when I found the bug. Now shapes both rotate and move connection corrdinates. Thank you.

@Viktor1983
It’s good to know that your issue is sorted out now.
Please feel free to contact us in case you have further comments or questions.
Thanks.