Visio Discussions > ShapeSheet & Smart Shapes

Rotate a group of Shapes


I have a group of shapes that I have formulas for PINX and PINY. When i size or move the group my formulas work just fine.
When I rotate the group however, some of the formulas do not work.
Is there a way to calculate a new x and y coordinates based on the original coordinates using a formula for the angle of rotation?


Visio Guy:
Hi Mike,

What kind of formulas? Maybe post a few here so we can help.

But 'til then, I'll take a whack...

A typical formula to get a sub-shape to remain level when the group is rotated looks like this:

     Angle = -Sheet.5!Angle

where "Sheet.5" is the group.

More advanced, to handle horizontal and vertical flips of the group looks like this:

     Angle = IF( BITXOR( Sheet.5!FlipX, Sheet.5!FlipY ), Angle, -Angle )

Its not really obvious why, but it works, even when the group gets flipped!

Other functions related to transforming one shape's coordinates to another, which can be useful for shapes inside of groups include:

You can read more about these functions in the Developer Help or in the really nice help file that ships with the Visio 2007 SDK

Thanks for the reply.
I do want all the shapes to rotate.
Here is a formula in the pinx cell of a shape.

Also this one in the piny cell

This works great when the selected group of shapes is moved or resized but does not correctly calculate when it is rotated.

The values appear to be off by some calculation of the angle.

Visio Guy:
Do you have a formula in the Angle cells as well? You won't get any rotation from PinX/PinY :)

I selected all the shapes and then grouped them. This automatically fixed most of the rotation issues because of group inheritance.

After the group is  rotated and I insert shapes and then add them to the group thru the code in the CALLTHIS function, I had to set the angle of the inserted shape to =guard(0) and the rotation using group handles work just fine. Also the flip functions from the menu work fine on the group.

Hope that makes sense ???



[0] Message Index

Go to full version