Author Topic: SelectCrossingWindow giving me more results than I want  (Read 3815 times)

0 Members and 1 Guest are viewing this topic.

Spike Wilbury

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #15 on: July 30, 2009, 01:46:58 PM »
Esquivel: it seems it actually might be. i zoomed way in on it and ran it and it gave me the correct number (2). after, i did the opposite, zoomed out and it returned 6.

do you know what i need to do to make it consistent? - to make it give me what i visually see inside the box?

thanks so much.
Proctor

i remember doing something, if i found it, will try to post back... (but don't recall if it was done using C#)

Spike Wilbury

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #16 on: July 30, 2009, 02:57:52 PM »
http://discussion.autodesk.com/forums/thread.jspa?threadID=625944

I did a function in C# that might be useful and posted on the link above, give it a try look for where reads:  getEntitiesInOrder and my name on it...

follow the steps and see if helps.

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #17 on: July 30, 2009, 03:03:35 PM »
Esquivel: I'll take a look and see if i can make it work. Thanks for sending and also for figuring out what was going on. thank you very much!!!

Proctor
 

jnelson31

  • Mosquito
  • Posts: 1
Re: SelectCrossingWindow giving me more results than I want
« Reply #18 on: September 26, 2019, 10:10:49 AM »
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.


Code: [Select]
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