Adding an icon to a process shape then including it into an exiting stencil

Started by paulricot, September 24, 2018, 11:05:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

paulricot

I am using a stencil provided by our consultants. There are shapes that have been specially designed to have a icon in the top left corner and text in the middle, which if you double click, you can edit.

This is all fine, but they have missed a certain type of process step and I need to create a new process shape with a cogwheel icon in the top left to denote "automated step" which is not in their stencil. I can do this "manually" by importing an image of a cogwheel, pasting it into position within one of the existing "special" process shapes (when I ungroup I get the message about breaking link with master) then regroup and dragging onto their stencil. However, this does not work:

1. When you make the process shape longer, the icon distorts (because its an image)
2. The text (I saved the shape with default text) cannot be edited

I know its something to do with adding custom section to the process shape and messing with the shapesheet and I need a vector cogwheel to stop distortion. I've searched and searched the internet for a process on this, but I can't find it.

Can anyone help?

Yacine

Hi Paul,
it would last too long to explain every thing in detail, so here are just the steps, that should do what you want.

1) Drop one of the "good" shapes on your canvas. We'll try to modify it as little as possible, so as to keep the original behaviour (text, ...)
2) Copy the cogwheel picture to the clipboard (ctrl-C)
3) "OPEN" the group - don't ungroup it. You can find this option under group/open ...
4) Paste the cogwheel into the group. Resize it to your needs. Delete the old picture and position the new one at its place.
5) To avoid distording the cogwheel, when the parent shape is resized:
a) Under File / Options / Advanced you can find the option "run in development mode". Check it.
b) Now when right-clicking on the image, you should see the option "open shapesheet". Click it.
c) on the left top side you should see the 2 fields "width" and "height". Each of them contain a formula - something like "sheet.123!width*0.2". Replace both formulas by an absolute value eg "5 mm" or "0.5 in".

Your're done.
Close the group, test it, then copy the shape to a stencil.

HTH, Y.
Yacine

Nikolay

+1

The key point - open the group to edit (right click -> group -> open group), DO NOT UNGROUP, ungrouping breaks the shape.

paulricot

Thanks very much Yacine. I've done what you suggest and it does work. Just one slight problem:

Although the shape no longer distorts as you change the  process shape its attached to, what does happen is that as you (Say) stretch to right, the icon image moves (no distortion) also a % to the right (grrrr!). I have tried to fix in the shapesheet (LocPinX, LocPinY) but these can't be the right parameters cos it makes no difference (in fact, original values just keep reappearing)

Any ideas?

Yacine

Right, it's PinX and PinY that you need to change, not LocPinX/Y.
You might be interested in this topic: http://visguy.com/vgforum/index.php?topic=7120.0
Yacine

paulricot

Thanks Yacine - your first video on shape handling is most enlightening! I now know a little more what those parameters on the shapesheet do.

Having "fixed" the horizontal position (PinX) at zero, this means that when the parent shape is changed, the cogwheel remains rock steady on the horizontal plane. However, because of positioning, I cannot seem to "fix" the Vertical PinY at 0, so then if the shape is stretched vertically, the cogwheel starts to move slightly lower as you stretch the parent. Its not a showstopper, but it looks ugly. I have fiddled with the vertical parameters, but not having much luck.

(see attached)

Yacine

Hi Paul,

The formula should be: PinY = sheet.185!height * 1 - 1mm
1 mm is the fix distance from top, you choose
Yacine

paulricot

Hi Yacine,

The problem with making it sheet.185!height * 1 is that the shape then appears right at the top of the parent shape & covers up the outline of the parent shape and looks ugly.

I appreciate the your solution, but I cannot help but think that there is a method within Visio to do this. So let's suppose I wanted to create one of these "special" shapes from scratch. You would start with a basic process step then add the icon in the top left corner. Maybe some shapesheet parameters are changed, but the shape is then protected. How do I know that? Because if I apply your procedure to one of these shapes as supplied by our consultants, you cannot edit or do anything with the icon they have attached. A message comes up saying something about shape protection. And it gets worse. If I drag my own "special" shape onto a stencil, then use it as normal, the icon moves and distorts. I look at the image shapesheet and all the parameters have been reset. 

