Center Shape to Page

Started by gnulab, June 30, 2020, 06:32:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gnulab

Hi fellow members,

I'm a newcomer to Visio software.

A quick question, how do I center a shape or a group of shapes relative to the page?

I can align 2 or more shapes, that is simple enough. But, how do I center a shape relative to the page? Or say aligning a group to the center of the page.

I searched this forum and the nearest answer is this http://visguy.com/vgforum/index.php?topic=2730.msg11713#msg11713.

That seems tedious to use ShapeSheet. Please tell me I am missing a button in order to achieve that.


Thank you.

Yacine

My first thought was "what a silly question", but at a 2nd glance, yes there is no such tool in Visio.

Inkscape offers a check box where you can choose to align between shapes or relatively to the page.

So here some ideas:
If your drawing has no other shape than the one you want to center, you can use the "center drawing" function. You'll need to dig out of the ribbon customization functions.

If you have several shapes to center, you need to group them first in order to retain the distances between them. You can ungroup them after the centering.

For the centering operation itself - 2 options.

Use the size and position window and knowing the size of the page - eg 420 x 297 mm (DIN A3) - type in the x field 420/2 and accordingly in y: 297/2

Or draw a diagonal line over the whole page - eg left bottom corner to top right corner - then use it as reference to center the shape.

You haven't mentioned if you want the shape to be fixed at that position. If so, use the protection dialog to fix the x and y coordinates.

... 2 shapesheet-free solutions.
Yacine

vojo

what about using eventdblclk

eventdbleclk = setf(getref(pinx),thepage!width*0.5) + setf(getref(piny),thepage!height*0.5)

user double clicks the shape ==> it moves shape to center of the page

From there, the user can move the shape at will.

Later, double clk again and shapre returns to center of page

Can also do this in the eventdrop cell so that if you pull shape from stencil on to page, it will land at center of the page
(not sure what happens if you copy the shape since that may be a "drop" and thus at center of page vs offset, etc)

I would model this up to see if visio automation is ok with this (see my GUARD post earlier today)
(if you use GUARD, this is still feasible but the user can NOT move the shape around).

One other option that is much more complicated is to use the setatref constructs in either the eventdblclk or eventdrop cells
(definitely need to study this and model it up before just using it...it can be a very complex formula and all ramifications need to be tested).

gnulab

Wow. So, there really is no simple "2 clicks away" method just to position a shape at the center of a page, either vertically or horizontally. Baffled. :o

In my case, I would be using this feature. If I knew beforehand the boss position would be in the middle of a chart, then I would place it there first. Or after completing an organisation chart I would center the whole chart so that I would maximize the canvas size. The workaround, of course, is just to estimate the center of a page and move the shape there.


Thanks for the reply guys.

Yacine

Quote from: gnulab on July 01, 2020, 01:18:16 AM
In my case, I would be using this feature. If I knew beforehand the boss position would be in the middle of a chart, then I would place it there first. Or after completing an organisation chart I would center the whole chart so that I would maximize the canvas size. The workaround, of course, is just to estimate the center of a page and move the shape there.

This is not what you asked for. Centering a drawing on the canvas is done by the function of the same name.
Yacine

vojo

what I suggested was "0 clicks" after you created a master shape and put it in a stencil

Good luck

wapperdude

#6
If you don't mind using a macro, the following code and example, will take any selected shape and move it to center of page...exactly.  There is no built-in function to do this.

It does not require altering any shapes.  It doesn't use double-clicking.  It can be run using <cntl>+<shift>+C, shortcut key.
It does not have any error protection.  Just a simple macro.


Sub CntrShp()
'
' Center Shape on page
' Keyboard Shortcut: Ctrl+Shift+C
'
    Dim vShp as Visio.Shape

    Set vShp = ActiveWindow.Selection(1)
    vShp.Cells("PinX").Formula = "ThePage!pagewidth / 2"
    vShp.Cells("PinY").Formula = "ThePage!pageheight / 2"

End Sub

Visio 2019 Pro