Daniel Ulbrich
Home > Visual Basic > VBA > AutoCAD® > Länge einer Multilinie
Menü
Login-Formular
Letzte Änderung:
August 29. 2008 23:58:13
en

Länge einer Multilinie

Sub len_mlinie()
Dim sset As AcadSelectionSet
Dim entry As Object
Dim points As Variant
Dim ph1(2) As Double, ph2(2) As Double

On Error GoTo errorh:
Set sset = ThisDrawing.SelectionSets.Add("SS1")
sset.SelectOnScreen

For Each entry In sset
    If entry.EntityName = "AcDbMline" Then
        points = entry.Coordinates
        ph1(0) = points(0): ph1(1) = points(1): ph1(2) = points(2)
        ph2(0) = points(3): ph2(1) = points(4): ph2(2) = points(5)
        hl = distance(ph1, ph2)
        MsgBox "Länge der Multilinie ist " & hl
        hlx = hlx + hl
    End If
Next entry

sset.Delete
MsgBox "Gesamtlänge der Multilinie ist " & hlx
Exit Sub
errorh:
    sset.Delete
    MsgBox Err.Description & vbCrLf & Err.Number

End Sub

 

© 2006-2008 Daniel Ulbrich | Alle Rechte vorbehalten | Impressum
Powered by CMSimple | Template Design by NMuD