If you set AllowSubSelections to true, you will get nested entities, but only one nested entity per crossing/window selection will be found, and which of several objects in the crossing box is actually selected is not predictable, so you really can't rely on crossing for selecting nested entities.
Selecting multiple nested objects requires that you select them by picking each one individually.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
wrote in message news:5859216@discussion.autodesk.com...
I want to select nested entities (primarily in Xrefs) and then view the selected objects layers. My code works, however it doesn't select every nested entity that i select. if i select by picking an actual entity it adds it, if i select by crossing window (over part of, or an entire block for example) it only selects some or one of the nested entities. Perhaps my understanding of the PromptSelectionOptions.PrepareOptionalDetails property is lacking.
thanks for the help
-Mark Pendergraft
'/////// begin code ////////'
Public Sub GetSubEntities()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim ss As SelectionSet
Dim prmptSSopt As New PromptSelectionOptions()
prmptSSopt.PrepareOptionalDetails = True
prmptSSopt.RejectObjectsOnLockedLayers = False
prmptSSopt.MessageForAdding = "Select objects: "
Dim ssRes As PromptSelectionResult = ed.GetSelection(prmptSSopt)
If Not ssRes.Status = PromptStatus.OK Then Exit Sub
ss = ssRes.Value
Dim objIds() As ObjectId = ss.GetObjectIds()
ed.WriteMessage(vbCrLf + vbCrLf + "Selected Layers: ")
Dim ent As Entity = Nothing
Using trans As Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()
For Each objId As ObjectId In objIds
ent = trans.GetObject(objId, OpenMode.ForRead, False, True)
ed.WriteMessage(vbCrLf + ent.Layer.ToString)
Next
End Using
End Sub