.NET

.NET

Reply
Active Contributor
sdphg
Posts: 28
Registered: ‎05-21-2008
Message 1 of 5 (150 Views)

About ed.SelectWindow select range

150 Views, 4 Replies
04-12-2012 08:31 PM

I find the ed.SelectWindow is not always select the correct range. with drawing zoom out, the range is not within the two points specified, the range is larger than the actual range.that means the ed.SelectWindow can not be trusted.why and how can get rid of that?

thanks.

 

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 5 (143 Views)

Re: About ed.SelectWindow select range

04-12-2012 10:11 PM in reply to: sdphg

You may want to zoom window before you run your sample

   Public Sub ZoomWindow(db As Database, minpt As Point2d, maxpt As Point2d)
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim view As ViewTableRecord = New ViewTableRecord()
        view.CenterPoint = (minpt + (maxpt - minpt) / 2.0)
        view.Height = (maxpt.Y - minpt.Y)
        view.Width = (maxpt.X - minpt.X)
        doc.Editor.SetCurrentView(view)
        db.UpdateExt(True)
    End Sub

    <CommandMethod("ZOOMW")> _
    Public Sub ZoomREctangle()
        Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
        Dim db As Database = doc.Database
        ZoomWindow(db, New Point2d(2, 2), New Point2d(8, 8))
    End Sub

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Active Contributor
sdphg
Posts: 28
Registered: ‎05-21-2008
Message 3 of 5 (138 Views)

Re: About ed.SelectWindow select range

04-12-2012 10:32 PM in reply to: Hallex

thanks Hallex.but I already zoomed before  ed.SelectWindow.

*Expert Elite*
_gile
Posts: 2,133
Registered: ‎04-29-2006
Message 4 of 5 (136 Views)

Re: About ed.SelectWindow select range

04-12-2012 10:50 PM in reply to: sdphg

Hi,

 

How did you zoom ?

Remind SendStringToExecute (or SendCommand) doesn't run synchronously and may happen after the selection.

Use a hard-coded zoom method as shown by Hallex.

Gilles Chanteau
Active Contributor
sdphg
Posts: 28
Registered: ‎05-21-2008
Message 5 of 5 (129 Views)

Re: About ed.SelectWindow select range

04-13-2012 12:22 AM in reply to: _gile

thanks gile

Actually, I run command ZOOM E first,then run the command to execute ed.SelectWindow.

And the fact is, if the view is large enough the selection is correct,but when Zoom extent or zoom out to a very small size, the selection always contains some entities outside the range.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.