Connected Shape Lines

Started by zindolie, March 05, 2009, 05:46:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

how can i see conneted shape lines in page at once

method?
0 (0%)
vba?
0 (0%)

Total Members Voted: 0

zindolie

 ???
hello. masters.

i wonder how can i see conneted shape lines in page at once.

i use visio 2003

if shapes connected line. it's shown red rectangle box ends of line

but it's only one line. if i select two or more, it's not appear.

only shown green rectangle. it's not my hopes

i want to see all line's ends.

whether it's connected? or not. i want know to easy way..

plz. help me.. any method, any reply for me.

have a nice day.

JuneTheSecond

#1
Hi,
I think Visio does not have such a function.
But we can check connections with macro.
This test code change colors, if connections
are not complete.
Sub test()
    Dim conn As Visio.Shape
    For Each conn In ActivePage.Shapes
        If conn.LayerCount > 0 Then
            If conn.Layer(1).NameU = "Connector" Then
                Debug.Print conn.NameU, conn.Connects.Count
                If conn.Connects.Count = 2 Then
                    conn.Cells("LineColor").Formula = "THEME(""ConnectorColor"")" 'Black
                ElseIf conn.Connects.Count = 1 Then
                    Debug.Print conn.Connects(1).FromCell.Name 'Connected End
                    conn.Cells("LineColor").Formula = "THEMEGUARD(RGB(0,176,80))" 'Green
                ElseIf conn.Connects.Count = 0 Then
                    conn.Cells("LineColor").Formula = "THEMEGUARD(RGB(255,0,0))" 'Red
                End If
            End If
        End If
    Next
End Sub

Best Regards,

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

zindolie

thank you for reply. :o

i tested it. but it's not work.. nothing happend.

i made macro and execute.. it's not works even if no error.

what's wrong. plz. help me.. masters..

help me. :'(

Paul Herber

Unfortunately Visio 2003 doesn't have themes:


Sub test()
    Dim conn As Visio.Shape
    For Each conn In ActivePage.Shapes
        If conn.LayerCount > 0 Then
            If conn.Layer(1).NameU = "Connector" Then
                Debug.Print conn.NameU, conn.Connects.Count
                If conn.Connects.Count = 2 Then
                    conn.Cells("LineColor").Formula = "0"  'black
                ElseIf conn.Connects.Count = 1 Then
                    Debug.Print conn.Connects(1).FromCell.Name 'Connected End
                    conn.Cells("LineColor").Formula = "9"  'green
                ElseIf conn.Connects.Count = 0 Then
                    conn.Cells("LineColor").Formula = "2"  'red
                End If
            End If
        End If
    Next
End Sub


Electronic and Electrical engineering, business and software stencils for Visio -

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

zindolie

thank you for your help.

but. also it's not working.

what's the problem?

so i attached a file sample.vsd

what i said lines in this file. maybe I couldnt explain that properly isn't it?

please. help me. :'(


Paul Herber

The original question and JTS's response assumed your connectors would be on a connector layer:


Sub test()
    Dim conn As Visio.Shape
    For Each conn In ActivePage.Shapes
        If conn.Master = "CABLE" Then
            Debug.Print conn.NameU, conn.Connects.Count
            If conn.Connects.Count = 2 Then
                conn.Cells("LineColor").Formula = "0"  'black
            ElseIf conn.Connects.Count = 1 Then
                Debug.Print conn.Connects(1).FromCell.Name 'Connected End
                conn.Cells("LineColor").Formula = "9"  'green
            ElseIf conn.Connects.Count = 0 Then
                conn.Cells("LineColor").Formula = "2"  'red
            End If
        End If
    Next
End Sub

Electronic and Electrical engineering, business and software stencils for Visio -

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

zindolie

#6
 :)
thank you so much.

it's working. thank you verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry much~!!

one more thing.
if, i have many Master? (whether or not it's proper such called?)

how can i change code?

if i want only 1D lines. how can i fix it?

help~ help~.. :'(

aledlund

working from Paul's code


Sub test2()
    Dim conn As Visio.Shape
    For Each conn In ActivePage.Shapes
        ' dangerous because not all oneD shapes are connectors
        If conn.OneD = True Then
            ' add test here for master shapes "cable", "dynamic connector", etc
            Debug.Print conn.NameU, conn.Connects.Count
            If conn.Connects.Count = 2 Then
                conn.Cells("LineColor").Formula = "0"  'black
            ElseIf conn.Connects.Count = 1 Then
                Debug.Print conn.Connects(1).FromCell.Name 'Connected End
                conn.Cells("LineColor").Formula = "9"  'green
            ElseIf conn.Connects.Count = 0 Then
                conn.Cells("LineColor").Formula = "2"  'red
            End If
        End If
    Next
End Sub

zindolie

#8
 :D

thank you for your help.

I want to change or visible action when connectors isn't connected one shape and the other.

so the connectors or lines must be Identified but it's various. It's a problem.

I wonder It's simple way to find that common properties?

How about check the Custom Properties? Label or Prompt such like that  ???

that's same properties.

and line type? all line's solid. it's LinePattern 1 in the ShapeSheet.

help me. :'(

aledlund


Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

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

aledlund

Gomen nasai junichi san,
al

Lars-Erik

Interesting... it says "sorry" something  ???
what does the "junichi san" part mean exactly? enlighten us! My Japanese is ... well ... none existent.

Paul Herber

That is it, sorry Junichi ('san' is an honourific)
Junichi3

Electronic and Electrical engineering, business and software stencils for Visio -

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

Lars-Erik

Doh! it's his name!  ::)
My last offtopic post dont worry.