# How do I array shapes in a circle

J

#### JayBird

How do I array shapes in a circle with Visio Professional?

C

#### Chris Roth [ Visio MVP ]

If you are ok with VBA programming, you can use the snippet below. It will
copy a shape and place it in a polar array. It doesn't distribute existing
shapes. Hopefully it will help.

The sample normally lives here: http://www.mvps.org/visio/VBA.htm, if you're
interested in more code samples.

Sub PolarArray()
' by Chris Roth
Dim shp As Visio.Shape, shpObj As Visio.Shape, celObj As Visio.Cell
Dim iNum As Integer, i As Integer
Dim dRad As Double, dAngStart As Double, dAng As Double
Dim x As Double, y As Double

' obtain the shape to be distributed
Set shp = Visio.ActiveWindow.Selection(1)

Const PI = 3.14159265358

iNum = InputBox("Enter the number of items in the array:", "Polar Array")
dRad = InputBox("Enter the radius for the polar array in inches:", "Polar
Array")
dAngStart = InputBox("Enter the first angle in degrees (0 deg = 3
o'clock):", "Polar Array")
dAngStart = dAngStart * PI / 180 'Convert to radians

dAng = 2 * PI / iNum

For i = 1 To iNum
x = dRad * Cos(dAngStart + dAng * (i - 1)) + 4.25
y = dRad * Sin(dAngStart + dAng * (i - 1)) + 5.5
Set shpObj = Visio.ActivePage.Drop(shp, x, y)
shpObj.Text = i
' rotate the shape
Set celObj = shpObj.Cells("Angle")
celObj.Formula = Str(Int((i - 1) * 360 / iNum)) + "deg."
Next i

End Sub

--

Hope this helps,

Chris Roth
Visio MVP

A

#### Al Edlund

Another alternative to Chris' method (I checked this at v2003) is if you're
drawing something similar to a wheel and spoke diagram (i.e. connectors to a
common center node) is to select shapes => layout shapes from the menu.
Al