Master shape with evenly spaced connection points?

Started by YossiD, January 20, 2021, 12:01:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

YossiD

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


YossiD

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)


Quote from: Surrogate on January 20, 2021, 01:14:44 PM
Quote from: YossiD on January 20, 2021, 12:01:16 PM
  Left: 5, 0.1
  Right: 0
  Top: 4,0.25
  Bottom: 2, 0.0.3
what you mean ?

vojo

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

@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

#5
See this topic:  Shape Creation: with connections pts & labels using macro,
http://visguy.com/vgforum/index.php?topic=7543.0
Visio 2019 Pro

YossiD

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

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

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