distinguishing connectors

J

John B

I have a text box A connected to text box B via a "Connector" shape.

I would like to produce list of relationships between the text boxes.
How can I distinguish the nature of the connection. i.e. incoming or
outgoing connection?

e.g.

--------- ----------
| A |---data1-->| B |------data2-->
--------- ----------

output I would like to see is:

textbox input output
A null data1
B data1 data2

I managed to get the list of connections:

' test for textbox A
sub test ()
dim vsoshapes as visio.shapes

For i = 1 To vsoShapes.Item(1).FromConnects.Count
if InStr(1, LCase(vsoShapes.Item(1).FromConnects.Item(i).FromSheet.NameU),
"connector") > 0 then

debug.print vsoShapes.Item(1).FromConnects.Item(i).FromSheet.Text

end if
next i

end sub

but no luck with distinguishing whether it is an input or an output!

JB
 
L

LarryF

Here's one way to solve the problem. I think I would iterate through
all the shapes on the page, checking the BegTrigger and EndTrigger
cells in the Glue Info section for each shape. If BegTrigger and
EndTrigger have no formula, the shape isn't a connector. Shapes that
are connectors have a formula like "_XFTRIGGER(Sheet.1!EventXFMod)".
The name of the shape that the connector is connected to is the text
between the '(' and the '!', or "Sheet.1" in this case. The BegTrigger
has the shape the connector is connected from, and the EndTrigger has
the shape the connector is connected to.

As far as I can tell, a 2-D shape doesn't know if any 1-D connectors
are connected to it. So you would have to work backwards. Get all of
the connectors, then parse the formulas in their BegTrigger and
EndTrigger cells to figure out which shapes they connect to.

HTH
 
M

msnews.microsoft.com

I could get all the connectors to the shape but I could not figure out how
to distinguish whether the connector connects TO the shape (i.e. ends at the
shape) or FROM the shape (i.e. begin from the shape).

So using my example(in the previous post), I need to be able to get to

Textbox input output
A "" data1
B data1 data2
C data2 data3

A connector with "data1" text connects A to B and so forth.

All I could get now is:

Textbox input/output
A "", data1
B data1,data2
C data2,data3

No way I could tell whether data2 is output or input of B.

JB
 
L

LarryF

The only place I know of where that information is stored is in the
BegTrigger and EndTrigger cells of the connector shapes.
 
J

John B

Ok, I see.

if I am looking at process 2 and if a connector has the following:
BegTrigger _XFTRIGGER(Process!EventXFMod)
EndTrigger _XFTRIGGER(Process.2!EventXFMod)

Then this is an input into process.2 since the connector "Ends" at process.2.

Excellent!

Thanks mate!

JB
 
A

Al Edlund

John,
you might check out the visio sdk which has an example in the library of a
drawing navigator.
al
 
J

John Marshall, MVP

V

vojo

where do you find "fromsheet/tosheet" or "frompart/topart"...not any
connector I have ever seen nor in the help==>developer==>cells or sections
or etc.
 
W

wdhough

I'm a little confused here in the previous example
BegTrigger = _XFTRIGGER(Process!EventXFMod)
EndTrigger = _XFTRIGGER(Process.2!EventXFMod)

what does the number 2 actually stand for? i assume its not the id or the
text of that box, but the second instance of it created? Therefore in order
to assertain a complete map of connections between boxes in a diagram you
would have to itterate through the shapes, and noting how many "Process"
types have appeared before a given shape in order to obtain the relevant
number specifying that shape?

Is that all correct? it seems a little long-winded is all?

Thanks
 
M

Mark Nelson [MS]

Visio has several methods for identifying shapes. Every shape has a Name,
an ID, a NameID and a UniqueID.

Name is a string that uniquely identifies that shape on that page. If you
drag a shape from a stencil, the Name is set to the name of the Master shape
(e.g. Process). However, to ensure uniqueness Visio may append an integer
to the original name (e.g. Process.2). The integer appended is the ID.

ID is an integer that also uniquely identifies the shape on a page. IDs are
assigned sequentially to shapes as they are created / dropped in the
document. IDs are not specific to the original master shapes, so you cannot
use them to count how many Process shapes there are, for example. Also when
a shape is deleted, Visio does not renumber to fill in the gap.

Imagine two Process master shapes are dropped onto a page. Visio assigns
the IDs 1 and 2, and it names the shapes Process and Process.2. Now a
Decision shape is dropped. That shape gets ID = 3 and is named Decision
(the name is unique so has no integer appended). Next a Process shape is
dropped and becomes ID = 4 and name Process.4.

NameID is a combination of Name and ID, but Visio replaces the shape name
with "Sheet". Thus the NameID of Process.4 is actually Sheet.4. All shapes
are considered "sheets" by Visio.

All these properties ensure that a shape is uniquely named on a page.
However, across pages there is no guarantee that a Name or ID is unique.
That's where UniqueID comes in. This is a GUID that ensures a shape is
unique across all pages in the document.

It's confusing and a little more complicated than necessary. A lot of this
reflects Visio's evolution as a drawing app from simple shapes to complex
diagrams.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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