Syncing External Stencil and Document Stencil

Started by billman, April 03, 2025, 06:49:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billman

This is not a new question but I would still like some advice or discuss some options.  A (version of) the question was asked as recently as Jan 2025 and a couple of times unanswered long ago [one, two].

If I make a change to a master in an external stencil, is there any way at all to update the corresponding master in the document stencil (and thereby all the shapes connected to the document stencil master)?

The current behavior of Visio - adding a brand new master to the document stencil - just seems stupid.  Why wouldn't I want the document stencil master (with the same name as a master in the document stencil) to be updated to the new master?  Of course I would - always!!

The alternatives are manual and just seem to be workarounds:
(1) change the master in the document stencil and manually copy it to the external stencil and delete the original. (Or change them identically in both.)
(2) @yacine's change-shape approach.  (Haven't tried this yet but it still seems to leave the duplicate master in the document stencil.)

Is there no way to keep master with the same name in sync between an external and document stencil?

Bill

wapperdude

No.  Not that I'm aware of.

It may make sense in your use case, but there are other cases where it could have bad consequences.
Visio 2019 Pro

Paul Herber

Here is this scenario. Paul creates a Visio document using a stencil called Widgets and uses a shape called Splodge. Paul sends this document to his work colleague, Wapperdude, who has a different stencil called Widgets from a competitor supplier, but also contains a shape called Splodge. But this stencil is more up to date. Should the document shapes get updated? Never!

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

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

wapperdude

Wapperdude, being a friend of Paul's, would be agonizing over what to do.  But, fortunately, the products were different, just artificially had same nanes.  Wapperdude, being a creative genius, renamed both products more appropriately.  The former dealt with toilets, while Paul's dealt with thrones.  Wapperdude was greatly relieved.
Visio 2019 Pro

billman

Such is the life and dangers of homonyms, and of failing to translate between contexts.

Despite the dangers, I would love to find a way to make stencil-maintenance less redundant.  Is it possible to:
(1) Launch an event when a master is dropped from an external stencil
(2) Check whether a master in the document stencil exists with the exact same name
(3) Ask the user if they'd like to replace the master in the document stencil
(4) On yes: replace the master in document stencil (which then should prompt visio to ask about updating shapes)
(5) On no: copy as new master to the document stencil

I fear my programming skills at this moment are not up to this task.




wapperdude

Not at my computer, but...

"Dropping" gets triggered whenever a shape is dragged from a stencil or copy / pasted or duplicated.  Basically, whenever, regardless of how it happens, a new shape instance appears on a page.

Yes, to some extent that's possible.  For instance, in the shapesheet, there is an OnDrop cell.  This cell could call a macro which would do your indicated steps.  So, it would require editing each Master to have the macro call.  The good aspect is that only modified masters would cause the triggering.

There may be a global event that could be used.  I do not recommend using it as that would trigger the macro for every shape that gets "dropped".  You and your users would quickly hate this.

Visio 2019 Pro

Nikolay

#6
When I worked at Process4 (not available anymore), we were providing a specific wizard dedicated to that in the tool.

Like, you right-click in the stencil, select the shapes you want to update, and then it replaces all instances of those in the diagram(s), trying to distort the diagram as little as possible (it has also some options like keeping text, custom properties, background/foreground color, if overwritten, etc). I mean, there can be issues - like, the previous master had connection points but the new one does not, or vice versa, or the new one is two times bigger, and the connectors need to be "pinned down" somehow so that they don't turn into a mess after replacement, etc - lots of potential issues as far as I remember.

That was quite a long time ago, like 20 years ago
Later on Visio team introduced the "replace shape", but that does not solve the issue with the mass update from the stencil.

Also, there is a feature "Replace Shape" in Paul's Super Utilities that is somewhat similar to this.
Maybe he could give some thoughts here. Here in the docs, "Shape Substitute" (unfortunately links to chapters not working, hopefully will fix that):
https://unmanagedvisio.com/products/vsu/super-utilities-reference/

Regarding Process4, here is the extract from the old documentation (digged out😅)
https://unmanagedvisio.com/upload/p4b_old_temp/updating-diagrams-to-comply-with-edited-master-shapes.html

Maybe it could be worthwhile to re-implement those features in the VSU while I've not forgotten them completely.
The point is the old code is in C++ (yes, UI in C++, sounds crazy nowadays), and needs to be rewritten in .NET from scratch practically if porting.

Paul Herber

Quote from: Nikolay on April 04, 2025, 07:03:16 PMAlso, there is a feature "Replace Shape" in Paul's Super Utilities that is somewhat similar to this.
Maybe he could give some thoughts here.

Um, sorry, far too long ago now. My mind hasn't thought about code for quite a while now. Looking at my VSU it seems that it was 4 years ago. At some time I might also be wanting to hand over all my stencils as well ... maybe, perhaps.
Electronic and Electrical engineering, business and software stencils for Visio -

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

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 288 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1160KB.
Tokens: post-login.
Cache hits: 14: 0.00255s for 26,590 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]