Visio "Eraser Tool"

Started by Yacine, June 10, 2010, 07:15:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

I read this old topic and thought that I can't really agree with Visio Guy...

call a macro from the XFMod event and erase your shape from shapes underneath it:
Sub move(Shp As Visio.Shape)
Dim ShpToCut As Visio.Selection
Dim temp3 As Visio.Shape
a = 1
x = Shp.Cells("pinx")
y = Shp.Cells("piny")
w = Shp.Cells("Width")
h = Shp.Cells("height")
    ActiveWindow.DeselectAll
Set ShpToCut = Shp.SpatialNeighbors(visSpatialOverlap + visSpatialTouching + visSpatialContain + visSpatialContainedIn, 0.1, visSpatialFrontToBack)
If ShpToCut.Count > 0 Then
    Set temp = ActivePage.DrawOval(x - w / 2, y - h / 2, x + w / 2, y + w / 2)
    For i = 1 To ShpToCut.Count
        Debug.Print ShpToCut.Item(i).ID
        ActiveWindow.Select ShpToCut.Item(i), visSelect
    Next i
        ActiveWindow.Select temp, visSelect
        Application.ActiveWindow.Selection.Fragment
    Shp.BringToFront
End If
End Sub


If I knew the names of the shapes created I could even erase the "rubber dust"  :D
Yacine

Noisy Cricket

HMM.... this could easily be a nice way to shoot holes in your boss' imported picture in Visio :)
Or anything else for that matter.


Visio Guy

I think I wrote something long ago that did the opposite: whenever you moved a shape, and it overlapped another, they did a Union, and basically got "assimilated by the Borg". It was pretty cool...
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010