D
DigitalHomeSolutions
I have been working on this for a month and I can't get it! I NEED help
please. I have been all over the net. I am trying to get the true length of a
connector not the sum of the coordinates. If I have a line that say, layman
terms, goes down, right, up, right, up on a visio drawing, how do I get the
correct length? This is what I have so far, it was given to me from another
post, I have Visio 2002 SP2:
Public Sub SetTextToLenghtIU()
Dim shp As Visio.Shape
For Each shp In Visio.ActiveWindow.Selection
GetLengthIU shp
Next shp
End Sub
Public Sub GetLengthIU(ByVal shp As Visio.Shape)
'This should work! (But it doesn't in Visio 2003)
If shp.OneD <> 0 Then
shp.Text = shp.LengthIU = (False)
End If
'Fix for simple multi-segment lines - Assumes just one geometry section with
'straight line segments
Dim dseg As Double
Dim dtotal As Double
Dim irow As Integer
Dim BeginX As Double
Dim EndX As Double
Dim BeginY As Double
Dim EndY As Double
For irow = 2 To shp.RowCount(Visio.visSectionFirstComponent)
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
dseg = Sqr((EndX - BeginX) ^ 2 + ((EndY - BeginY)) ^ 2)
dtotal = dtotal + dseg
Next irow
shp.Text = dtotal
End Sub
please. I have been all over the net. I am trying to get the true length of a
connector not the sum of the coordinates. If I have a line that say, layman
terms, goes down, right, up, right, up on a visio drawing, how do I get the
correct length? This is what I have so far, it was given to me from another
post, I have Visio 2002 SP2:
Public Sub SetTextToLenghtIU()
Dim shp As Visio.Shape
For Each shp In Visio.ActiveWindow.Selection
GetLengthIU shp
Next shp
End Sub
Public Sub GetLengthIU(ByVal shp As Visio.Shape)
'This should work! (But it doesn't in Visio 2003)
If shp.OneD <> 0 Then
shp.Text = shp.LengthIU = (False)
End If
'Fix for simple multi-segment lines - Assumes just one geometry section with
'straight line segments
Dim dseg As Double
Dim dtotal As Double
Dim irow As Integer
Dim BeginX As Double
Dim EndX As Double
Dim BeginY As Double
Dim EndY As Double
For irow = 2 To shp.RowCount(Visio.visSectionFirstComponent)
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
dseg = Sqr((EndX - BeginX) ^ 2 + ((EndY - BeginY)) ^ 2)
dtotal = dtotal + dseg
Next irow
shp.Text = dtotal
End Sub