Visio Guy

Visio Discussions => Visio 2013 Issues => Topic started by: dtallent on February 07, 2017, 01:16:17 PM

Title: turn off Shape Protection
Post by: dtallent on February 07, 2017, 01:16:17 PM
I am thinking shape protection is my issue. The file I attached is a set of sidewalks on a plot plan for one of our properties. Some of the sidewalks are wrong or have moved. How do I unlock this so I can change them around? Thanks.
Title: Re: turn off Shape Protection
Post by: wapperdude on February 07, 2017, 03:22:19 PM
Can you upload vsd file?

Wapperdude
Title: Re: turn off Shape Protection
Post by: Nikolay on February 07, 2017, 05:11:41 PM
There is no protection on your shape.
It is just your whole drawing is now one single complex shape, containing many geometries (lines).
You can just select the "Line" tool and start moving the lines/vertexes around the way you want.
If creating a single complex shape was not your intent, then you can split it into separate shapes/lines using "trim" command for example.
Title: Re: turn off Shape Protection
Post by: wapperdude on February 07, 2017, 05:35:27 PM
Was this an imported image and not drawn with Visio shapes?

Wapperdude
Title: Re: turn off Shape Protection
Post by: dtallent on February 21, 2017, 04:33:51 PM
Attached is the file I am trying to unlock. The attached file is a set of sidewalks for one o four properties. A previous employee created them and locked the sidewalks together. I am trying to find out how to unlock them so I can move them around without having to trace a new line over each line.
Title: Re: turn off Shape Protection
Post by: wapperdude on February 21, 2017, 04:43:08 PM
Can you upload vs version?

Wapperdude
Title: Re: turn off Shape Protection
Post by: dtallent on February 21, 2017, 04:54:48 PM
The attached is the same section only I ended up laying a new line over each and deleting the goofy thing.
Title: Re: turn off Shape Protection
Post by: wapperdude on February 21, 2017, 05:36:15 PM
Sorry, had a typo...vsd file, not vsdx.

Title: Re: turn off Shape Protection
Post by: dtallent on February 22, 2017, 08:11:36 AM
Ok how do I change it to a vsd? Everything I try saves it with an x.
Title: Re: turn off Shape Protection
Post by: dtallent on February 22, 2017, 08:13:41 AM
here we go
Title: Re: turn off Shape Protection
Post by: Croc on February 22, 2017, 09:08:07 AM
dtallent,
Such macro will cut shape on separate lines.

Code
Sub ttt()
    Dim sh1 As Visio.Shape, sh2 As Visio.Shape
    Set sh1 = ActivePage.Shapes(1)
    Set sh2 = sh1.Duplicate
    sh2.Cells("PinX") = sh1.Cells("PinX")
    sh2.Cells("PinY") = sh1.Cells("PinY")
    ActiveWindow.SelectAll
    ActiveWindow.Selection.Trim
    n = ActivePage.Shapes.Count
    For i = n To n / 2 + 1 Step -1
        ActivePage.Shapes(i).Delete
    Next
End Sub
Title: Re: turn off Shape Protection
Post by: dtallent on February 22, 2017, 10:06:31 AM
Not to sound like an idiot, but can you break this down into some instructions. Do I need to type this somewhere and if so where. This is all Greek to me, but thanks for the help. I opened the attachment and it is exactly what I am trying to do.


dtallent,
Such macro will cut shape on separate lines.

Code
Sub ttt()
    Dim sh1 As Visio.Shape, sh2 As Visio.Shape
    Set sh1 = ActivePage.Shapes(1)
    Set sh2 = sh1.Duplicate
    sh2.Cells("PinX") = sh1.Cells("PinX")
    sh2.Cells("PinY") = sh1.Cells("PinY")
    ActiveWindow.SelectAll
    ActiveWindow.Selection.Trim
    n = ActivePage.Shapes.Count
    For i = n To n / 2 + 1 Step -1
        ActivePage.Shapes(i).Delete
    Next
End Sub
Title: Re: turn off Shape Protection
Post by: Croc on February 22, 2017, 10:37:38 AM
I sent a file that already have this macro.
This file can be used as a tool.
To break up a complex shape on the lines, do the following:
1. Remove all the shapes from the file "... trimmed."
2. Copy the complex shape on a page of file "... trimmed."
3. Press Alt + F8 and run the macro "ttt".
4. Copy the result into desired location.
Title: Re: turn off Shape Protection
Post by: dtallent on February 22, 2017, 02:05:03 PM
I guess now I want to be difficult. Is there a way to run this without removing the shape from the file. For example, this was one set of sidewalks from a plot plan. I may have 10 or so on each plan I need to unlock.
Title: Re: turn off Shape Protection
Post by: Croc on February 22, 2017, 03:10:22 PM
I've updated the macro.
This macro should trim the selected shape. Only one selected shape.
If a drawing has few such shapes, it is necessary to perform the macro several times.
A macro can be called from another document.

Code
Sub ttt()
    Dim sh1 As Visio.Shape, sh2 As Visio.Shape
    Set sh1 = ActiveWindow.Selection(1)
    Set sh2 = sh1.Duplicate
    MaxInd = sh2.Index
    sh2.Cells("PinX") = sh1.Cells("PinX")
    sh2.Cells("PinY") = sh1.Cells("PinY")
    ActiveWindow.DeselectAll
    ActiveWindow.Select sh1, visSelect
    ActiveWindow.Select sh2, visSelect
    ActiveWindow.Selection.Trim
    MaxInd2 = ActivePage.Shapes.Count
    n = (MaxInd2 - MaxInd) \ 2
    For i = MaxInd2 To MaxInd2 - n Step -1
        ActivePage.Shapes(i).Delete
    Next
End Sub

I tested the macro not enough. Use it carefully.
Title: Re: turn off Shape Protection
Post by: dtallent on February 22, 2017, 03:57:47 PM
I have been playing around with it and it took me a few, who am  kidding, it took me a lot of closing the file when it screwed up and then re-opening to try it. It finally worked. You guys are awesome.