Solved

Visio 2013 - How to find the exact center of a shape.

Posted on 2014-03-21
3
1,540 Views
1 Endorsement
Last Modified: 2014-04-08
I have a odd shaped polygon which I would like to create a connection point in the center of.  I'm looking for any tips and tricks for quickly finding the center of the shape.
1
Comment
Question by:brothertruffle880
3 Comments
 
LVL 7

Accepted Solution

by:
XGIS earned 167 total points
Comment Utility
Hello brothertruffle880,
Please find attached a sample of achieving the goal using some different techniques.  The centre you are referring to is generally predefined for "regular" shapes. Irregular shapes may not have a "centre", but rather a centroid.  By using the "Text Block" on the ribbon bar under HOME | TOOLS you can identify the centroid which will either be IN or OUT of the free-form polygon.   The feature is also a line and not a proper polygon although it can appear to be a fully closed polygon.

The workaround here is to create some very small ellipse features exactly where you want the centre to be represented.  Join your features with 2 or more connectors.  Straight connectors can often be less confusing than angled ones. Then just set the line of the ellipses (fake centres) to "No Colour".  

You may also find some settings under "File | Options | Advanced" that will help with Free-Form construction.    You can also modify "Snap and Glue" settings under the "View | Visual Aids" ribbon.

Hope this helps. No magic but it will achieve your goal.  I would "group" the items after the task is complete to prevent separation.     Cheers Aaron
VisioSnapNGlueSettings.PNG
Visio2013FreeformConnectorSample.txt
0
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 167 total points
Comment Utility
Hi,

to find the centroid of the selected polygon pls try

Sub Macro()
Dim ArrCoord() As Variant
Set s = Selection
CoordCount = s.ShapeRange.Nodes.Count
ReDim ArrCoord(1, CoordCount - 1)
For Each Nde In s.ShapeRange.Nodes
    pts = Nde.Points
    ArrCoord(0, Idx) = pts(1, 1)
    ArrCoord(1, Idx) = pts(1, 2)
    Idx = Idx + 1
Next

For Idx = 0 To UBound(ArrCoord, 2) - 1
            area = area + _
            (ArrCoord(0, Idx + 1) - ArrCoord(0, Idx)) * _
            (ArrCoord(1, Idx + 1) + ArrCoord(1, Idx)) / 2
Next

area = Abs(area)
X = 0
Y = 0
For Idx = 0 To UBound(ArrCoord, 2) - 1
    second_factor = _
        ArrCoord(0, Idx) * ArrCoord(1, Idx + 1) - _
        ArrCoord(0, Idx + 1) * ArrCoord(1, Idx)
    X = X + (ArrCoord(0, Idx) + ArrCoord(0, Idx + 1)) * _
        second_factor
    Y = Y + (ArrCoord(1, Idx) + ArrCoord(1, Idx + 1)) * _
        second_factor
Next

X = X / 6 / area
Y = Y / 6 / area
If X < 0 Then
    X = Abs(X)
    Y = Abs(Y)
End If
MsgBox "Coordinates of the barycenter are X: " & X & "and Y: " & Y
End Sub

Open in new window

Regards
0
 
LVL 30

Assisted Solution

by:Scott Helmers
Scott Helmers earned 166 total points
Comment Utility
The explanations above are great for finding the mathematical center of a shape. There is a simpler approach if you want to use the default location that Visio uses as the center of rotation for a shape: it's at width*0.5 and height*0.5 for the rectangle that contains the shape.

Consequently, the "center" of your irregular polygon is at that location and Visio stores these coordinates in two cells in the Shape Transform section of the shapesheet: LocPinX and LocPinY. If you look at them you will probably see values of Width*0.5 and Height*0.5, respectively.

To create a connection point at that location:

If your shape already has a Connection Points section, add a new row; if not right-click in the shapesheet, select Insert Section, select Connection Points, and then click OK.

In the desired Connection Points row, set X to LocPinX and set Y to LocPinY.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

The Question Several times in recent years, someone has posted a question at EE asking whether they could display the Windows directory structure – folders and subfolders – using Visio. When one person specifically asked about displaying directory …
Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now