Author Topic: understanding of "Blocks|1-D single" smart shape's techniques  (Read 4107 times)

0 Members and 1 Guest are viewing this topic.

effebruno

  • Jr. Member
  • **
  • Posts: 25
understanding of "Blocks|1-D single" smart shape's techniques
« on: January 04, 2014, 09:18:03 AM »
Hi,
I'm a Visio 2007 newbie and I was looking at the ShapeSheet of Blocks|1-D single to learn some concepts, in order to create my own smart shapes.

The 1-D single shape has some cool features, such as the ability to mantain the arrow head's width fixed when resizing the shape (except for very small values of Width), a text never upside down and an "Open Tail" (and "Close Tail") action. To achieve that it uses a Scratch section and 3 shapes grouped together (their names visible enabling the Drawing Explorer window and navigating to Foreground Pages):

Sheet.2: the grey arrow fill
Sheet.3: the black arrow border
Sheet.4: a tiny white vertical line near the tail of the arrow; initially hidden and shown with the "Open Tail" command.

To identify the individual sub-shapes, I set Protection|LockGroup cell to 0 and then I Ungrouped the 1-D single shape.

Now, some questions I hope you could help me answering to.  ::)

1) The action Open/Close tail just toggles Scratch.C1 value, that in turn is used in all 3 sub-shapes so that if the tail is open
    a) the grey fill overflows a bit towards the arrow's tail
    b) the border does not close itself with the 1st geometry point
    c) the Sheet.4 sub-shape gets visible with
       Geometry1.NoShow=-(2*Sheet.1!Scratch.C1)
The question is: why in c) isn't there simply "=Sheet.1!Scratch.C1"?

2) The text gets never upside down when rotating the shape, thanks to a Text Transform|TxtAngle cell set to:
    IF(AND(Sheet.1!Angle>-90 deg,Sheet.1!Angle<=90 deg),0 deg,180 deg)
    Why not use simply "=GRAVITY(Sheet.1!Angle)"?

3) Why the Text Transform section is present both in Sheet.2 and Sheet.3 sub-shapes? Doing so is it displayed twice one over the other?
Could I put a Text Transform section only in the grouped ShapeSheet (1-D single)? If I choose "Insert section", then I would not be able to delete it anymore (unless using Undo)! There should be some basic ShapeSheet concepts I still don't know...

4) The Fill Format|FillForeGnd celle has the following value:
    THEMEGUARD(IF(CELLISTHEMED(FALSE),SETATREFEXPR(THEME("AccentColor2")),SETATREFEXPR(RGB(211,211,171))))
I would have used CELLISTHEMED(TRUE) to assure that the AccentColor2 theme would be applied only if the shape had a theme applied to it, as the guide suggests...
Does infact "IF(CELLISTHEMED(FALSE),...) " mean "IF CELL IS NOT THEMED"?

Thank you very much for all the support you would give me.
Regards,
Filippo

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2973
    • Paul Herber's website
Re: understanding of "Blocks|1-D single" smart shape's techniques
« Reply #1 on: January 04, 2014, 11:13:56 AM »
To identify the individual sub-shapes, I set Protection|LockGroup cell to 0 and then I Ungrouped the 1-D single shape.

Hint: never ungroup shapes, the shape will break.
Use the Drawing Explorer window to look at group sub-shapes.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

effebruno

  • Jr. Member
  • **
  • Posts: 25
Re: understanding of "Blocks|1-D single" smart shape's techniques
« Reply #2 on: January 04, 2014, 11:24:56 AM »
Hi, I know that I will break the link with the master, but Sheet.2 and Sheet.3 are one over the other, so the only way I found to understand which was which was to ungroup them and slide them a bit. Just not to hide every shape but one once at a time...

Have you got some clues about my questions?  ;)

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2973
    • Paul Herber's website
Re: understanding of "Blocks|1-D single" smart shape's techniques
« Reply #3 on: January 04, 2014, 01:55:55 PM »
It's not the breaking of the link with the master that is the problem (even though that is the problem that you are told about). When a group is ungrouped the group shape gets lost, this shape can contain much of the usefulness within the shape. Unless you created the group yourself to perform some operation, don't ungroup.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

https://www.paulherber.co.uk/

