Discussion:
Identifying erroneous "Sheet.n" shapes
(too old to reply)
hellothere
2006-06-27 07:01:02 UTC
Permalink
Hello everyone,

I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.

For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".

Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?


Thank you for you time, have a nice day!
--
================
ooOo hellothere oOoo
================
Al Edlund
2006-06-27 13:15:13 UTC
Permalink
This from "developing visio solutions". The short version is names should be
unique and if your application depends on them you should consider applying
an application specific name when you drop/add shapes. An alternative of
course is to check the master's name of the object vs. the objects name if
that is what you are really working with.
al

TIP An object on a drawing page always has an ID, whether or not it also has
a descriptive

name. The Visio application assigns the ID when the object is created. This
ID does

not change unless you move the object to a different page or document. To
display an

object's ID or give it a descriptive name, choose Format > Special.
Post by hellothere
Hello everyone,
I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.
For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".
Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?
Thank you for you time, have a nice day!
--
================
ooOo hellothere oOoo
================
news.microsoft.com
2006-06-27 13:48:47 UTC
Permalink
To expand on what Al said:

Shapes have lots of identifiers:

Name - often a composite of MasterName and a number
NameU - a "universal name", nice for having a base language name, with Name
representing a localized name. Makes more sense for masters than for shapes
ID - a number, unique per page. However IDs get reused when shapes are
deleted and subsequently created
NameID - always the form Sheet.N, where = ID
UniqueID - (GUID) see the developer help for more on this
--
Hope this helps,

Chris Roth
Visio MVP

www.wanderkind.com/visio
Post by hellothere
Hello everyone,
I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.
For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".
Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?
Thank you for you time, have a nice day!
--
================
ooOo hellothere oOoo
================
hellothere
2006-06-27 15:08:02 UTC
Permalink
Thank you Mr. Roth and Mr. Edlund,

If I understand this correctly, when I drop a shape Visio will generate a
name by combining its master's name to a unique number (ID) of the page; so
its generally in the form of "masterName.n", but not always since it could
also be "Sheet.n" instead?

Mr. Roth, you said that the NameID is always in the form of "Sheet.n", but
that doesn't seem to be the case for the Visio drawings that I have, since
the majority of the shapes have "masterName.n" as their Name and NameID, and
only in some rare cases do they have "Sheet.n". Are my drawings normal?


Also, as I watch my software (in C#) running in debug mode, I looked through
the various properties of a Visio.Shape Object. Inside a Watch windows I can
see that every shape seem to have a property called "master" that points back
to the shape's master, which in turn has other properties such as Name and
NameU. Would I be better off catergorising the shapes by this NameU property?
If so, what methods are available to get this information?

Sorry about these additional questions, and thank you both for you time.


Cheer!
--
================
ooOo hellothere oOoo
================
Post by news.microsoft.com
Name - often a composite of MasterName and a number
NameU - a "universal name", nice for having a base language name, with Name
representing a localized name. Makes more sense for masters than for shapes
ID - a number, unique per page. However IDs get reused when shapes are
deleted and subsequently created
NameID - always the form Sheet.N, where = ID
UniqueID - (GUID) see the developer help for more on this
--
Hope this helps,
Chris Roth
Visio MVP
www.wanderkind.com/visio
Post by hellothere
Hello everyone,
I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.
For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".
Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?
Thank you for you time, have a nice day!
--
================
ooOo hellothere oOoo
================
Chris Roth [MVP]
2006-06-28 12:55:45 UTC
Permalink
NameID from automation always returns "Sheet.N" perhaps you are talking
about the dialog box and we are misunderstanding each other?

I dropped a shape on the page and tried some VBA in Visio's VBA environment
(Alt+F11 will get you there quick)

Leaving one shape selected, try these commands:

?visio.ActiveWindow.Selection(1).NameID
Sheet.1

?visio.ActiveWindow.Selection(1).Name
Surface ceiling light

?visio.ActiveWindow.Selection(1).NameU
Surface ceiling light

Name is what the user sees. NameU is better used by solutions that might get
localized. For instance, I might make a master called "Square". And my code
might need to refer to this master by name. When I localize for Germany,
this master becomes "Vierecke". I don't want to change the code, so I can
still refer to the master this way: visDoc.Masters.ItemU("Square"). Ie:
NameU still is "Square", even though "Name" is Vierecke.

Since you are reporting on shapes already there, use "Name", not "NameU". My
guess is that the universal name isn't that important from where you are at.

- Chris
Post by hellothere
Thank you Mr. Roth and Mr. Edlund,
If I understand this correctly, when I drop a shape Visio will generate a
name by combining its master's name to a unique number (ID) of the page; so
its generally in the form of "masterName.n", but not always since it could
also be "Sheet.n" instead?
Mr. Roth, you said that the NameID is always in the form of "Sheet.n", but
that doesn't seem to be the case for the Visio drawings that I have, since
the majority of the shapes have "masterName.n" as their Name and NameID, and
only in some rare cases do they have "Sheet.n". Are my drawings normal?
Also, as I watch my software (in C#) running in debug mode, I looked through
the various properties of a Visio.Shape Object. Inside a Watch windows I can
see that every shape seem to have a property called "master" that points back
to the shape's master, which in turn has other properties such as Name and
NameU. Would I be better off catergorising the shapes by this NameU property?
If so, what methods are available to get this information?
Sorry about these additional questions, and thank you both for you time.
Cheer!
--
================
ooOo hellothere oOoo
================
Post by news.microsoft.com
Name - often a composite of MasterName and a number
NameU - a "universal name", nice for having a base language name, with Name
representing a localized name. Makes more sense for masters than for shapes
ID - a number, unique per page. However IDs get reused when shapes are
deleted and subsequently created
NameID - always the form Sheet.N, where = ID
UniqueID - (GUID) see the developer help for more on this
--
Hope this helps,
Chris Roth
Visio MVP
www.wanderkind.com/visio
Post by hellothere
Hello everyone,
I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.
For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".
Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?
Thank you for you time, have a nice day!
--
================
ooOo hellothere oOoo
================
Paul Herber
2006-06-27 16:14:41 UTC
Permalink
On Tue, 27 Jun 2006 00:01:02 -0700, hellothere
Post by hellothere
Hello everyone,
I'm trying to sort all the different shapes in a Visio drawing by their
Master shape. I ran into a strange problem where some shapes have "Sheet.n"
as their NameID.
For example, I have a Visio drawing (.vsd file) where one of the Dynamic
connectors has "Sheet.9" as its NameID when all the other connectors have
"Dynamic connector.n".
Why did this happen? How can I write an algorithm to recognize this shape
correctly and automatically?
Further to Al's and Chris's responses, if you try out the download at

http://www.visio-utilities.sandrila.co.uk/

the 'Shapes on page report' lists the Master, Name, NameU, Index, ID,
NameID and UniqueID for each shape.
--
Regards, Paul Herber, Sandrila Ltd. http://www.pherber.com/
Electronics for Visio http://www.electronics.sandrila.co.uk/
Loading...