How do I distinguish between connection points?

M

Mac

say I have a 'five-sided' shape with one connection point added to each of
the sides; there are many connectors glued to each of the conneciton points.
Now, when I programmatically traverse those connections I'd like to be able
to recognize 'ok, this connector is glued to connection point A and not B'
.... Is there a way to achieve this?
 
K

Konrad Anton

Mac said:
say I have a 'five-sided' shape with one connection point added to each of
the sides; there are many connectors glued to each of the conneciton points.
Now, when I programmatically traverse those connections I'd like to be able
to recognize 'ok, this connector is glued to connection point A and not B'
... Is there a way to achieve this?

A Connect object (to be obtained from Shape.Connects and
Shape.FromConnects) has a ToCell and a FromCell property. Is that what
you're looking for?

--Konrad
 
M

Mac

Konrad, I know about ToCell and FromCell properties, now I've found that even
the shape object has got ConnectionPts cells, but I can't seem to figure any
reasonable way of using these to programatically identify and distinguish one
connection point from another (there's no Id or Name prop or something). Am I
missing something simple?
 
P

Paul Herber

say I have a 'five-sided' shape with one connection point added to each of
the sides; there are many connectors glued to each of the conneciton points.
Now, when I programmatically traverse those connections I'd like to be able
to recognize 'ok, this connector is glued to connection point A and not B'
... Is there a way to achieve this?

You can look at the connector's Begin/End X/Y cells. A couple of lines
of string processing can dig out the connection point names. Start at
the character after the first "!" and end at the next ",".
 
M

Mac

I am sorry I can't find what you you're talking about (can't see anything
name-related within the cells' contents). Could you please be more specific?
 
P

Paul Herber

I am sorry I can't find what you you're talking about (can't see anything
name-related within the cells' contents). Could you please be more specific?

I've just created a simple block diagram with two Square shapes and
joined them with a connector. The connector's BeginX cell in the 1-D
section of the shapesheet has the formula
=PAR(PNT(Square!Connections.X2,Square!Connections.Y2))
 
M

Mac

Well, in my case it's different. If you!d be so kind as to continue with your
example diagram, switch on your connection point tool and add one connection
point to each of the square's edges. For each of these points, all you can
get is its X1, Y1, DirX, DirY, Type and AutoGen props, none of which uniquely
specifies that particular connection point within its containing shape, I'm
afraid ...
 
P

Paul Herber

Well, in my case it's different. If you!d be so kind as to continue with your
example diagram, switch on your connection point tool and add one connection
point to each of the square's edges. For each of these points, all you can
get is its X1, Y1, DirX, DirY, Type and AutoGen props, none of which uniquely
specifies that particular connection point within its containing shape, I'm
afraid ...

That's the shape's connection point data. Look at the connector's cell
data. The shape's connection points can't refer to the connecting
shape as many connectors can connect to any one connection point.
 
M

Mac

Al,
one more point - when I use your example as-is, and call :

Set vsoShape = vsoSelection.Item(1)

AddStandardConections(vsoShape),

all I get is compiler error: type mismatch. I come from the C++/assembler
world and get easily confused by such self-explanatory messages; where's the
mismatch? the parameter? but how? or...I do not see any problem here ...
 
A

Al Edlund

Well the code itself is pretty straight forward, so I would start by
investigating the definitions of vsoSelection and vsoShape. Since the normal
selection process returns an array of shapes the pointer comes into play,
since it is possible for the selection array to be empty. (i.e. check the
count before assigning a pointer).
al
 
A

Al Edlund

one other item, the standard connection points obviously infer something
with four sides, the key is the root module of structuring how to add a
connection point programmatically.
al
 
M

Mac

Al, the problem happens at (sort-of) 'compile time', simply the compiler does
not like the line and I cannot figure out why. I even tried this:

Dim vsoShape As Visio.Shape
Set vsoShape = vsoSelection.Item(1)
AddStandardConnections (vsoShape)

and the problem persists. But there's a hint (I hope); mind the space
between the Sub name and the parentheses - my compiler adds it to the line
automatically - why?; I always thought this happens when you mismatch Subs
and Functions ommitting or neglecting return values etc., but this is not the
case ... Any further ideas?
 
M

Mac

ok, my remark about the space was stupid, but I've made another check; even
if I use

Dim vsoShape As Visio.Shape
Set vsoShape = ActivePage.Shapes(1),

then the line
AddStandardConnections (vsoShape)
triggers a Type Mismatch Compiler Error; this drives me nuts .....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top