Lock Top of One Shape To Bottom of Another Shape

Started by ccowman, January 02, 2014, 09:04:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ccowman

Hi everyone,

Just started getting into Visio and working with ShapeSheet and what can be done with it.  There is a ton!!!  One item I'm struggling with is PinX, PinY, LocPinX, and LocPinY. 

I have two rectangles, the top one is a system and the bottom is a description.  I have the values set through the right-click menu with other logic for colors / values defined for each selection.  The problem I'm having is that the top rectangle may be one line, two lines, or more.  I have built the top rectangle to automatically adjust in size based on the text inside, however, I'm stuck on keeping the bottom rectangle "attached" to the top rectangle.  I tried using various formulas referencing the PinY of the top shape and the height to be set to the PinY of the bottom, but just can't seem to get it right.

Hopefully that makes sense.  The short of it, I'm looking to try to keep the top of the bottom rectangle lined up with the bottom of the top rectangle.  Thanks in advance for the help on this post (along with the tons I've learned from surfing all the others!).

wapperdude

Not that difficult.
> Open shapesheet for the "top" shape. 
> Set LocPinY = Height*0.
>  Make note of the shape ID, e.g., sheet.1
> Close shapesheet.

> Open shapesheet for the lower shape.
> Set LocPinY = Height*1
> Set PinY = Guard(Sheet.1!PinY)  where Sheet.1 is the ID of your top shape.
> Set PinX = Guard(Sheet.1!PinX)
> Close shapesheet.

The last two "sets" lock the lower shape to the upper shape.  The two LocPinY sets the edges of the two shapes so that they will align correctly.

That's it.
Wapperdude
Visio 2019 Pro

wapperdude

Oh.  You might also want to set the lower shape's width to match the upper shape's width.

In the shapesheet for the lower shape, set the width cell = Guard(sheet.1!width)

HTH
Wapperdude
Visio 2019 Pro

ccowman

Thanks, wapperdude.  That works perfectly.  I tried about 10 different iterations, but now that I see the result, I see how it works together.  Thanks again!

ccowman

Hi everyone,

Last question (I think) on this...Is there a way to take this one step further for 3 shapes? 

If I use the logic of wapperdude, it will only work for 2 shapes since I need to set the LocPinY for the "Top" shape = Height*0, but that shape will also be the "Bottom" shape to another - and that LocPinY must be set to Height*1 (i.e. the middle shape = Top and Bottom).  Thanks again in advance for any tips!

wapperdude

Yes, could extend it to 3 (or more) shapes.  If you want to add a shape above the "top" shape, set new shape LocPinY = height*0, set it's PinY = topshape PinY + topshape height.  You can do something similar to adding a shape below the bottom shape, except use the bottom shape height, and, of course, it would subtract, not add.

HTH
Wapperdude
Visio 2019 Pro

ccowman