Shape scaling problem

Started by T.Boh, July 30, 2013, 08:48:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

T.Boh

Hi All

I'm new to Visio so this may be a silly question but I don't know how to fix it so I fought I'll ask more experienced users.

I have created my own shape. It has the right dimensions and as long as I was using it on the document with 1:20 scale (my first drawing) it was working well (I could drag it in whenever needed). Today I have created a new document with a new scale - 1:50 and alas my shape does not scale down when inserted. When I drag it in, it looks more less as big as before but should be more than half it's previous size (it is not scaled down to match drawing's scale).
When I changed drawing scale back to 1:20 and placed the shape and than changed scale to 1:50 - the shape did scale down. Same shape added  to drawing set at 1:50 is too big. What am I doing wrong :o? Should I block shape dimensions in protection or sth?
Help would be appreciated. Thanks

T.Boh

I didn't realise that it's such a tricky question  :)

vojo

Not sure exactly what you are trying to do (keep shape same visual size regardless of scale or scale down shape to scale), but you
could look putting something in the eventdrop  cell of the shape that uses the pagescale of the page to make some decision.

eventdrop = setf(getref(user.shapescale), pagescale / 2mm)
Width  = guard (13.225 mm * user.shapescale)
height = guard( 22.9991 mm * user.shapescale)

Basically, every time you drop the shape, it will check current pagescale (for example, pagescale = 1mm) and calculate current user.shapescale
for this shape (1mm / 2mm = 0.5)   That value will be used to set width ( 13.xxx * 0.5 = 6.5xxx mm) and height (22.xxxx * 0.5 = 11.xxx mm )
The guard() function prevents you from resizing the shape thru UI (you may want to set up some custom props to handle that....
eventdblclk = docmd(1312), props.width = value you input, props.height = value you input....width = guard(props.width * user.shapescale)....etc)

If you really want to sink your teeth into some hardcore shapesheet work, you can look at SETATREF() functions in the width and height cells. 
These are very tricky to get to work.  In essence, takes whatever you are doing at the UI and processes a transform you define before placing in cell.   I will be honest, in 10 years, I have never made this function work right for me.....but others have.

here is how I handle scaling (I think its sort of different from what you are after.....but maybe helps)
double click to adjust shape.....right click and see shape sheet as well as a bunch of other options you may not care about


goltoof

#3
Quote from: vojo on July 31, 2013, 11:08:13 AM
eventdrop = setf(getref(user.shapescale), pagescale / 2mm)
Width  = guard (13.225 mm * user.shapescale)
height = guard( 22.9991 mm * user.shapescale)

Yours is closest to the answer I'm looking for after searching for hours.  I have an enormous shape library with tons of stencils.  Every shape is scaled 1:1, measure in inches.  I used to be able to drag a shape to any drawing and it would automatically set to the same drawing scale.  So if the drawing was set .06 in =  1 in., then the shape would scale accordingly.  Now when I drag a shape over it's enormous no matter what the scale. When I start the drawing as 1:1, then scale it after dragging my shapes, any new shapes I add are 1:1 again.  I tried applying your method and I always get "error in formula".  I use the shapesheet often to modify shapes but not so adept at applying formulas.  Not sure if "user.shapescale" is even a recognized function in visio or if you meant something else.  All I want is to make it so my shapes scale down to the same drawing scale of whatever drawing/template I drag it to.

vojo

I have used this on visio 2003 numerous times (albeit for somewhat different reasons)
You may want to check the syntax ....I certainly could have "free handed" the formulas since they were from memory

wapperdude

Visio should be scaling the shapes automatically.  To prevent the shapes from scaling, requires shapesheet effort to generate an "antiscaling" formula.  See http://msdn.microsoft.com/en-us/library/office/aa201733(v=office.10).aspx.

It seems like something has been clobbered with your Visio setup...
  a.)  What version are you running?
  b.)  Have there been recent system changes that might correlate with the change in behavior?
  c.)  What version were the stencils made with?  Shouldn't be an issue, though.

Do a variety of shapes from various stencils behave the same way or is it just one shape or just one stencil that is misbehaving?

Do you have an existing file (make a copy of it), that the drag and drop used to work?  Does it still work?

Wapperdude

Visio 2019 Pro

goltoof

#6
Quote from: wapperdude on August 31, 2013, 12:05:44 AM
Visio should be scaling the shapes automatically.  To prevent the shapes from scaling, requires shapesheet effort to generate an "antiscaling" formula.  See http://msdn.microsoft.com/en-us/library/office/aa201733(v=office.10).aspx.

It seems like something has been clobbered with your Visio setup...
  a.)  What version are you running?
  b.)  Have there been recent system changes that might correlate with the change in behavior?
  c.)  What version were the stencils made with?  Shouldn't be an issue, though.

Do a variety of shapes from various stencils behave the same way or is it just one shape or just one stencil that is misbehaving?

Do you have an existing file (make a copy of it), that the drag and drop used to work?  Does it still work?

Wapperdude

I can't think of any specific system changes that would have caused them to not scale automatically.  Same problem occurs on old templates as it does on blank new templates, as well as with my shapes and default visio shapes.  After scaling a new template and dragging a shape over it's still 1:1.  I'm using 2007.

Does this have to do with how templates are set up or is it a problem with shapes, or something else? 

I'm willing to change the shapesheet each shape with the proper scaling formula, problem is I don't know the proper way to do it.  I tried vojo's suggestion but get errors and am at a dead end.

wapperdude

Well, it looks like you've discovered a feature, aka, a bug.

Took some effort, but I did get V2007 to misbehave on two different occassions.  It does look like how the stencils and/or template saved.

Did a simple case of a single rectangle, 9"x6", each separately drawn on a page, copied to the stencil.  1st time: page scale 1"=1", 2nd time: ps=1=1 (no scale), 3rd time: ps 1"=2".  Saved the stencil. A fourth rectangle was drawn 36"x24" on page scale 1"=20".  Then the stencil was re-saved.  Then the page scale was reset to no scale and template was saved.  Visio was closed and re-opened.  Then two pages added:  2nd page 1"=1", 3rd page 1"=20".  Went back to 1st page which has no scale.  Dragged the 36x20 rectangle onto the page.  It placed way too small 1.8"x1.2"  (1/20th desired size).  Page 2.  Dragged the 36x24 rectangle.  It placed at correct size.  Page 3:  ditto.  Back to page 1, rectangle still small.  Drag another 36x24 still small.  Drag 1 of each of the smaller rectangles all OK.  Go to page 2: drag 1 of each small rectangle all OK.  Go to page 3, the rectangle drawn on page with no scale place too large:  180"x120" (20X).

So, it looks like a combination of stencil and template settings at time of creation/saving can cause some undesired effects.  I suspect that it is better to save stencils and templates in at least the same page scaling configuration.  That is for scaled drawings it might be better to draw the shapes with a specified page scale of 1"=1" rather than no scale.

You might be able to recover your stencils by resaving them.  I would try this with duplicate copies!!!

HTH
Wapperdude.
Visio 2019 Pro

goltoof

Quote from: wapperdude on September 10, 2013, 06:13:50 AM
I suspect that it is better to save stencils and templates in at least the same page scaling configuration.  That is for scaled drawings it might be better to draw the shapes with a specified page scale of 1"=1" rather than no scale.

Yahtzee!!!

All of my shapes were set to "no scale" before.  Did as you said, now all shapes scale perfectly to the drawing scale.

Thanks bud!