I see this thread is rather old (2009) but I'm coming across the same sort of issue getting more than what I define as my SelectCrossingWindow corners. I made sure to define it not to include neighboring lines\entities, but depending on the current zoom, it selects objects outside my defined areas. It is like there is some sort of 'padding' around the window. I made sure to turn snaps off. Is there some sort of rounding going on that I don't know about when the zoom display is way out?
Only work around I can think of is to store the current display area, zoom into my selectwindow area and do my thing, then restore back to previous zoom area.
Am I doing something wrong?
Thanks for any feedback.
Public Sub SelectObjectsByCrossingWindow()
Dim acDocEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
'capture and remove snapmodes
Dim SnapStore As Int32 = Application.GetSystemVariable("OSMODE")
Application.SetSystemVariable("OSMODE", 0) '0= none
Dim acSSPrompt As PromptSelectionResult
dim pt1 as new Point3d(8.099309, 8.428606, 0)
Dim pt2 as new Point3d(7.372191, 10.549490, 0)
acSSPrompt = acDocEd.SelectCrossingWindow(pt1, pt2)
Using acTrans As Transaction = db.TransactionManager.StartTransaction()
'' If the prompt status is OK, objects were selected
If acSSPrompt.Status = PromptStatus.OK Then
Dim acSSet As SelectionSet = acSSPrompt.Value
For Each acSSObj As SelectedObject In acSSet
If Not IsDBNull(acSSObj) Then
Dim acEnt As Entity = acTrans.GetObject(acSSObj.ObjectId,OpenMode.ForWrite)
' acEnt.Erase
acEnt.ColorIndex = 6
End If
Next
'save the the changes to the database
acTrans.Commit()
Application.ShowAlertDialog("Number of objects selected: " & _
acSSet.Count.ToString())
Else
Application.ShowAlertDialog("Number of objects selected: 0")
End If
End Using
Application.SetSystemVariable("OSMODE", SnapStore)
End Sub