Select All Blocks in Drawing.

Select All Blocks in Drawing.

Anonymous
Not applicable
460 Views
2 Replies
Message 1 of 3

Select All Blocks in Drawing.

Anonymous
Not applicable
I've successfully selected all text on a drawing, and used the text for other functions, but I can't seem to select all blocks. Am I using the wrong filter codes?

'This Works for the Text
Set TextSS = ThisDrawing.SelectionSets.Add("TextSS")
TextSS.Clear
fType(0) = 0: fData(0) = "TEXT"
fType(1) = 67: fData(1) = "0"
TextSS.Select acSelectionSetAll, , , fType, fData
'TextSS now holds all TEXT entities in modelspace
Debug.Print TextSS.Count

To get all of the Blocks, I've tried using
fType(0) = 0: fData(0) = "INSERT" 'Get all blocks
fType(1) = -4: fData(1) = "TBS" 'Block Name
fType(3) = -4: fData(3) = "and>"

Thanks for any help 🙂
0 Likes
461 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Well, after looking through the help files some more and looking through the forum, I solved my problem

fType(0) = 0
fData(0) = "Insert"
fType(1) = 2
fData(1) = "TBS"

~Cheers
0 Likes
Message 3 of 3

Anonymous
Not applicable
gets all blocks that are the same and prints ne

john
Public Sub test()
Dim currLayer As AcadLayer
Dim layerObj As AcadLayer
Dim mtxtlabel As AcadMText
Dim strText As String
Dim dblHeight As Double
Dim dblWidth As Double
Dim dblRot As Double
Dim txtinsert As Variant
Dim strNorth As String
Dim strEast As String
dblRot = -ThisDrawing.GetVariable("VIEWTWIST")
Set layerObj = ThisDrawing.Layers.Add("C-LITE-TEXT")
layerObj.Color = acYellow
ThisDrawing.ActiveLayer = layerObj



dblWidth = 0
dblRot = -ThisDrawing.GetVariable("VIEWTWIST")

Dim setOBJ As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim f_type As Variant
Dim f_data As Variant
Dim i As Integer
Dim pt As Variant
ftype(0) = 0
fdata(0) = "INSERT"
f_type = ftype
f_data = fdata

Set setOBJ = ThisDrawing.SelectionSets.Add("TEST2")
setOBJ.SelectOnScreen

For i = 0 To setOBJ.Count - 1
pt = setOBJ.Item(i).InsertionPoint


Dim north As String
Dim east As String
strText = "Test"
east = pt(0)
north = pt(1)


strNorthFormat = "#0.0000"
strEastFormat = "#0.0000"


strNorth = Format(north, strNorthFormat)
strEast = Format(east, strEastFormat)

strText = "N: " & (strNorth) & "\P" _
& "E: " & (strEast) & "\P" _


Set mtxtlabel = ThisDrawing.ModelSpace.AddMText(pt, dblWidth, strText)
mtxtlabel.Rotation = dblRot

MsgBox " Coords X,Y = " & pt(0) & "," & pt(1)


Next i

setOBJ.Delete


End Sub
wrote in message news:5771587@discussion.autodesk.com...
Well, after looking through the help files some more and looking through the
forum, I solved my problem

fType(0) = 0
fData(0) = "Insert"
fType(1) = 2
fData(1) = "TBS"

~Cheers
0 Likes