Re: Macro to add a connection point to the center of every circle in a dwg

From: Markus Breugst (markus.breugst__AT__gedilan-technologies.de)
Date: 07/29/04


Date: Thu, 29 Jul 2004 14:23:32 +0200

Hi,

I don't know how to find out if the shape is a circle, since these basic
shapes don't seem to have a master. Thus, the macro below just adds one
connection point to the middle of each selected(!) shape, independent of its
type.
Note that the function below does not check if the connection point already
exists. However, it's just meant as an example to show how this could work.

Best regards,
Markus

Public Sub AddConnectionPoint()
    Dim selectedShapes As Selection
    Dim theShape As Shape
    Dim index As Integer
    Dim rowNumber As Integer

    Set selectedShapes = ActiveWindow.Selection

    For index = 1 To selectedShapes.Count
        Set theShape = selectedShapes.Item(index)
        If theShape.SectionExists(Visio.visSectionConnectionPts, 1) = False
Then
            theShape.AddSection (Visio.visSectionConnectionPts)
        End If
        rowNumber = theShape.AddRow(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, Visio.VisRowTags.visTagCnnctPt)
        theShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, Visio.visX).Formula = "=Width/2"
        theShape.CellsSRC(Visio.visSectionConnectionPts,
Visio.visRowConnectionPts, Visio.visY).Formula = "=Height/2"
    Next
End Sub

"Yury" <ymonakov@skycapitalholdings.com> schrieb im Newsbeitrag
news:es2SJX0cEHA.2268@TK2MSFTNGP12.phx.gbl...
> Hello, I'm trying to figure out how to add a connection point that is
> relative to a shape, such as the center of a circle. I'm used to doing
this
> in Autocad, but not in visio. Can someone show me how to make a macro or
> know if one already esists that can find all the circle shapes in a
drawing,
> and insert a connection point at the center of each one.
>
> (Usiing visio2003)
>
> Thanks in advance..
>
>



Relevant Pages