Linking shapes' properties

Started by Yacine, September 28, 2023, 09:39:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Stumbling over this topic (http://visguy.com/vgforum/index.php?topic=10195) about linking texts of different shapes on the same page or across the pages of the document, I thought it deserves a generalized approach.


Linking texts is the most common question, but why limit it to that only property? Basically one could think about linking any shapesheet cell to another one.
Like the position - pinx and pin y.


Or even a pinx to a piny on diffent pages so as to make flipped diagrams.


Same could be done for colors - useful if the color carries a coding information.


A tool (a form) would allow to pick the shapes to link - over several pages, text fields or dropdown lists would define the properties to link.


A trivial solution would be to implement it as master-slaves relations (unidirectional), with optional protection of the linked properties.
A better solution would be to have it bi-directional with that SETATREF stuff that Wapperdude masters so good.


Your opinion?
Yacine

Nikolay

#1
What business purpose do you see in this linking? Isn't it way too complex.
I think most users might have not opened the shapesheet even once, and the formulas for them might look like voodoo writings ( or ancient Egyptian algebra, if you wish :) )

I mean, the copy/paste behavior in the linked topic is, most probably, just a bug (or, better, a feature that might have been implemented, but wasn't)

Surrogate

Quote from: Nikolay on September 28, 2023, 11:24:03 AMI think most users might have not opened the shapesheet even once, and the formulas for them might look like voodoo writings
You are right, Nikolay   :D

Yacine

#3
Nice - egyptian shapesheet:

Egyptian Mathematics Mathematics Numerals Geometry


You can easily overcome this objection by shaping the dialog like the "insert field" one.
Standard fields offered from a pulldown, plus a field for a custom formula.
;) Plus one button that opens a link to your internet site for assistance (paid???)



----


My actual intent was actually not that much of merchandising it, but rather a tool for geeks.
Making it a sell-able product wouldn't be bad though.



Yacine

Surrogate

#4
I have a goal to make a shape cloning tool (transferring the properties of one shape to another). I'm going towards it in small steps :)

What is already ready now is described in the articles:
Working with the Geometry section
Replacing formulas with values ​​in the Geometry section
Copy Line and Fill properties
Copying properties from the User-defined cells, Shape Data and Actions sections
Quote from: Yacine on September 28, 2023, 09:39:16 AMA better solution would be to have it bi-directional with that SETATREF stuff that Wapperdude masters so good.
I agree with you, but I cant make these SETATREF hardcore formulae.

wapperdude

Quote from: Surrogate on September 28, 2023, 01:47:07 PM
I have a goal to make a shape cloning tool, but I cant make these SETATREF hardocore formulae.

I'm curious ... what specifically, are you trying to do?  SETATREF() is not universally applicable.
Visio 2019 Pro

Yacine

#6
Quote from: Surrogate on September 28, 2023, 01:47:07 PM
I have a goal to make a shape cloning tool (transferring the properties of one shape to another). I'm going towards it in small steps :)


You may want to have a look at the enclosed ipynb. I haven't finished it, but there's a solid basis.
It is intended to document smart-shapes and to apply the smartness to an arbitrary shape.


It's done in Python because it relies heavily on iterating over collections and collecting data in lists of lists and dictionaries. I wouldn't want to write that in VBA.


The base idea is that a shapesheet is quite big, but only a tiny fraction really matters. So the trick is to find out what is special.
To do so, the code draws a basic rectangle, collects all the cells of the source shape and the new "virgin" reference shape.
It then iterates over both lists and keeps only the cells of the source shape where the lists differ.
These special cells are written in an excel sheet. Documentation done.


Not finished is collecting the same stuff for sub-shapes of groups. That is important for smart-shapes. Open point.


The data collected can be called a smart-shape definition. Applying such a definition to an arbitrary shapes goes in two steps.
First create all the cells that don't exist yet (props, user, geometry, etc.).
Only then the formulas can be written. Otherwise you would get too much errors from cells not existing yet.


Got stuck when I wanted to use the tool for modification "snippets". Like applying a certain text formatting and something else related to geometries. Couldn't get the matters separated ... Anyway.


Have fun with it.
Yacine

Yacine

Quote from: wapperdude on September 28, 2023, 04:56:01 PM
I'm curious ... what specifically, are you trying to do?  SETATREF() is not universally applicable.


Let me write a couple of code lines. I'll be back ;)
Yacine

Yacine

First proof of concept.

The tool can link shapes across several pages - fist tab

The second tab (not started yet) is there to avoid having to link the shapes manually. You only define which field defines the link - eg prop.ID.
The tool would then search every shape on the source page. Get the value of the linking field, the iterate over all the target pages, search for shapes that have the same value in the link field. For each matching pair it would write the linking formula in the target field.

To return to Wapperdude's question. Yes, the SETATREF stuff does not work everywhere, but I am sure we can find a way to generalize its application at least for the fields where it does.
The formulas being monitored by Visio, most of the errors can be caught.
Yacine