Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Gregory Jackson on November 13, 2020, 11:49:04 PM

Title: Changing Shape Keeping all things equal in aspect ratios
Post by: Gregory Jackson on November 13, 2020, 11:49:04 PM
I often create my own icon, stencil, objects etc. I like to put solid black line around the objects and even add shadows. One of the things that I have not quite figured out is, if I create an object with a line as border when I shrink or scale smaller the lines width does not scale correct nor does the test either or shadows.

I'm sure there is some parameter on the shape sheet that needs adjusting.

Thoughts,

Anyone?
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: vojo on November 14, 2020, 12:53:01 AM
RE Lines:   You can make your own scaling

User.scale = width/<original width when shape created>

lineweight = guard(5pt *user.scale)

If you want to allow user to change line width but also scale, I think you will want to look at
setatrefexpression set of functions.

RE shadows:  I don't know but assume something like above could be used.

You could try copying the shape, set the line weight to  to 2X of original set and set it behind the original shape...group them.
use the above to scale the shadow as well.   This work for most/simple shapes...I believe the hollow sections of wagon wheel.
It migh not work hollow points are off access ("hole" in lower left of square)
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Nikolay on November 14, 2020, 04:46:51 PM
If you just need proportional scaling, and don't want any Visio smart behaviors then you could convert your shape to vector image (like EMF/WMF), and insert it as an image.
Aside from 'proper' (i.e. uniform) scaling it will also boost the performance. Most equipment manufacturers (CISCO, HP, etc) that provide Visio stencils do it this way.
Please note that you will lose the ability to edit the shape after conversion of course.
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: vojo on November 15, 2020, 03:59:14 AM
Nikolay,  Those companies shapes are an image tied to a 1D shape so that the if the rack is grown, their handles can connect.
Feel free to describe how that is done as another option for this.    I don't really use that technic and, memory serves, it involves some shapesheet settings to make it work.  Shapes on Visiocafe.com uses this approach most or all its shapes.

So while certainly valid to leverage images for this kind of thing and thx for pointing it out, its only part of such a solution.
(not trying to throw shade on your post....only trying to say that I believe there is more to it to solve this request).
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Nikolay on November 15, 2020, 01:58:35 PM
Yes, sure this approach also has limitations :)
It is just in certain cases it could be a valid option as well - not sure if will fit here.

I mean, drawings that use this approach you usually have tons of details, and implementing them all as Visio shapes would produce enormously large and slow diagrams.
Also, even for an image, you can still have "some" Visio functionality, like connection points, 1d vs2d, glue, etc (but only at the top-level) - Visio wraps images as a "shapes" anyways.
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: vojo on November 15, 2020, 11:47:51 PM
apologies...I think you missed my point

I am not saying that one should make the shape all in visio
I am only saying using EMF/PNG/etc is fine...but for most of those shapes, image is grouped / pinned to a simple 1D connector.
And to do that does take some shapesheet work.

So in essence, its an image that scales based on associated 1D connector for attachment to say a rack shape
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Nikolay on November 16, 2020, 12:06:29 AM
I think 1d thing may be specific to the Rack shapes?
Here is a simple example to illustrate change in behavior between Visio shape and Visio shape exported as EMF (Enhanced metafile) and then imported back as image:

(https://unmanagedvisio.com/upload/images/emf.gif)

vsdx file (https://unmanagedvisio.com/upload/images/Drawing1.vsdx)
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Gregory Jackson on November 24, 2020, 03:50:42 PM
So if I understand the final resolution is to export then Import, the problem is then the EMF file is flat and cannot be edited, any changes I would have to edit the master and go through the export/import process.

Correct?
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: wapperdude on November 24, 2020, 04:23:12 PM
Yes and no.  If you choose to go the "pic" route yes.  This approach is chosen when no editing or infrequent editing is needed.

If you stay absolutely Visio, then some initial, up-front work is necessary.  That is, you need to add formulas to force text and line weight to change with shape size.  If you have just a few shapes, manual editing works.  If there's a lot of repeated editing, perhaps using code to do the task.

Basically, the formula is, as Vojo indicates:  scaled size = original design value * current size / original value.  For example, line weight cell has formula = 5 pt * width / 3 in.  He introduces User.scale for convenience when applying the scaling to multiple features, e.g., font size, line weight


Adding more scaling solutions...
http://visguy.com/vgforum/index.php?topic=8651.msg37735#msg37735
http://visguy.com/vgforum/index.php?topic=6897.msg28789#msg28789

Plus many more. 
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Nikolay on November 24, 2020, 04:54:33 PM
Exactly. I think the "correct" answer depends on the type of the shape you have and how you plan to use that shape.
Unfortunately Visio does not have a feature to "freeze" shape so that it behaves like a picture, as far as I know, so you need to choose if you want an actual picture or not.
Title: Re: Changing Shape Keeping all things equal in aspect ratios
Post by: Gregory Jackson on November 24, 2020, 05:44:42 PM
Thank you all for your help this is much appreciated.

~g