Jump to content

selectAtpoint method


kalai

Recommended Posts

Hi ,

 

SelectAtpoint doesnot work.

 

Can anyone point out mistake

 

 


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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

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

 

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

Link to comment
Share on other sites

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:

 

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

Link to comment
Share on other sites

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".
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...