Uniquely Numbering Shapes

Started by Nepherim, May 04, 2018, 08:01:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nepherim

I'm looking to assign unique ID/numbers to each shape in a model.

  • Doesn't matter if there are numeric gaps
    Numbers should not change, and should be reasonably protected from a 'typical' user changes
    Numbers only need to be unique for this doc -- if it helps, really only the sheet the shape resides on
    Duplicated shapes should get a new ID
    Ordering of numbers is not important (top to bottom, random, doesn't matter)
    Needs to support creation of shapes from a Shape Master
    Does not need to be 'live' -- ie, assigning numbers at Save is okay.


I thought perhaps "Number Shapes" would get me there, but whilst Number Shapes adds new Properties to each shape, it doesn't add properties to the Shape Master. On the face of it, that's okay, since those fields are added when a master shape is dropped. However, that actually means those fields now become visible to the end user when a DOCMD(1312) dialog is shown, or when the Shapesheet is shown -- since they are visible by default.

So:

  • Is there a way to auto-hide the newly added number fields? (I tried adding fields of the same name to the Master Shape and setting those to Not Visible, but this didn't change any behavior)
    Is there a more effective way to achieve numbering, which will allow me to hide the numbers from users?

I had considered just re-purposing the same mechanisms Number Shapes implements, but it's not at all clear where the 'generate new number on drop' event is firing from, nor where the "add shape numbering fields on drop' event fires from.

Any thoughts?

Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Nepherim

The links I have seen mostly orient around the unique ID part. I'm less concerned about that, and more in how the Number Shapes works, since it's basically what I want with a few things I'd like to change.

- How to prevent Number Shapes "continue numbering on drop" dialog when opening the Visio model?
- Where do 'generate new number on drop' event and 'add shape numbering fields on drop' event fire from?

Nikolay

If you want to hide the numbering properties, you could hide them in the master shape.
Means, you edit the master, set these 3 properties used by the Numbering addon to be "Hidden".

Now, to stop automatic numbering, you right-click the page and uncheck "Number Shapes On Drop".

In general, as far as I can see, the stock solution with numbering is not that customizable from developer's point of view,
you can not add new behaviors to it, you can just use it or not as an user. There are no events like "generate new number" you could handle.

Nepherim

Quote from: Nikolay on May 07, 2018, 12:06:12 AM
If you want to hide the numbering properties, you could hide them in the master shape.
Means, you edit the master, set these 3 properties used by the Numbering addon to be "Hidden".
Unfortunately hiding these properties now makes them un-searchable, which in my case reduces their utility. I have worked around this though -- i have a custom Edit dialog, so can choose to hide those fields.

Quote from: Nikolay on May 07, 2018, 12:06:12 AM
Now, to stop automatic numbering, you right-click the page and uncheck "Number Shapes On Drop".
I actually don't want to allow auto-numbering to be turned off. Even though I can remove this option from the right-click page options, it still pops up when opening the model.

Quote from: Nikolay on May 07, 2018, 12:06:12 AM
In general, as far as I can see, the stock solution with numbering is not that customizable from developer's point of view,
you can not add new behaviors to it, you can just use it or not as an user. There are no events like "generate new number" you could handle.
This is unfortunate. At this point, I'll probably need to return to a fully custom sequencing solution. I'll add a doc property maintaining the sequence upper-bound. The if I check for sequence existence on the on-drop event, on-save, and my custom report-menu options that should get me to a reasonable point of ensuring objects have a UID assigned.