Also, to enable the text to be double clicked from the stencil, I'm sure you would then add a "section" to the shape and specify it as text. I'm sure all this is documented somewhere because our consultants have provided these custom shapes for us. I just have no idea where I would find it.

Yacine

Quote from: paulricot on September 25, 2018, 03:34:37 PM
The problem with making it sheet.185!height * 1 is that the shape then appears right at the top of the parent shape & covers up the outline of the parent shape and looks ugly.

That's right the "-1 mm" was meant as example. Set the distance to a value that does not overlap the border. ;) The formula is [sheet.185!height * 1 - n mm]. Replace n by a number that suits you.

As for the protections, there are several possibilities to realise them.
There's the protection section and each cell of the shapesheet can be enclosed in a "Guard()" function.

The double-click behaviour can be set in the behaviour dialogue or in the events section of the shapesheet.

... and be patient with yourself, the shapesheet is a wonderful tool, but it is big and it takes some time to 1) understand it, 2) to learn to play with it.
Yacine

wapperdude

There is also the Drawing Explorer Window (DEW).  It gives you a tree view of the Visio document.  You can expand it to show drawing pages/ background pages.  Expand a page to see shapes, layers.  Expand shapes if they are grouped.  Click on a shape and it will be selected in the normal drawing window.  Right click a shape in the DEW, and you get related options like viewing its shapesheet.  The point being, you can see the level of complexity of one of consultant supplied shapes.  They can become quite involved, requiring a lot of time, effort, and learned skills.

There is no "canned" procedure for building these things. 

Wapperdude
Visio 2019 Pro

Yacine

Yacine

paulricot

Thanks Yacine & Wapperdude for all your patience and help.

But lets try and keep it as simple as possible (Albert Einstein-wise!).

Can either/both of you just try this (will not take you guys long, promise!)

ok - take a standard process shape. Now import picture of an icon - anything will do but a cogwheel is good. Now all you have to do is group these two together so that the icon
1. Stays in the same location when process shape is stretched
2. Does not distort when the process shape is stretched
3. Keeps these properties when added to a custom stencil.

How hard can that be?

Thanks

Yacine

Why don't you use the tool in the link previously posted? It does all that stuff.
(http://visguy.com/vgforum/index.php?topic=7120.0)
Load the stencil in your current Visio instance, drag the yellow square on the canvas and start adjusting the group shape.
Yacine

wapperdude

Not at my computer at the moment, but, for sake of completeness, the manual, DIY, steps are...
(If you haven't discovered this, you can right click in shapesheet and select to display either formulas or values.  Handy to toggle back n forth.)

1) drop the process shape on the page
2) note the size of its width and height
3) size & place your icon as desired;  note its width and height
4) open icon shapesheet and place guard function around both the width and height values
5) group; note the shape name of the group.  S/B sheet.3
6) once grouped, select the icon and open shapesheet
7) verify that width and height are still guarded, with same values in step (3); if not, make it so Scotty!
8.) ...now for some math.  Display values.
        a) look at PinX, note its value, do same for PinY
        b) enter formula into Pin X:  guard(sheet.3!width*0+xpinval) where xpinval is the literal number for PinX in step (a)
        c) calculate the height offset:  ho = value of step (2) height - value of step (8a) PinY
        d) enter this formula into PinY:  guard(sheet.3!height*1-ho) where ho is the literal value you just calculated
9) Deselect your icon

Assuming I remembered everything, and all steps done correctly...no typos...your group ought to look exactly as it did when you first created it.  Now when resizing the group, the icon will remain in its relative location, and size will not change.

Wapperdude
Visio 2019 Pro

paulricot

Hi Yacine,
Ok - I have imported GroupBehavior and followed your video for instructions. You are correct, it now works as expected.

However...when I drop the "now working" grouped shaped onto a stencil, save the stencil then drag the now "master" shape onto the working area, it no longer works. Looks like putting these shapes into a stencil undoes all the good work from your macro.

Any way round this?