monkichi Posted November 19, 2009 Posted November 19, 2009 Dear, I get point by ThisDrawing.Utility.GetPoint method and add it into a selectionset but this selectionset is still null ! Is there anything wrong ? Please show me. Thank you ! Sub ClickPoint() Dim returnPnt As Variant Dim ssetPoint As AcadSelectionSet Dim Point As AcadPoint returnPnt = ThisDrawing.Utility.GetPoint Set Point = ThisDrawing.ModelSpace.AddPoint(returnPnt) Dim check As Boolean Dim Count As Integer Count = ThisDrawing.SelectionSets.Count check = False If Count > 0 Then For i = 0 To Count - 1 If ThisDrawing.SelectionSets.Item(i).Name <> "ssetPoint" Then check = False Else check = True Exit For End If Next i End If If check = False Then Set ssetPoint = ThisDrawing.SelectionSets.Add("ssetPoint") Else Set ssetPoint = ThisDrawing.SelectionSets.Item(i) ssetPoint.Clear End If ssetPoint.SelectAtPoint returnPnt MsgBox ssetPoint.Count End Sub Quote
SEANT Posted November 19, 2009 Posted November 19, 2009 That seems like it should work. Perhaps the graphics display, an integral part of the “Select” methods, is not updated in time to present the proper cues to the SelectAtPoint call. Even if it were, though, it may be better to add the Point entity to the SelSet explicitly, in case other entities were at that location. Sub ClickPoint() Dim returnPnt As Variant Dim ssetPoint As AcadSelectionSet Dim Point(0) As AcadPoint returnPnt = ThisDrawing.Utility.GetPoint Set Point(0) = ThisDrawing.ModelSpace.AddPoint(returnPnt) Dim check As Boolean Dim Count As Integer Count = ThisDrawing.SelectionSets.Count check = False If Count > 0 Then For i = 0 To Count - 1 If ThisDrawing.SelectionSets.Item(i).Name <> "ssetPoint" Then check = False Else check = True Exit For End If Next i End If If check = False Then Set ssetPoint = ThisDrawing.SelectionSets.Add("ssetPoint") Else Set ssetPoint = ThisDrawing.SelectionSets.Item(i) ssetPoint.Clear End If ssetPoint.AddItems Point MsgBox ssetPoint.Count End Sub Quote
Recommended Posts
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.