i'm working on some code that will remove lines / polylines with zero length from the dwg, as well as (m)text objects that are null. The text piece has been handled. I'm having trouble getting the length of the polyline. After searching the ng and google, i'm still at square one. My problem is figuring out how to iterate thru the coords collection. Would someone please point me in the right direction? thanks! zero length deletion: [code] Private Sub delete_zero_length() Dim mySS As AcadSelectionSet Dim oEnt As AcadEntity Dim grpCode(0 To 4) As Integer Dim dataVal(0 To 4) As Variant Dim intLineCtr As Integer Dim oLayer As AcadLayer Dim bIsLocked As Boolean Dim FUZZ As Double Dim dblPlineLength As Double Dim dblTempDist As Double Dim Coords As Variant Dim i As Integer FUZZ = 0.0001 ' Build a selection set of group codes and values to filter for: Text or Mtext. grpCode(0) = -4 dataVal(0) = "<OR" grpCode(1) = 0 dataVal(1) = "LINE" grpCode(2) = 0 dataVal(2) = "LWPOLYLINE" grpCode(3) = 0 dataVal(3) = "POLYLINE" grpCode(4) = -4 dataVal(4) = "OR>" 'build selection set of (m)text entities 'Set mySS = BuildSelectionSet("Select TEXT or MTEXT to switch:", grpCode, dataVal) Set mySS = vbdPowerSet("$TEMP$") mySS.Select acSelectionSetAll, , , grpCode, dataVal 'Me.Hide 'mySS.SelectOnScreen grpCode, dataVal Dim PT1(1) As Variant Dim PT2(1) As Variant For Each oEnt In mySS If TypeOf oEnt Is AcadLine Then If oEnt.length < FUZZ Then Set oLayer = ThisDrawing.Layers(oEnt.Layer) 'Debug.Print oLayer.Name bIsLocked = oLayer.Lock oLayer.Lock = False oEnt.Delete UpdateStatus "Deleting Zero Length P/Line found on: " & oLayer.Name DoEvents oLayer.Lock = bIsLocked Set oLayer = Nothing intLineCtr = intLineCtr + 1 End If ElseIf TypeOf oEnt Is AcadPolyline Then Coords = oEnt.Coordinates For i = LBound(Coords) To UBound(Coords) Step 4 PT1(0) = Coords(i) PT1(1) = Coords(i + 1) PT2(0) = Coords(i + 2) PT2(1) = Coords(i + 3) dblTempDist = dblTempDist + getDistance(PT1, PT2) Next ElseIf TypeOf oEnt Is AcadLWPolyline Then Coords = oEnt.Coordinates For i = LBound(Coords) To UBound(Coords) Step 2 PT1(0) = Coords(i) PT1(1) = Coords(i + 1) PT2(0) = Coords(i + 2) PT2(1) = Coords(i + 3) dblTempDist = dblTempDist + getDistance(PT1, PT2) Next dblPlineLength = dblTempDist If dblPlineLength = 0 And oEnt.Area = 0 Then Set oLayer = ThisDrawing.Layers(oEnt.Layer) 'Debug.Print oLayer.Name bIsLocked = oLayer.Lock oLayer.Lock = False 'oEnt.Delete oEnt.Color = acGreen oLayer.Lock = bIsLocked Set oLayer = Nothing intLineCtr = intLineCtr + 1 End If End If Next Me.lblDeletedLineCount.Caption = CStr(intLineCtr) DoEvents End Sub [/code] text deletion: [code] Private Sub Delete_All_Empty_Text() Dim mySS As AcadSelectionSet Dim oEnt As AcadEntity Dim grpCode(0 To 3) As Integer Dim dataVal(0 To 3) As Variant Dim intLineCtr As Integer Dim oLayer As AcadLayer Dim bIsLocked As Boolean ' Build a selection set of group codes and values to filter for: Text or Mtext. grpCode(0) = -4 dataVal(0) = "<OR" grpCode(1) = 0 dataVal(1) = "TEXT" grpCode(2) = 0 dataVal(2) = "MTEXT" grpCode(3) = -4 dataVal(3) = "OR>" 'build selection set of (m)text entities 'Set mySS = BuildSelectionSet("Select TEXT or MTEXT to switch:", grpCode, dataVal) Set mySS = vbdPowerSet("$TEMP$") mySS.Select acSelectionSetAll, , , grpCode, dataVal For Each oEnt In mySS If TypeOf oEnt Is AcadText Or TypeOf oEnt Is AcadMText Then If Trim(oEnt.TextString) = vbNullString Then Set oLayer = ThisDrawing.Layers(oEnt.Layer) 'Debug.Print oLayer.Name bIsLocked = oLayer.Lock oLayer.Lock = False oEnt.Delete UpdateStatus "Deleting text found on: " & oLayer.Name DoEvents oLayer.Lock = bIsLocked Set oLayer = Nothing intLineCtr = intLineCtr + 1 End If End If Next Me.lblDeletedTextCount.Caption = CStr(intLineCtr) DoEvents End Sub [/code]