Hi,
this is a very crude example of a function to get a list of insertion points from a selection set (crossing):
Public Function getBlockInsPoints(ByVal tag As String) As List(Of Point3d)
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = doc.Database
Dim ipoints As New List(Of Point3d)
Dim p1, p2 As Point3d
Using acTrans As Transaction = db.TransactionManager.StartTransaction()
Dim acTypValAr(1) As TypedValue
Dim blkref As BlockReference
acTypValAr.SetValue(New TypedValue(DxfCode.Start, "INSERT"), 0)
acTypValAr.SetValue(New TypedValue(DxfCode.AttributeTag, tag), 1)
Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
Dim acSSPrompt As PromptPointResult = doc.Editor.GetPoint("Select First Point:")
If acSSPrompt.Status = PromptStatus.OK Then
p1 = acSSPrompt.Value
acSSPrompt = doc.Editor.GetCorner("Select Second Point: ", p1)
If acSSPrompt.Status = PromptStatus.OK Then
p2 = acSSPrompt.Value
Dim wssprompt As PromptSelectionResult
wssprompt = ed.SelectCrossingWindow(p1, p2, acSelFtr)
If wssprompt.Status = PromptStatus.OK Then
Dim wss As SelectionSet = wssprompt.Value
For Each acSSObj As SelectedObject In wss
If Not IsDBNull(acSSObj) Then
blkref = acSSObj.ObjectId.GetObject(OpenMode.ForRead)
ipoints.Add(blkref.Position)
End If
Next
End If
End If
End If
acTrans.Commit()
End Using
Return ipoints
End FunctionPut the function in a command, ask for the tag name and pass it to the function, or hardcode the tag name in the function call.
Gaston Nunez