Un-Join Line Segments

A

ajfisher98

How do I (un)Join two or more line segments in Visio? I know you can opt to
start a new line from the endpoint of a line that is selected, thereby
"joining" the two together or opt to double click before starting a new line
from the endpoint of a line that is now not selected, thereby keeping the two
line segments as individual lines though they look the same either way.
However, for the life of me, I cannot figure out how to (un)join two line
segments after the first option has been used. My only option at this point
is to delete the joined line segments and use the above mentioned option 2. I
am revising many drawings with numerous joined segments and it is very
tedious redrawing every single line! Please help!
 
D

David Parker [Visio MVP]

I'm not sure why you would want to do this. It is counter to normal
practice.
Are you aware of the Pencil Tool that allows you to move, delete, or insert
vertices, or to change a straight line into a curve?
 
A

ajfisher98

Thank you for the response but all that does is change the shape of the still
joined shape leaving the remaining line segments still joined as a shape,
all-be-it a new shape. Or it deletes all of the line segments of the shape
altogether.
Any other ideas?
 
D

David Parker [Visio MVP]

Then I think that you cannot do what you want with the Visio UI, but you can
using VBA.
 
P

Pemo

ajfisher98 said:
How do I (un)Join two or more line segments in Visio? I know you can opt to
start a new line from the endpoint of a line that is selected, thereby
"joining" the two together or opt to double click before starting a new line
from the endpoint of a line that is now not selected, thereby keeping the two
line segments as individual lines though they look the same either way.
However, for the life of me, I cannot figure out how to (un)join two line
segments after the first option has been used. My only option at this point
is to delete the joined line segments and use the above mentioned option 2. I
am revising many drawings with numerous joined segments and it is very
tedious redrawing every single line! Please help!

Draw a separate line thru the vertex (or other point you want to break the
line), and trim the shapes (Shape | Operations |Trim).

To do this with many lines of many drawings would be tedious by any method.
If you could give us an idea why you need to do it might open other
possibilities.

Pemo
 
A

ajfisher98

I need all linesegments independent of each other so that they can be
formatted differently; line thickness & style, color, etc.
 
D

David Parker [Visio MVP]

UI = User Interface (the bits seen and used by non-programmers)
VBA = Visual Basic for Applications / Macros (available in Office apps and
others) - requires a liitle bit of prgramming knowledge to use properly
 
A

ajfisher98

Care to want to program some VB for me? :)

David Parker said:
UI = User Interface (the bits seen and used by non-programmers)
VBA = Visual Basic for Applications / Macros (available in Office apps and
others) - requires a liitle bit of prgramming knowledge to use properly
 
D

David Parker [Visio MVP]

Here follows 3 alternatives to your problem (change the Action code to
suit):
Cut'n'paste into VBA, select multi-segment shape, then run
ReplaceShapesWithLines

Public Sub ReplaceShapesWithLines()
Dim shp As Visio.Shape
For Each shp In Visio.ActiveWindow.Selection
' Action : 0 = Leave orignal, 1 = Delete original, 2 = Group
original
ReplaceShapeWithLines shp, 2
Next shp
End Sub

Public Sub ReplaceShapeWithLines(ByVal shp As Visio.Shape, ByVal Action As
Integer)
'Split multi-segment lines - Assumes just one geomtry section
' Action : 0 = Leave orignal, 1 = Delete original, 2 = Group original
Dim iRow As Integer
Dim BeginX As Double
Dim EndX As Double
Dim BeginY As Double
Dim EndY As Double
Dim line As Visio.Shape

Select Case Action
Case 0

For iRow = 2 To shp.RowCount(Visio.visSectionFirstComponent) - 1
BeginX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visX).ResultIU + (shp.Cells("PinX").ResultIU -
shp.Cells("LocPinX").ResultIU)
BeginY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visY).ResultIU + (shp.Cells("PinY").ResultIU -
shp.Cells("LocPinY").ResultIU)
EndX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visX).ResultIU + (shp.Cells("PinX").ResultIU -
shp.Cells("LocPinX").ResultIU)
EndY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visY).ResultIU + (shp.Cells("PinY").ResultIU -
shp.Cells("LocPinY").ResultIU)
Set line = shp.ContainingPage.DrawLine(BeginX, BeginY, EndX,
EndY)
Next iRow

Case 1

For iRow = 2 To shp.RowCount(Visio.visSectionFirstComponent) - 1
BeginX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visX).ResultIU + (shp.Cells("PinX").ResultIU -
shp.Cells("LocPinX").ResultIU)
BeginY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visY).ResultIU + (shp.Cells("PinY").ResultIU -
shp.Cells("LocPinY").ResultIU)
EndX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visX).ResultIU + (shp.Cells("PinX").ResultIU -
shp.Cells("LocPinX").ResultIU)
EndY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visY).ResultIU + (shp.Cells("PinY").ResultIU -
shp.Cells("LocPinY").ResultIU)
Set line = shp.ContainingPage.DrawLine(BeginX, BeginY, EndX,
EndY)
Next iRow

shp.Delete

Case 2

shp.ConvertToGroup
For iRow = 2 To shp.RowCount(Visio.visSectionFirstComponent) - 1
BeginX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visX).ResultIU
BeginY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow -
1, Visio.visY).ResultIU
EndX = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visX).ResultIU
EndY = shp.CellsSRC(Visio.visSectionFirstComponent, iRow,
Visio.visY).ResultIU
Set line = shp.DrawLine(BeginX, BeginY, EndX, EndY)
Next iRow
shp.DeleteSection Visio.visSectionFirstComponent
End Select

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top