Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: David.P on November 28, 2014, 06:46:48 AM

Title: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 06:46:48 AM
Hi forum,

I am trying to create a shape like below where the shadow is only under the line/arrow but not around the circle (at least not where the line/arrow starts).

(http://666kb.com/i/ctx2szyiw3o1pniu6.png)

The "good" shapes are glued from a circle and a line, the "bad" ones are smart shapes (as I believe).

Can I create a smart shape "in one piece" (without having to resort to gluing) that has the "good shadow" behaviour?

Thanks heaps already

Cheers David.P
Title: Re: Shape with shadows only on SOME lines
Post by: Nikolay on November 28, 2014, 08:12:14 AM
It looks like the shapes are all the same, aren't they?

They are in fact groups, from a circle and an arrow..
Can't you just disable the shadow for the circle part and enable it for the arrow part?

Am I missing the point?
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 08:17:33 AM
It looks like the shapes are all the same, aren't they?
No,
The "good" shapes are glued from a circle and a line, the "bad" ones are smart shapes ["in one piece"]

I use these shapes heavily, therefore I need them to behave in one piece as smart shapes (like for duplicating, resizing, changing line width, changing direction, snapping........)

In fact, the glued ones do all that -- except easy duplication by Ctrl-dragging, which however I use all the time :(
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 08:22:31 AM
Aaaahh, the glued ones ("good shadow") CAN be duplicated "in one piece" by ctrl-dragging!

So, seems that they do almost everything I need....

Except that it does not seem to be possible to fully use the format brush between them because the shadow is lost, then.

So if there is an easy way to make my "glued group" shape into a proper "one piece" shape, I'd be happy to know about it.

BTW, the document is attached in the first post.
Title: Re: Shape with shadows only on SOME lines
Post by: Nikolay on November 28, 2014, 09:02:53 AM
Hmm why do you need two shapes? I.e. only the first one is "two-shapes-shape", the rest are single-shape.

Anyways, to prevent shadow being added you can use "Protect" command for the circle, and protect it's formatting.
sub-select the circle, and then Developer => Protection => Format => Yes.

Also mind that you seem to have "glue" disabled in the drawing.
Check out the attached file!
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 09:08:26 AM
Again, I need the shape in ONE piece, not grouped or glued together from two pieces.

In your file, the shapes are still glued from two pieces.

Can I prevent shadow getting added to one of a shape's elements (e.g. a circle) in the shape sheet?
Title: Re: Shape with shadows only on SOME lines
Post by: Nikolay on November 28, 2014, 09:37:50 AM
Ah okay, clear. As far as I know, you can't do that - the shadow is applied to the whole shape, you can't apply shadow to a part of geometry.
So you can have different shadows for parts of a shape only if you shape is a group.
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 09:47:20 AM
As far as I know, you can't do that - the shadow is applied to the whole shape, you can't apply shadow to a part of geometry.

 :( I see, thank you.

Other idea: is it possible to make a shape like this:
(http://666kb.com/i/ctx7gi8g3ccql9h5q.png)

...where the arrow is fixed to the center of the circle and can be whirled around it, but only starts from the perimeter of the circle?

(This way, the shadow problem would also be solved)
Title: Re: Shape with shadows only on SOME lines
Post by: Paul Herber on November 28, 2014, 10:27:10 AM
Yes, glue the line to the circle centre but ensure the circle is in front of the line.
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 10:29:42 AM
Negative Paul, since then, it looks like this:

(http://666kb.com/i/ctx8p9cx1jmwaspwe.png)

:(
Title: Re: Shape with shadows only on SOME lines
Post by: Paul Herber on November 28, 2014, 10:34:36 AM
ah, yes ...
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on November 28, 2014, 12:39:27 PM
Couple of possibilities:
1.)  If the formatting of the circle is not going to change, then, you could lock its formatting.
2.)  You could use a connector, dynamically glue the begin point to the circle, and then group.  This would allow it to "travel" around the circle as desired.  Change the Z-order of the connector and raise it to the front.  That way, the line will always be above the circles shadow.

It also allows group formatting.
See attached.

HTH
Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 12:57:37 PM
Thanks wapperdude!

1.)  If the formatting of the circle is not going to change, then, you could lock its formatting.
This can not be done for a circle that is part of a shape (only within a group) can it?

2.)  You could use a connector, dynamically glue the begin point to the circle [...].  This would allow it to "travel" around the circle as desired. Change the Z-order of the connector and raise it to the front.  That way, the line will always be above the circles shadow.
Great! This actually is the exact answer to my above question:
Other idea: is it possible to make a shape [...] where the arrow is fixed to the center of the circle and can be whirled around it, but only starts from the perimeter of the circle?

2.)  You could use a connector, dynamically glue the begin point to the circle, and then group. [...]  It also allows group formatting.
What advantage do I get by grouping -- only group formatting, or something else as well?
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on November 28, 2014, 01:02:42 PM
Oooops.  Error with the attached file.  Corrected here.


Thought of a 3rd solution that might be even more appealing.  Open the circle shapesheet for any of your original shapes.  Scroll down to the Fill section.  In the shadow pattern cell, enter the formula Guard(0).  This will prevent the circle from having a shadow, but allow all other formatting to be normal.  I think this may be the best solution for you.

Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 01:05:00 PM
Wow Wapperdude, that would indeed be it.

Am going to try this asap.

Thank you!
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 01:20:52 PM
Open the circle shapesheet for any of your original shapes.

Whoa! Is this possible at all when I am NOT working with a group, or with glued shapes? I mean, if my shape is, umm... a shape?

Like the attached one. Can I block this shape's circle from having a shadow?
(http://666kb.com/i/ctxd568p6nljklu72.png)

THIS:
(http://666kb.com/i/ctxdw0gahcfw5jcpq.png)
...would actually be the labeling shape of my DREAMS.

Could this also be done somehow (I mean, in one piece, as a shape) ...........?

Maybe it could be done as a custom line pattern, with two custom line ends? OK, maybe not, because a line end can not have editable text inside it, can it?
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on November 28, 2014, 03:24:03 PM
Yes.  Your shape is still a grouped shape.  Sheet.10 is the circle. 

Doing your dream shadow is a little more work.

You can do the outline of the line with a custom pattern that groups two line shapes.  One is the desired line pattern, the 2nd is the "shadow", which would be, say, 50% wider. Center both shapes to each other, group.  Then use the pattern.  End points will still be a problem, but, your 90% there.

Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 04:01:49 PM
Thank you Wapperdude, this all sounds really great.

I will try both approaches, and report back!
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 05:26:17 PM
Thought of a 3rd solution that might be even more appealing.  Open the circle shapesheet for any of your original shapes.  Scroll down to the Fill section.  In the shadow pattern cell, enter the formula Guard(0).  This will prevent the circle from having a shadow, but allow all other formatting to be normal.  I think this may be the best solution for you.

Can I block this shape's circle from having a shadow?
(http://666kb.com/i/ctxd568p6nljklu72.png)

Yes.  Your shape is still a grouped shape.  Sheet.10 is the circle.

Great!

OK for part 1 -- it worked!
(http://666kb.com/i/ctxizf51j200ejqqm.png)
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on November 28, 2014, 05:51:39 PM
Unfortunately, I'm bored, so, have time to waste.  If you're willing to go with a more complex shape, then the following solution gets around some of the shadow deficiencies.  I'd say, this is a 95% solution/workaround.  It includes a "shadow" around the circle, too.

First, for the line, basically add a 2nd line, and slave its lineweight to the 1st line, something like, =guard(sheet.1stline!lineweight*2). 
Then, slave the line color to the shadow color of the group shape.

Second, for the circle, if you want a shadow, and if you want it to be uniformly oversized with the line "shadow", then you need to add another circle to the group, center it, send it to the back.
Again, over size the lineweight, and slave the color to the group shadow color.

For all of the shapes, set the shadow pattern to guard(0).  This approach doesn't use actual shadowing, just uses its color via user interface menu.

The reason this is only 95%, is that it works fine for no line ends and circular line ends.  Arrow heads give poor result, because the tip of the arrow is at the line end.  Try it, you'll see what I mean. 

Anyway, it's another approach to look at.  Perhaps give you some additional ideas.

Wapperdude

Title: Re: Shape with shadows only on SOME lines
Post by: David.P on November 28, 2014, 06:39:17 PM
Whoaa, Wapperdude, this is amazing!

Your shape even resizes line width, and end size, and shadow size correctly in all cases!

I built someting as well in the meantime!

(http://666kb.com/i/ctxklwuuvgvxcxc7y.png)

Mine is not coded in the shape sheet (because I am useless there) but instead built with custom lines and line ends.

I will make one with arrow end as well.

Only drawback is, the line end can't be sized separately from the line thickness, because this will break the line & end congruence where the line hits the end bullet. Looks like this then:

(http://666kb.com/i/ctxkv7o9ldztofswu.png)

I can't seem to figure out if it is possible to create a line/end combination that does not have this problem. It seems that the line end is always placed on top of the line by Visio, otherwise I probably could fix this.

[edit: must go to bed now]
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on November 28, 2014, 07:18:55 PM
The problems you're experiencing are what drove me to the alternative approach.  It does seem that Visio does place the line end on top of the line.  Shadows, typically, are offset in most applications.  Since they mimic shadows, they do not scale nicely as outlines.

The arrowheads are particularly troublesome because they reference the point tip.  That means, there must be some offset applied when an arrowhead is used, and, this must be proportional to the size of the arrowhead.  There doesn't seem to be enough information to solve the problem, but, I haven't looked that closely.

The shapesheet formulas are not that involved.  Basically, you need to determine which is the "parent" and which is the "child", figuratively speaking, and then establish the relationship by formula.  It takes a little planning, deciding which feature you want to use / not use...but usually, as you try something and look at the effect, you see what works and doesn't, learning from this.

Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: vojo on November 30, 2014, 08:58:53 PM
NP

put one line on top of the other in a group

Top line
   - Line end you want
   - narrower than bottom line

Bot line
   - Set to use same line end as top (use guard function so that it always picks up the top line end)
   - set thickness relative to top  (something like bot lin wieght = top line wieght + 1pt)

You can use this approach to make a 1960's rainbow around a shape....i.e.  top, middle 1, middle 2, bot
Title: Re: Shape with shadows only on SOME lines
Post by: vojo on November 30, 2014, 09:01:24 PM
BTW...this is how June does it....so credit to him

If lines same length but different thickness, I think the top line end will line up in the center of the bottom
(even for arrows...although arrow line ends are not iso).
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 01, 2014, 03:55:17 AM
@Wapperdude: thank you for your additional explanations regarding how your solution is done via shape sheet relationships.

@vojo: the problem with this approach is that it does not work for arrow heads:
(http://666kb.com/i/ctzzwkqcor3ypxpgd.png)

However, this probably could be solved by creating a custom arrow line end where the reference point=line end is not at the arrow tip but somewhere in the arrow's center area.

@Wapperdude: do you think that your approach could be modified using such a custom arrow line end for the bottom line (the shadow line)? If yes, I think that then, your shape model would be the perfect solution, in every respect. Actually I feel that this custom arrow line end probably would have to be used for both lines, i.e. also for the top line.
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 01, 2014, 12:01:03 PM
Turns out, a custom line end does work.  Couple of tricks:
  1. Draw your shape.  Don't set the line width to "no Line", set it to the minimum line width.  Otherwise, when Visio applies the custom end shape, there's a tiny gap.
  2. I protected the Aspect ratio, not sure that's necessary.
  3. Here's the key:  open the shape sheet and change the LocPinX setting.  You'll need to play around with this, depending on the design of your line end.  Start with something like width*0.3, assuming that your shape was drawn with the arrow tip on the right.

See attached...picture worth a 1000 words.

HTH.

Experiment, have fun!
Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: vojo on December 01, 2014, 12:31:39 PM
RE:  Arrow heads

Make the bottom line proportionally shorter than top lin

I.e.    Top = endx,endy
         Bot = endx - 1mm * scale, endy-1mm*scale 
         scale = top line width / bottom line width
         (may need some intelligence...i.e.  if endx >beginx, then "-", else "+"....same with endy)

Use guard() liberally
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 01, 2014, 01:40:15 PM
Whoa Wapperdude, this is great.

Thank you -- I will need to play around with this to see what is the optimum solution for the line ends.

Cheers
David.P
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 03, 2014, 09:26:30 AM
Hello Wapperdude,

I am playing around with your beautiful shape and trying to get it as close as possible to my "ideal" labeling shape.

One thing that I can't work out at the moment, is the size of the custom arrow line end called WAP :)

No matter how I resize the line end's triangle in the line end's drawing window, it always comes out really small such that I have to use "giant" or "enormous" for the line end size in order to get the line ends reasonably large. I'd however rather use "medium" for the line end size that I normally use.

Is there a way to make a custom line end larger? I also used a different drawing scale, but to no avail.
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 03, 2014, 09:38:30 AM
Ahh...

From here (http://msdn.microsoft.com/en-us/library/office/aa200997%28v=office.10%29.aspx#_#424), I gather that I need to make the Arrowhead's alignment box more narrow:
Quote
Scaled versus unscaled line patterns

If you design an unscaled line pattern (that is, the Scaled option is cleared in the master pattern's Pattern Properties dialog box), when a user applies the line pattern, the Visio engine resizes its alignment box until its height equals the line weight. Scaled line patterns keep their dimensions regardless of the drawing scale or the line weight.
However, I don't succeed with that. The grouping trick does not seem to work (I can not enter "group editing mode" from the edit menu because it is not there).

 ???
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 03, 2014, 09:55:43 AM
....OK, solved the bounding box problem by fiddling with a temporary group in the custom arrowhead's drawing window  :P

Still getting closer to absolute perfection  ;)

(http://i.imgur.com/0jQWNh7.png)

Only remaining issue, is there a way to make the shadow under the arrow head less wide (without affecting the shadow width of the line itself?  :o
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 03, 2014, 12:11:26 PM
I doubt that your application needs scaled lines.

I like to tile both the edit window and the shapesheet window so that I can see effect of the changes.

Regarding the line end, you ought to be able to do everything in the shapesheet at this point.  Open the line end for editing.  Then open the shapesheet.
  1.  Scroll to the protection section and set the LockCalcWH cell to 1.  This prevents the alignment box from resizing.
  2.  Not go to the geometry section.  Here you need to modify your arrow shape.  Note, you could do this in the edit window, but, since the shape is already defined, and presumably simple, it's just as easy to edit here in the shape sheet.
       a.  Look for the cell that sets the max Y value.  At this point it probably says Height*1.  Change the multiplier, say to Height*1.5.  You will see the point move in the edit window.
       b.  Look for the cell that sets the min Y value.  Again, this probably says Height*0.0.  Select this cell, and change it to Height*-0.5.  You should see a symmetrical arrowhead.

Note, as you click in the various geometry cells, they will highlight the vertex corresponding to the geometry row in the shapesheet.

Close the shapesheet window.  Close the edit window, click save and update.  Your drawing should reflect the modified arrowhead.

Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 03, 2014, 12:13:23 PM
OK thank you Wapperdude for your comprehensible instructions! I will try this and report back.

Cheers David.P

[edit:] Oops, are you sure that this is about resizing the shadow of the line end?
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 03, 2014, 02:42:12 PM
Discovered another unexpected feature:

Seems that location of the arrowhead on the page has a significant impact on it's appearance on the drawing page.  Not sure why that is!  So, additional recommendations:
  Set the PinX cell value to: Guard(ThePage!Pageheight*0.5)
  Then in the edit window, try moving the alignment box to the left.  Perhaps even partially off page.  That seemed to make a difference for a custom arrowhead that used multiple line curves, especially on the backside "vertical" line. 

This seems strange.  Don't think it's unique to my setup, but, I've not run across this "feature" before.

wapperdude

Ed.:  Ah!  Seems to be only when I modify a duplicated line end shape.
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 03, 2014, 03:05:18 PM
Sorry again: is what you are saying about resizing the shadow of the line end?

Because everything else is perfectly ok already --- only the shadow on the arrow head is too big.
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 04, 2014, 01:58:24 AM
When I first discovered the sensitivity of the arrowhead placement upon the edit page, yes, it was in reference to the shadow.  But, then I realized that this only happened when I duplicated the shape and edited the duplicate.  Moral of the story, each custom line end should start as a new, fresh pattern, not as a duplicate based upon a previous pattern.  As long as you start fresh, there is no issue with page placement.

There isn't a whole lot that you can do regarding sizing of the shadow around the arrowhead.  Visio controls this.  You could make the shadow arrowhead size smaller than the normal arrowhead, but this doesn't work well with say big arrowheads.  Plus, this is limited in application.  There are only fixed step sizes with the arrowheads:  medium, jumbo, etc.  There is no in between, e.g., medium jumbo.  However, the difference between very small, and small are less pronounced and might be useful.  You can experiment doing the following:
   1.  Draw your initial arrowhead small.
   2.  Lock the alignment box.
   3.  Now make the arrowhead much bigger, e.g., 4 times width and height.  This will cause a large arrowhead on the drawing page, forcing you to select something like small.
   4.  Set the shadow arrowhead size to be 1 size smaller than the normal size.  This will decrease the overlap.  Either set this by formula in the shadow shapesheet in the Line Format Section, EndArrowSize cell: =guard(sheet.X!EndArrowSize-1) or do it manually by selecting the shadow shape and setting it by hand to very small.  Sheet.X is the top level group shape, where X is the ID number.

I think this is about as close as you can do.  You may have to adjusting the sizing in step 3 above until you get the desired overall appearance.

HTH
Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 04, 2014, 02:01:40 AM
Thank you very much Wapperdude, will try that asap and report back.

Regards David
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 04, 2014, 12:06:49 PM
Blink!  Light just went on!!!  :o

Technique for independent, continuously variable shadow arrowhead size.  Try to say that 10X fast!!!   ::)

It is not necessary to do the shadow arrowhead to be 1 size smaller than the normal arrowhead.  That approach was too limited.

Rather, do the following.
  1. In the group shape, add one more shadow line and send it to the back.
      a. The line weight of this 2nd line will not be a fixed multiple of the original line weight.  You'll either change it manually, or, you could create a shape data property at the group level, whose value you can readily change.  Note, this shadow line weight will always be less than the original shadow weight, but more than the normal line.

  2. In the shapesheet for the original shadow line, use the guard function to lock the line ends to none, i.e., guard(0).

  3.  Since the arrowhead scales with the lineweight, as you change the 2nd shadow line, you will change the amount of overlap of the arrowhead shadow.  You can now finely tune the amount of overlap.

Summarizing, you have 3 stacked lines:  top level is the normal level, middle level is the line shadow without any applied ends, and the bottom level which has line ends, but, its lineweight is independently adjustable -- smaller than the mid level line weight, but, slightly greater than the top level normal line weight.  Thus the line shadow overlap will appear to remain constant, but the arrowhead shadow overlap is freely adjustable.
 
You can make this width track by the top level line width by guarded formula, and make the amount of overlap setable at the group level with an editable group level shape property.
Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 04, 2014, 12:23:08 PM
Ahhhh! I said it ten times fast  :P

Thank you!

The rest goes a bit over my head, unfortunately  :o

I mean, I understand the GENIUS principle with the 3 stacked lines for "line", "line shadow" and "end shadow", but I honestly don't know how to fabricate this -- neither with custom line/end patterns, and much less using the shape sheet  ???

Do you think you could send me a sample that uses this prinicple? Maybe starting with my (attached) current labeling shape set?

From there, I should be able to work my way through to full understanding how it is done.

Cheers
David

Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 04, 2014, 12:31:30 PM
Here's example of what I was explaining.
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 04, 2014, 12:43:41 PM
Great Wapperdude -- thank you very much. Amazing.

I will try and fabricate my labeling shapes from this.

If I am finished, may I have your............
paypal address? Honestly, these little shapes will actually make me earn money (because it will make my drawings having even better quality).

Therefore, I feel that I'd like to compensate/donate for at least some of your efforts.
Title: Re: Shape with shadows only on SOME lines
Post by: wapperdude on December 04, 2014, 01:03:29 PM
Your gratitude is enough.

Wapperdude
Title: Re: Shape with shadows only on SOME lines
Post by: David.P on December 04, 2014, 01:07:38 PM
I'm amazed and humbled by your shape generosity :)