+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2011
    Posts
    70

    Default selectAtpoint method

    Registered forum members do not see this ad.

    Hi ,

    SelectAtpoint doesnot work.

    Can anyone point out mistake


    Code:
    Dim tpt1(0 To 2) As Double
    
    ftype(0) = 0
    fdata(0) = "LINE"
    ftype(1) = -4
    fdata(1) = "<OR"
    ftype(2) = 8
    fdata(2) = "LAYER1"
    ftype(3) = 8
    fdata(3) = "LAYER2"
    ftype(4) = -4
    fdata(4) = "OR>"
    
    qset.SelectAtPoint tpt1, ftype, fdata
    No object is selected.

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,998

    Default

    I don’t have now access to an AutoCAD with VBA, and has been a while since I didn’t used it. So, until someone with experience on this will see this thread, I will do some guessing:
    Is the selection set object properly declared and registered? Have you tried that selection without filters? Is the point used for selection visible on screen? Can this issue be related with size of pick box related to current zoom level?
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2011
    Posts
    70

    Default

    i tried without filter , object seelcted is not of layer "Layer1" or "layer2"
    Increase of pickbox doenot work out.

    declaration:
    dim qset as acadselectionset
    set qset=thisdrawing.selectionsets.add("qsetname")

  4. #4
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Bulgaria, Sofia
    Posts
    228

    Default

    kalai,

    I don't know where is the problem in your code, but I wrote a few lines and there seems to be no problem. I'm posting my code, hope it will help you

    Code:
    Sub TrySelectAtPoint()
        On Error Resume Next
        Dim ss As AcadSelectionSet
        ThisDrawing.SelectionSets("MySS").Delete
        If Err Then
            Err.Clear
        End If
        ThisDrawing.SelectionSets.Add "MySS"
        Set ss = ThisDrawing.SelectionSets("MySS")
        
        Dim selPt(2) As Double
            selPt(0) = 0
            selPt(1) = 0
            selPt(2) = 0
        
        MsgBox ss.Count & " BEFORE selecting"
        
        ss.SelectAtPoint selPt
        
        MsgBox ss.Count & " AFTER selecting"
        Line.sel
    End Sub

  5. #5
    Full Member
    Using
    AutoCAD 2009
    Join Date
    May 2011
    Posts
    70

    Default

    thanks for your reply,

    but only one object is selected by this(selectatPoint) method.

  6. #6
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Bulgaria, Sofia
    Posts
    228

    Default

    yes - only one object is selected because it's just a basic example to show you that this functionality works. If you perform .SelectAtPoint several times with different poitsmore objects will be added to the selectionset. For two points:

    Code:
    Sub TrySelectAtPoint()
        On Error Resume Next
        Dim ss As AcadSelectionSet
        ThisDrawing.SelectionSets("MySS").Delete
        If Err Then
            Err.Clear
        End If
        ThisDrawing.SelectionSets.Add "MySS"
        Set ss = ThisDrawing.SelectionSets("MySS")
        
        Dim selPt(2) As Double
            selPt(0) = 0
            selPt(1) = 0
            selPt(2) = 0
        
        MsgBox ss.Count & " BEFORE selecting"
        
        ss.SelectAtPoint selPt
        
            selPt(0) = 100
            selPt(1) = 0
            selPt(2) = 0
            
        ss.SelectAtPoint selPt
        
        MsgBox ss.Count & " AFTER selecting"
        
    End Sub

  7. #7
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,634

    Default

    Quote Originally Posted by kalai View Post
    thanks for your reply,

    but only one object is selected by this(selectatPoint) method.
    Isn't that what SelectAtPoint is supposed to do? It's as if the user selected by picking on an entity, even if there are 1000's of entities crossing that point only the top-most in the draw-order will be selected. If you want all the entities inside the pickbox area of a particular point, you'd need to calculate the pickbox dimensions relevant to the current zoom factor and then use Select with the acSelectionSetCrossing mode and the calculated rectangle of the "pickbox".
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  8. #8
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    2,998

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by kalai View Post
    i tried without filter , object seelcted is not of layer "Layer1" or "layer2"
    Seems to me that OP's issues is the fact that defined filter doesn't work as expected.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

Similar Threads

  1. method for sweep?
    By Lt Dan's legs in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 20th Sep 2011, 02:57 pm
  2. ttr method
    By kalai in forum AutoLISP, Visual LISP & DCL
    Replies: 20
    Last Post: 21st Jun 2011, 08:32 am
  3. how to use new method ?
    By muthu123 in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 24th Nov 2010, 10:05 am
  4. Load method with VBA
    By Ndape in forum AutoLISP, Visual LISP & DCL
    Replies: 43
    Last Post: 20th Jun 2008, 04:42 pm
  5. Input Method
    By treaves in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 6th Mar 2005, 02:37 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts