Make all layers visible under selection

Started by kmksana, June 07, 2020, 08:11:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kmksana

Hi All,

I am handling a documents consist of multiple layers overlapping each other.
I am trying to make the layers visible which goes through under selected area of the document.
Please let me know your thoughts.

San

Paul Herber

Layers in Visio are not the same as layers in many other graphics programs. What exactly are you trying to do?
Electronic and Electrical engineering, business and software stencils for Visio -

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

kmksana

Hi
thanks a lot
i have a vision document with lot of object as a base layer.
and there are multiple layers which defines the boundaries which are defined through separate layers.
boundaries could be multiple and overlapping and visible flag is false for these layers.
i am trying to select multiple object on the base   layers; which is visible, and trying to find all the boundaries (layers ) on top of these selected object by changing the visible flag from false to true.

 

vojo

just an fyi

Each geometry in a shape has a noshow cell (1 no show, 0 show).
Using either VBA or actions, you could build some logic around showing a shape

BTW, if you are trying to use layers to show the width/height of a group of shapes that might have some hidden based on criteria, be advised that width & height are the size of the selection box.   A given shape or subshape can be larger (or smaller) than the selection box (unless you know for sure, it is not).   In my experience, this happens more often with smart shapes (control handles, actions, shape data, etc) than simple shapes and is usually tied to the author's mindset when creating the shape.   Also, true for irregular / non rectangular simple shapes (look at a simple triangle).   It will depend on how much precision you want.  For shapes in this category, a lot of VBA is needed to determine the size of the shape projected on the drawing vs the shape selection box.

Finally, you might be better off define some fixed background in the group ( a rectangle) and have all the subshapes fit within that region.   Then all you need to do is determine the size of the background shape and know that all subshapes fit in that region

wapperdude

Perhaps this macro will get you started???  Select a shape, the macro then goes thru the layers assigned to that shape and makes them visible.  All shapes on those layers will become visible, unless, as Vojo indicates, they have noshow cell set.


Sub shwShpLyr()
    Dim vShp As Visio.Shape
    Dim lCnt As Integer
    Dim i As Integer
    Dim shpLyr As Visio.Layer
   
    Set vShp = ActiveWindow.Selection(1)
    lCnt = vShp.LayerCount
   
    For i = 1 To lCnt
        Set shpLyr = vShp.Layer(i)
        shpLyr.CellsC(visLayerVisible).FormulaU = "1"
    Next

End Sub
Visio 2019 Pro