Author Topic: Locking the 'glue' on 2D shapes glued to other 2D shapes  (Read 3225 times)

0 Members and 1 Guest are viewing this topic.

Visisthebest

  • Sr. Member
  • ****
  • Posts: 376
Locking the 'glue' on 2D shapes glued to other 2D shapes
« on: May 14, 2021, 10:17:36 AM »
VisioGuy is a brilliant Visio guru and I love this learning solution he created:
http://www.visguy.com/2019/09/11/hex-snap-glue-shapes/

Snapping and gluing together 2D shapes, I love it!

I do have one question about a problem and potential solution I found working with gluing together 2D shapes, but not sure if it is the right way to go. This is what I am doing for example:

1. I have two of VisioGuy's hex shapes on the page.

2. I move Hex Shape 1 (HS1) and I snap & glue it to Hex Shape 2 (HS2)

3. If I move HS2, HS1 moves with it as it is glued.

4. If I move HS1, HS2 becomes unglued and is left behind.

5. To create 'bidirectional glue', in protection on HS1 I set the X position and Y position as locked.

Now I can still move HS1 (indirectly) by moving HS2 (which still moves with HS2 as I move it around). This initially surprised me as its X and Y positions are locked, I assume it means its formulas are locked but not its absolute position)
HS2 can no longer be moved just by itself (which is exactly right for my purposes, the user should only move HS1).

Is this the way to go to truly glue together 2D shapes that I dont want the user to be able to unglue (without going in to the developer tab or editing the SS), or is there a better more solid/elegant solution?

Many thanks for your guidance much appreciated!
« Last Edit: May 14, 2021, 10:20:43 AM by Visisthebest »
Visio 2021 Professional

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3974
  • Ideas Visio-lized into solutions
Re: Locking the 'glue' on 2D shapes glued to other 2D shapes
« Reply #1 on: May 14, 2021, 11:09:56 AM »
In your scenario, if you think in perspective of hierarchical structure, HS2 is the base or parent, and HS1 is the child.  You'd expect HS1 to follow HS2, not visa versa.  It would be normal to expect moving HS1 to break the glue.

You could set HS1's coordinates to be relative to HS2 and then guard.  This would "lock" HS1 to HS2, and effectively demobilizing it.  That is, it will only move if HS2 moves.  Your solution (I haven't tried) is quite simple.  The other approaches that occur to me are more cumbersome in involving formulas, macros.

Edit:  Just tried the Protection> Locking Move X, Y.  Works great. Tried with just simple rectangles and glue points.  You can cascade glued shapes, think caterpillar, and do the lock on each added shape.  All stay glued.  Nice find.

« Last Edit: May 14, 2021, 11:39:03 AM by wapperdude »
Visio 2019 Pro

Visisthebest

  • Sr. Member
  • ****
  • Posts: 376
Re: Locking the 'glue' on 2D shapes glued to other 2D shapes
« Reply #2 on: May 14, 2021, 11:54:34 AM »
Thank you wapperdude good to understand the options!
Visio 2021 Professional