### Author Topic: Master shape with evenly spaced connection points?  (Read 6359 times)

0 Members and 1 Guest are viewing this topic.

#### YossiD

• Full Member
• Posts: 79
##### Master shape with evenly spaced connection points?
« on: January 20, 2021, 07:01:16 AM »
Looking for a way to create a master shape of a rectangle with evenly spaced connection points. I would want the shape to include variables whereby the user can specify the number of connection points and the location of the first connection point on each face. User input might look something like:
Left: 5, 0.1
Right: 0
Top: 4,0.25
Bottom: 2, 0.0.3

How difficult would that be to do?

Or is it possible that something like that already exists?

Thanks

#### Surrogate

• Hero Member
• Posts: 1803
##### Re: Master shape with evenly spaced connection points?
« Reply #1 on: January 20, 2021, 08:14:44 AM »
Left: 5, 0.1
Right: 0
Top: 4,0.25
Bottom: 2, 0.0.3
what you mean ?

#### YossiD

• Full Member
• Posts: 79
##### Re: Master shape with evenly spaced connection points?
« Reply #2 on: January 20, 2021, 08:57:14 AM »
Top: 4,0.25 = 4 connection points on top side of rectangle. 1st connection point at Width * 0.25
Bottom: 3,0.3 = 3 connection points on bottom side of rectangle. 1st connection point at Width * 0.3 (I see I had a typo here)

Left: 5, 0.1
Right: 0
Top: 4,0.25
Bottom: 2, 0.0.3
what you mean ?

#### vojo

• Hero Member
• Posts: 1710
##### Re: Master shape with evenly spaced connection points?
« Reply #3 on: January 20, 2021, 11:43:04 AM »
You only need 2 values:
- offset from corner
- number of connection points evenly distributed.

Span = width - offset
interval = span/user specified number connection points.
N = user specified number connection point.

now the hard part.
- need specify the max number of connection points

connections.width1 = if (N > 0, offset+ 1* interval, 0)  for 1st point
connections.width2 = iif (N>1, offset + 2* interval, 0)
connections.wdith3 =  if (N>2, offset + 3* interval,0)  f0r 3rd point

so for N =2, offset 5mm (and interval is calculated to 4mm)then, something like
width1 = 5mm + 4mm
width2 = 5mm + 8mm
width3 = 0mm             // can adjust formula to move offset  to outside if statement so 5mm

etc.

#### YossiD

• Full Member
• Posts: 79
##### Re: Master shape with evenly spaced connection points?
« Reply #4 on: January 20, 2021, 12:46:34 PM »
@vojo

I think that you essentially translated what I wrote into Visioese, except that you have offset as a hard number, and I would prefer as a fraction of Height/Width.

My problem is that I'm no Visio programming maven, so I need some pointers to resources about how to define variables, prompt for inputs, etc. I know that there are some standard shapes with user inputs (screw sizes, etc.) so when I've got some free time, I'll look at those shape sheets to see how its done. Otherwise if anyone can point me to some tutorials, that would be great.

If/when I actually manage to create this shape i will post it to the form in case anyone else is interested in using it. If I really get carried away I'll see if I can figure out how to include error traps for non-valid entries.

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4837
• Ideas Visio-lized into solutions
##### Re: Master shape with evenly spaced connection points?
« Reply #5 on: January 20, 2021, 01:44:43 PM »
See this topic:  Shape Creation: with connections pts & labels using macro,
http://visguy.com/vgforum/index.php?topic=7543.0
« Last Edit: January 20, 2021, 01:47:42 PM by wapperdude »
Visio 2019 Pro

#### YossiD

• Full Member
• Posts: 79
##### Re: Master shape with evenly spaced connection points?
« Reply #6 on: January 21, 2021, 08:14:07 AM »
Thanks Wapperdude. Very cool.

I'll have a look at the code when time permits and see if I can understand/make use of some of it.

I'm still in Visio Pro 2003, and when I run your macro it throws an Unknown function name error after adding only one connection point to the shape. Any idea which function might be the problem?

The macro ran fine under Visio 2010 on a different computer.

#### Surrogate

• Hero Member
• Posts: 1803
##### Re: Master shape with evenly spaced connection points?
« Reply #7 on: January 21, 2021, 01:27:31 PM »
I think that code was written in Visio 2007, and some function can not support in Visio 2003. Can you, share which function you mean and in which line you get this error?

#### RudySchneider

• Full Member
• Posts: 95
• Old Dog Learns New Tricks
##### Re: Master shape with evenly spaced connection points?
« Reply #8 on: January 21, 2021, 01:36:11 PM »
For what it may be worth, I created a LOT of customizable shapes for electrical/electronic diagrams, one of which was a box that you could re-size and specify the distance between connection points around its periphery, by right-clicking and opening the Shape Data dialog box.  Perhaps you can use this, or look over and adjust its Shapesheet.
There are no problems, only opportunities