Author Topic: Shape Creation: with connections pts & labels using macro  (Read 7147 times)

0 Members and 1 Guest are viewing this topic.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4400
  • Ideas Visio-lized into solutions
Shape Creation: with connections pts & labels using macro
« on: November 10, 2016, 02:35:02 PM »
Felt this needed it's own topic.  The attached file contains two macros.  The difference being one adds standard connection points, the other adds named connection points.  Page-2 was added, demonstrates a newly constructed shape.  Either delete, move shape before creating a new one.

Features:
1) The code can easily be modified to change the pin to pin spacing of the connection points, and to set an arbitrary number of points along each edge.  (Didn't test for 0 pts.  Next version.)
2) The shape automatically sizes to the larger vertical and horizontal edges.
3) It drops a shape on a page, then
    a) locks the selection box sizing
    b) converts it to a group
    c) sets lower left corner as origin / reference point.
    d) adds the connection points.  (The code needs some refining, but gets everything neatly placed.)

Future updates include
    a) correcting code issues.
    b) adding subshapes to hold pin labels and pin numbers.

Wapperdude
« Last Edit: November 13, 2016, 11:53:11 AM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4400
  • Ideas Visio-lized into solutions
Re: Shape Creation: with connections pts & labels using macro
« Reply #1 on: November 12, 2016, 02:07:39 PM »
Major update.  The code now adds "placeholders" for both connection point, aka, pin, text and pin numbers.  Since the pin text leverages the connection point D cell, this implementation is specifically for adding named connection point rows.

Features:
   1)  Accepts zero connection points on any side
   2)  Allows manual resizing of shape, but will not size smaller than necessary to accommodate the pins.
   3)  Uses shape data property to control both size of shape and pin spacing.
   4)  Connection points may be dragged and text placeholders will track.  No, deleting a connection point will not delete the placeholders.  That must be done manually.
   5)  Adds a default reference designator.  The numerical indication is merely the shape ID.  So, doesnot use the auto number routines.
   6)  Definition of the pins per side and the initial pin spacing is still a manual entry into the main routine.  A user form could be created to allow entry of these values.  No intention to do that now.  Once the shape is built, it is possible to modify the pin spacing via (3) above.

Not included:  ability to hide the pin number or pin label text.

The code is partitions into 3 subroutines.  The main subroutine initially calls the main shape construction.  Then, later calls the subshape definition routine to create the placeholders for pin text.

I think this is a reasonably generic, universal shape.

Enjoy.
Wapperdude
« Last Edit: November 13, 2016, 11:53:49 AM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4400
  • Ideas Visio-lized into solutions
Re: Shape Creation: with connections pts & labels using macro
« Reply #2 on: November 12, 2016, 10:03:36 PM »
After some thought, adding the ability to hide the connection point labels and pin numbers seemed like a good feature and not that difficult to do.

So here's another update.  Select main shape, bring up the right click menu, and choose to hide either or both text features.

Wapperdude
« Last Edit: November 13, 2016, 11:54:14 AM by wapperdude »
Visio 2019 Pro

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4400
  • Ideas Visio-lized into solutions
Re: Shape Creation: with connections pts & labels using macro
« Reply #3 on: November 14, 2016, 12:20:08 PM »
Minor tweak:  defaulted non-populated D cells do not show content in the shape.  This eliminates shape "clutter" by not showing useless info.

Wapperdude
Visio 2019 Pro