You use Editor.GetEntity... but assuming you are currently using the selection methods, the way you tell GetEntity to only allow a certain type of object is different than the filtering in selection sets. You have to call SetRejectMessage, then AddAllowedClass on the PromptEntityOptions. Here is a simple example, which returns through byref arguments. You use the AllowedType argument by passing GetType(BlockReference) for example.
Friend Shared Sub EntSelect(ByRef SelObj As ObjectId, ByRef PickPoint As Point3d, ByVal PromptString As String, ByVal AllowedType As System.Type, ByVal RejectMsg As String)
SelObj = Nothing
Dim ed As Editor = AppServ.Application.DocumentManager.MdiActiveDocument.Editor
Try
Dim prEntOps As New PromptEntityOptions(PromptString)
Dim prEntRes As PromptEntityResult
prEntOps.SetRejectMessage(RejectMsg)
prEntOps.AddAllowedClass(AllowedType, True)
prEntOps.AllowNone = False
prEntOps.AllowObjectOnLockedLayer = True
prEntOps.AppendKeywordsToMessage = False
prEntRes = ed.GetEntity(prEntOps)
If prEntRes.Status <> PromptStatus.OK Then Return
PickPoint = prEntRes.PickedPoint
SelObj = prEntRes.ObjectId
Catch ex As System.Exception
ed.WriteMessage(ex.Message & " In: " & ex.Source & vbCrLf & ex.StackTrace & vbCrLf)
Return
Finally
ed = Nothing
End Try
End Sub
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<sgsawdy> wrote in messageWith
href="news:6074348@discussion.autodesk.com">news:6074348@discussion.autodesk.com...
LISP I can force my selection to be a single entity and of a certain type. I
have been able to restrict the type of entity I am selecting, but I have not
been able to figure out how to restrict my selection to a single entity pick.
My program must not allow more than one entity to be selected or it will not
be able to perform the required function. Any help is appreciated.
Scott