But i need to trim off the lines crossing the polygon which EXTRIM would do greatly..So i have to use it..Lemme post wat i have done so far..it almost does the task i want..but the sided of EXTRIM command is randomly taken..at times it trims and deletes lines inside the boundary..i always want t trim outside of the boundary..any modification id the macro is welcome..
Public Sub EraseUnselected()
Dim objSelSet As AcadSelectionSet
Dim objUnSelectedSet As AcadSelectionSet
Dim objEnts() As AcadEntity
Dim lngCnt As Long, Coords As Variant, new_ent As AcadEntity
Dim Pt3 As Variant, Pt1 As Variant, Unwanted_ent As AcadEntity
Dim PolygnPline As AcadLWPolyline, PolygonCoords As Variant
Dim lwpline As AcadLWPolyline
Dim varLL As Variant, varUR As Variant
'On Error GoTo Err_Control
KillSSet ("Unselected")
Set objSelSet = ThisDrawing.PickfirstSelectionSet
Set objUnSelectedSet = ThisDrawing.SelectionSets.Add("Unselected")
objSelSet.SelectOnScreen
'objSelSet.Select acSelectionSetCrossing, varLL, varUR
objUnSelectedSet.Select acSelectionSetAll
ReDim objEnts(0 To objSelSet.Count - 1) As AcadEntity
For lngCnt = 0 To objSelSet.Count - 1
Set objEnts(lngCnt) = objSelSet(lngCnt)
Set new_ent = objEnts(lngCnt)
Set PolygnPline = new_ent
new_ent.GetBoundingBox Pt3, Pt1
ThisDrawing.SendCommand "_extrim" & vbCr & Pt1(0) & "," & Pt1(1) & vbCr & Pt3(0) & "," & Pt3(1) & vbCr
Next lngCnt
objUnSelectedSet.RemoveItems Unwanted_ent
objUnSelectedSet.Erase
objSelSet.Delete
objUnSelectedSet.Delete
Exit_Here:
Exit Sub
Err_Control:
Select Case Err.Number
Case -2145320851
For lngCnt = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(lngCnt).Name = "Unselected" Then
Set objUnSelectedSet = ThisDrawing.SelectionSets.Item(lngCnt)
Resume Next
Else
Resume Exit_Here
End If
Next
Case Else
InputBox Err.Description, "Erase Unselected", Err.Number
Resume Exit_Here
End Select
End Sub
Please have a look at the code and tel me any ideas ...