Accessing specific shapes on a page

W

WPfeffer

I am trying to access the two shapes being connected by a dynamic connector.
When I access the '1-D Endpoints' section of the connector shape and retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From' shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When I
drop it on the drawing page and check its shape sheet, the name in the title
bar of the shape sheet window is 'Rounded process' [Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
P

Paul Herber

I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


I am trying to access the two shapes being connected by a dynamic connector.
When I access the '1-D Endpoints' section of the connector shape and retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From' shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When I
drop it on the drawing page and check its shape sheet, the name in the title
bar of the shape sheet window is 'Rounded process' [Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
W

WPfeffer

Thanks for the help. You were correct there was a problem with the Name and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

Paul Herber said:
I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


I am trying to access the two shapes being connected by a dynamic connector.
When I access the '1-D Endpoints' section of the connector shape and retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From' shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When I
drop it on the drawing page and check its shape sheet, the name in the title
bar of the shape sheet window is 'Rounded process' [Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
M

Mark Nelson [MS]

The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

WPfeffer said:
Thanks for the help. You were correct there was a problem with the Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

Paul Herber said:
I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When
I
drop it on the drawing page and check its shape sheet, the name in the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
W

WPfeffer

I didn't know that last part, about the 'glued connections' I must of missed
that somewhere. I will now google that and figure out how to do access them
that way.

Thank you, that was alot of help and has sent in me in a different direction
of coding the shapes.

Wayne

Mark Nelson said:
The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

WPfeffer said:
Thanks for the help. You were correct there was a problem with the Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

Paul Herber said:
I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


On Fri, 22 Jun 2007 15:56:00 -0700, WPfeffer

I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When
I
drop it on the drawing page and check its shape sheet, the name in the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
S

Scott

Wayne,

I faced a similar problem a couple of years ago in trying to identify the
shapes at each end of a customized dynamic connector. The code I used is
below. No expressed or implied warranties of course :) but it did the job
for me at a time when I was a total rookie with Visio VBA.

As you'll see "HCG Line" is the name of the custom dynamic connector.

Regards,
Scott
= = = = = = = = = = = = = =
Sub CalculateLinkEnds()
'1) iterates through all shapes on page
'2) ignores all shapes except those whose name starts with "HCG Line"
'3) for every HCG Line that is connected on both ends, places contents of
' custom properties field (Prop.Number) from shape that HCG Line is
connected to
' into a custom property field in HCG Line (Prop.From at start; Prop.To at
end)
'4) for HCG Lines that are not connected at both ends, adds line to
selection set
' so that all un-connected lines are highlighted when subroutine ends

Dim i As Integer

Dim shpCurrent As Visio.Shape
Dim collEndPoints As Visio.Connects
Dim shpFrom As Visio.Shape
Dim shpTo As Visio.Shape

'if anything is selected, turn it off
ActiveWindow.DeselectAll

For i = 1 To ActivePage.Shapes.Count
Set shpCurrent = ActivePage.Shapes.Item(i)

Select Case Left(shpCurrent.Name, 8) 'First 8 characters contains
shape name without .ID
Case "HCG Line"
'Get connection collection for current shape
Set collEndPoints = shpCurrent.Connects

If collEndPoints.Count = 2 Then 'both ends are connected
Set shpFrom = collEndPoints(1).ToSheet
shpCurrent.Cells("Prop.From").Formula =
shpFrom.Cells("Prop.Number").Formula

Set shpTo = collEndPoints(2).ToSheet
shpCurrent.Cells("Prop.To").Formula =
shpTo.Cells("Prop.Number").Formula
Else
'Add current shape to selection set
ActiveWindow.Select shpCurrent, visSelect
End If
End Select
Next

If ActiveWindow.Selection.Count > 0 Then
MsgBox ("one or both ends of selected shape(s) are not connected")
End If

End Sub
= = = = = = = = = = = = = =
WPfeffer said:
I didn't know that last part, about the 'glued connections' I must of missed
that somewhere. I will now google that and figure out how to do access them
that way.

Thank you, that was alot of help and has sent in me in a different direction
of coding the shapes.

Wayne

Mark Nelson said:
The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

WPfeffer said:
Thanks for the help. You were correct there was a problem with the Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

:

I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


On Fri, 22 Jun 2007 15:56:00 -0700, WPfeffer

I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When
I
drop it on the drawing page and check its shape sheet, the name in the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
L

lol1000

Hi Mark

Could you explain how to use the connects object? I am using connectors to
link objects that hold scores. The connectors need to access data in custom
fields in the objects they point to. The objects need to read the data in
the connectors that they point away from (and calculate the sum)

Thanks in advance

Mark Nelson said:
The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

WPfeffer said:
Thanks for the help. You were correct there was a problem with the Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

Paul Herber said:
I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


On Fri, 22 Jun 2007 15:56:00 -0700, WPfeffer

I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the 'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil. When
I
drop it on the drawing page and check its shape sheet, the name in the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D, (short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
J

John Goldsmith \(Visio MVP\)

Well since I've just answered something similar in the above post, here's a
quote:


If they are glued, then you could read which shapes your target shape is
glued to, or which shapes are glued to it (remember that glue always has a
direction). In this situation the Connects property of your target shape
will return a collection of Connect objects that connect to other shapes and
the target shape's FromConnects property will return a collection of Connect
objects that other shapes are connected to. Once you have your collection
of Connect objects you can iterate through them and their respective
FromSheet and ToSheet properties to get hold of the other shapes.

Take a look at this link for further reading:

http://msdn.microsoft.com/en-us/library/aa201774(office.10).aspx


Hope that helps

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

lol1000 said:
Hi Mark

Could you explain how to use the connects object? I am using connectors to
link objects that hold scores. The connectors need to access data in
custom
fields in the objects they point to. The objects need to read the data in
the connectors that they point away from (and calculate the sum)

Thanks in advance

Mark Nelson said:
The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be
updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio
provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

WPfeffer said:
Thanks for the help. You were correct there was a problem with the Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

:

I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


On Fri, 22 Jun 2007 15:56:00 -0700, WPfeffer

I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the
'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil.
When
I
drop it on the drawing page and check its shape sheet, the name in
the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more
than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D,
(short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 
J

John Goldsmith \(Visio MVP\)

This seems like a popular subject today...you might also want to checkout
this thread, which has some demo code:

http://groups.google.co.uk/group/mi...3e0f4a?hl=en&ie=UTF-8&q=visio+using+selection

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

John Goldsmith (Visio MVP) said:
Well since I've just answered something similar in the above post, here's
a quote:


If they are glued, then you could read which shapes your target shape is
glued to, or which shapes are glued to it (remember that glue always has a
direction). In this situation the Connects property of your target shape
will return a collection of Connect objects that connect to other shapes
and
the target shape's FromConnects property will return a collection of
Connect
objects that other shapes are connected to. Once you have your collection
of Connect objects you can iterate through them and their respective
FromSheet and ToSheet properties to get hold of the other shapes.

Take a look at this link for further reading:

http://msdn.microsoft.com/en-us/library/aa201774(office.10).aspx


Hope that helps

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk

lol1000 said:
Hi Mark

Could you explain how to use the connects object? I am using connectors
to
link objects that hold scores. The connectors need to access data in
custom
fields in the objects they point to. The objects need to read the data
in
the connectors that they point away from (and calculate the sum)

Thanks in advance

Mark Nelson said:
The first time you or a user names something, Visio assigns that name to
both the Name and NameU properties. The next time you or a user renames
something, Visio only updates the Name property. NameU can only be
updated
via automation. Visio does this to support having multiple language
versions of the same shape or to allow users to rename a shape without
breaking your automation. (Of course, this assumes that your automation
exclusively works with NameU.)

I'm not sure I understand the reason why you are trying to parse a
Shapesheet expression in code to find out a shape reference. Visio
provides
the Connects object to get at shapes via glued connections.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

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

Thanks for the help. You were correct there was a problem with the
Name
and
NameU properties not matching up.

How does this happen, I would really like to avoid this in the future?

Wayne

:

I seems to me that you might have masters with different Name and
NameU properties. You could write some VBA to iterate through the
masters in the stencil and show you the Name and NameU properties of
each shape. Or you could try my
http://www.visio-utilities.sandrila.co.uk/
which will do it for you and offer to update the name if there is a
difference.


On Fri, 22 Jun 2007 15:56:00 -0700, WPfeffer

I am trying to access the two shapes being connected by a dynamic
connector.
When I access the '1-D Endpoints' section of the connector shape and
retrieve
the X, Y coordinates of the two ends, I am able to parse out the
'From'
shape
and the 'To' shape names that can then be used in the <shape
object>.get_ItemU(<shame name>) method of the page object.

The problem that I am currently having is:

One of my shape's master is named 'FileAcquisition' in the stencil.
When
I
drop it on the drawing page and check its shape sheet, the name in
the
title
bar of the shape sheet window is 'Rounded process'
[Drawing1:page-1:Rounded
process <SHAPE>]. When retrieve the 'BeginX' cell from the '1-D
Endpoints'
and parse out the name, I get 'FileAcquisition', but when I check
the
shape
sheet the name that it has in the BeginX cell is 'Rounded process'.
[=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))]

Could someone please explain to me why this is happening? It's more
than
just a little frustrating. The code that I'm using to parse out the
BeginX is
[shapeSubject is the connector]:

Cell cBeginX =
shapeSubject.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowXForm1D,
(short)VisCellIndices.vis1DBeginX);

string sFromBot = ((cBeginX.Formula.Split(new string[] { "!" },
StringSplitOptions.None))[0].Split(new string[] { "(" },
StringSplitOptions.None))[2];

The formula being returned from cBeginX.Formula:
PAR(PNT(FileAcquisition!Connections.RequestLocation.X,FileAcquisition!Connections.RequestLocation.Y))

The formula in the Shape Sheet for the connector shape:
=PAR(PNT(Rounded process!Connections.RequestLocation.X,Rounded
process!Connections.RequestLocation.Y))


Wayne
 

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

Similar Threads


Top