Hide group that is a part of smart-shape

Started by ivan, April 04, 2009, 10:15:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ivan

I'm making  a smartshape. it consists of several group shapes. i need to hide several of them depending to smart shape proporties. like if Prop.NY=6 i need all of the shapes to be shown, if  Prop.NY=5 i need lower one to be hidden etc.
atm i only managed to set nonprint parameter. cause there're like dozens of sections in geometry, i can't get how to make "Noshow" wwork properly.
example attached

JuneTheSecond

Hi,

You must set noshow to all geometry sections in sub and sub-sub-.... shapes.
Do you know how many stages of sub-shapes in the group?
How would you like to mask the group with a white shape?
Best Regards,

Junichi Yoda
http://june.minibird.jp/

ivan

QuoteYou must set noshow to all geometry sections in sub and sub-sub-.... shapes.
Do you know how many stages of sub-shapes in the group?
i have no idea. i used jion operation to make that shape. i tired to fill all geometry sections but i saw no results after like a dozen sections. i need a better way...
QuoteHow would you like to mask the group with a white shape?
can't get you. you mean hide part of it with white shape above or set its color to white ?

wapperdude

Junichi is correct.  You must get down to the lowest sub-level where the actual shape geometries exist and hide them at that point.

To avoid doing that, you need to redraw the shapes so that they are a single geometry.  This can be done without too much difficulty in the case of your example.  Starting at the left most point:  draw your horizontal line, and continue it turning upward to the top point, then continue the line downward to the bottom point.  This should give you a "T" on it's side.  Now continue over to the lower point of the diagonal line, still making this all one line segament and then diagonal up to complete the slanted line segment, and then over to the box edge.  The trick is to make this all one line segment.   :o  Continue until you've finished your figue.  I've attached a file to show what you should have.   ???


Now open the shapesheet and go to the geometry section.  You will need to change two line types to "move to" and insert a line as "move to".  Sounds complicated, but the blue figure is the result.  Easiest way is to compare the shapesheet geometry sections.   :P

This technique is suitable for many replications of the same shape and avoids using macros.

HTH
Wapperdude
Visio 2019 Pro

ivan

Quote from: wapperdude on April 04, 2009, 02:59:16 PMTo avoid doing that, you need to redraw the shapes so that they are a single geometry.
nice example. it solves the problem for this time. but imho it's not user friendly way to go... it's quite hard to build shape this way. thus simple hiding of the whole group would be a great feature for next visio release imho. i have to check feature request list :)

wapperdude

Quite right!  Not a technique that you would use for anything other than fairly simple shapes, and then, it only pays off if you use the shape a lot.

It would be very nice to be able to use the group to control sub-group features via the shapesheet.  Anyway, it was just an optional approach.
Visio 2019 Pro

vojo

at the highest level, you could put an action or custom prop to turn on or off different subshapes.
In each subshape, the geometry can use the highest level to trigger show hide.

I actually find it fairly useful for complex shapes.

Visio Guy

If you want to understand hiding Visio shapes and their bits and pieces, you should really check out this article:

The Hidden World of Visio Shapes

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

ivan

#8
Quote from: Visio Guy on April 06, 2009, 07:39:46 AM
If you want to understand hiding Visio shapes and their bits and pieces, you should really check out this article:
The Hidden World of Visio Shapes
i see the same thesis there
QuoteOf course, sometimes you may want to hide an entire shape, like when it is a sub-shape inside of a group. In this case, you have to set every single NoShow cell in each geometry section, because there is no cell that hides the entire shape.
but it's very uncomfortable with complex shape (( i wonder if it's possible to create macros that will add some custom formula to every noshow geometry cell in shape group ? i got several tasks where i need to hide groups and filling all sub-shapes by hand is hard and time-consuming ((
In common i need an array of similiar shapes displayed on the screen. number of these shapes is defined in group shape data. atm i'm drawing array with as many shapes i want and then hiding part of them i wonder if there's a better solution ?

Visio Guy

Hi bdfy,

When I make anything more than a simple shape, I always create/use a bunch of VBA tools to get things done programmatically.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

JuneTheSecond

Best Regards,

Junichi Yoda
http://june.minibird.jp/

scott

#11
bdfy,

To answer your question about writing a macro to set NoShow in all Geometry sections -- yes, you certainly can do that. The code below shows one idea. ShowHideBasedOnDocSheet uses a cell in the user section of the document sheet to control the NoShow value in all geometry sections of a shape. The other two macros change the docsheet user cell. As you'll see, the shape reacts accordingly.



Sub ShowHideBasedOnDocSheet()
' uses DocumentSheet user cell to show/hide all geometry sections in a shape

    Dim doc As Document
    Dim shp As Shape
   
    Set doc = ActiveDocument
    ' create user cell in docsheet if it doesn't exist
    If Not doc.DocumentSheet.CellExists("User.HideGeometry", False) Then
        doc.DocumentSheet.AddNamedRow visSectionUser, "HideGeometry", _
            visTagDefault
    End If
    ' set docsheet cell to false so all geometry sections appear
    doc.DocumentSheet.Cells("User.HideGeometry") = False
   
    ' grab first shape on page
    Set shp = ActivePage.Shapes(1)
    If shp.SectionExists(visSectionFirstComponent, False) Then
        For i = 0 To shp.GeometryCount - 1
            ' equate each geometry section's NoShow cell to docsheet user cell
            shp.CellsSRC(visSectionFirstComponent + i, visRowComponent, visCompNoShow).FormulaU = _
                "TheDoc!User.HideGeometry"
        Next i
    End If
End Sub
Sub Show()
    Set doc = ActiveDocument
    ' create user cell in docsheet if it doesn't exist
    If Not doc.DocumentSheet.CellExists("User.HideGeometry", False) Then
        doc.DocumentSheet.AddNamedRow visSectionUser, "HideGeometry", _
            visTagDefault
    End If
    ' set docsheet cell to false so all geometry sections appear
    doc.DocumentSheet.Cells("User.HideGeometry") = False
End Sub
Sub Hide()
    Set doc = ActiveDocument
    ' create user cell in docsheet if it doesn't exist
    If Not doc.DocumentSheet.CellExists("User.HideGeometry", False) Then
        doc.DocumentSheet.AddNamedRow visSectionUser, "HideGeometry", _
            visTagDefault
    End If
    ' set docsheet cell to true so all geometry sections disappear
    doc.DocumentSheet.Cells("User.HideGeometry") = True
End Sub