effebruno

  • Jr. Member
  • **
  • Posts: 25
Re: understanding of "Blocks|1-D single" smart shape's techniques
« Reply #4 on: January 04, 2014, 02:28:51 PM »
Ok, I understand, thanks. Do you know the reason that prevents me to remove the Text Transform section from the group shape's ShapeSheet once I've inserted it?

nashwaan

  • Full Member
  • ***
  • Posts: 85
Re: understanding of "Blocks|1-D single" smart shape's techniques
« Reply #5 on: January 04, 2014, 02:32:51 PM »
I have quickly inspected the 1-D Single shape and my answers to your questions:

1) your version of the equation "Geometry1.NoShow=Sheet.1!Scratch.C1" is correct and much better than the awkward "Geometry1.NoShow=-(2*Sheet.1!Scratch.C1)".

2) Again, your version "TxtAngle = GRAVITY(Sheet.1!Angle)" is correct and does the same job.

3) Text transform sections are unnecessary in Sheet.2 and Sheet.3 sub shapes. So you are again right about this. This is weird.

4) Does infact "IF(CELLISTHEMED(FALSE),...) " mean "IF CELL IS NOT THEMED"?
I guess, yes and this is awkward. BUT, in Visio 2013, CELLISTHEMED() is deprecated and replaced by a newer version: ISTHEMED() function.

And for the: THEMEGUARD(IF(CELLISTHEMED(FALSE),SETATREFEXPR(THEME("AccentColor2")),SETATREFEXPR(RGB(211,211,171))))
This formula is incorrect. If you try to change the Fill Format to another color, you will see both SETATREFEXPR() will contain same new color value! This makes the IF statement useless when a user changes the color!
It should have been written as: THEMEGUARD(IF(CELLISTHEMED(FALSE),THEME("AccentColor2"),SETATREFEXPR(RGB(211,211,171)))) (see the example at the bottom of CELLISTHEMED)

Note that in Visio 2013, this has been changed to: THEMEGUARD(IF(ISTHEMED(),THEMEVAL(),RGB(221,226,205)))

From the above, it looks to me that this shape is an old Visio shape that used old formulas and old techniques which possibly means that new techniques were not supported in the old days of Visio.
Also, Microsoft has advised many times not to resort to creating group and sub-shapes when the same result can be achieved by a single shape. This advice is mainly for efficiency reasons. (see this important article by Visio development team Flattening Groups and Groups versus Merged Shapes). Yes, Microsoft is not following their own advice in this shape and in many other shapes!

For "1-D Single" shape, you can achieve the same result by a single shape instead of 4 shapes (the group shape itself is counted as a shape). The idea is simple: you don't need a shape for a fill and another shape for an outline. The fill and outline can be achieved by a single shape. Also, the 'Open' and 'Close' tail effect can be achieved without having a third shape to 'cover' the tail. This is actually a bad design. You can achieve the 'Open' and 'Close' tail by controlling the position of the last vertex.
If you look closely at the vertices in the Geometry section of Sheet.2 (Fill Shape) and Sheet.3 (Outline Shape), you will see there are 7 vertices for Sheet.2 and 8 vertices for Sheet.3. What you need is 8 vertices. However, in the Y cell of vertex 8, you need to position it conditionally: Geometry1.Y8 = IF(Scratch.C1,Geometry1.Y7,Geometry1.Y1) .

Probably the easiest way is to ungroup the "1-D Single" shape and make the outline shape to have all features of the original "1-D Single" master. And you will need to do some additional work to create same Action and Scratch cells in this shape to what used to be in the original shape (this is what Paul Herber is trying to warn you about!).
Also, remember to convert this 2-D outline shape to 1-D shape before you do any work (this article might be helpful). Remove the GUARD() from LinePattern, LineColor.
And make sure LineCap = 1  so that the outline doesn't extend beyond the shape fill when 'Open' tail is selected.

There should be some basic ShapeSheet concepts I still don't know...
While Visio is a very cool diagramming program, you will find there are many weird and inconsistent things around specially in ShapeSheet.
You are not alone!  8)

Yousuf.
« Last Edit: January 05, 2014, 12:35:13 AM by nashwaan »
Give me six hours to chop down a tree and I will spend the first four sharpening the axe — Abraham Lincoln