Help, Selection set filter

Help, Selection set filter

Anonymous
Not applicable
369 Views
5 Replies
Message 1 of 6

Help, Selection set filter

Anonymous
Not applicable
Hello, I am trying to create a filtered selection set to capture
the block name(handle), unique id, and insertion points (x,y,z).
Attached code comes back empty.

Help.

Thanks

tpefilterstr = "name1,name2,name3,name4"
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
Dim tpearrayA(0 To 2) As Integer
Dim tpearrayB(0 To 2) As Variant
Dim tpefiltera As Variant
Dim tpefilterb As Variant
Dim tpefilterstr As String

For cntcb = 0 To 12
nulval = IsNull(tpecbarry(cntcb))
If (tpecbarry(cntcb) <> "" And nulval = False) Then
tpefilterstr = tpefilterstr & tpecbarry(cntcb) & ","
End If
Next
tpearrayA(0) = 2:
tpearrayB(0) = tpefilterstr
tpearrayA(1) = 5:
tpearrayA(2) = 10:
tpefiltera = tpearrayA
tpefilterb = tpearrayB
ThisDrawing.SelectionSets.Item("tpefilteredset").Select acSelectionSetAll, , , tpefiltera, tpefilterb
0 Likes
370 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
I changed the code to include an array for the code "10" coord.(x,y,z,) data. No change.

Please HELP.



<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
Dim tpearrayA(0 To 2) As Integer
Dim tpearrayB(0 To 2) As Variant
Dim tpeInsPt(0 To 2) As Double
Dim tpefiltera As Variant
Dim tpefilterb As Variant
Dim tpefilterstr As String

For cntcb = 0 To 12
nulval = IsNull(tpecbarry(cntcb))
If (tpecbarry(cntcb) <> "" And nulval = False) Then
tpefilterstr = tpefilterstr & tpecbarry(cntcb) & ","
End If
Next
tpearrayA(0) = 2:
tpearrayB(0) = tpefilterstr
tpearrayA(1) = 5:
tpearrayB(1) = "*"
tpearrayA(2) = 10:
tpearrayB(2) = tpeInsPt
tpefiltera = tpearrayA
tpefilterb = tpearrayB
ThisDrawing.SelectionSets.Item("tpefilteredset").Select acSelectionSetAll, , , tpefiltera, tpefilterb
0 Likes
Message 3 of 6

dragnsbld
Contributor
Contributor
You could just add this to your code:
change the strName to your block name, when it is ran you can get all the data you are looking for by using a For..Next and have it returned however you chose.

'@@@@@@@@@@@@@
Dim intCode() As Integer, varCodeValue() As Variant

Set ss = CreateSelectionSet

ReDim intCode(0)
ReDim varCodeValue(0)
intCode(0) = 2
varCodeValue(0) = strName
'@@@@@@@@@@@@@@@@

Public Function CreateSelectionSet(Optional ssName As String = "SelSt") As AcadSelectionSet

Dim ss As AcadSelectionSet

On Error Resume Next
Set ss = ThisDrawing.SelectionSets(ssName)
If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
ss.Clear
Set CreateSelectionSet = ss

End Function
0 Likes
Message 4 of 6

Anonymous
Not applicable
Thank you
What format/layout will the selection set be in?
will it have column names/numbers?

When I do a: for each "2." or "handle name" in "handle" <--?
How do I address the coord (x,y,z) and the "unique id" data?
0 Likes
Message 5 of 6

dragnsbld
Contributor
Contributor
Here is a sample, you choose the format order.
I used this before to create a DB from a drawings Blks and vice versa. all the information is there and if you need to you can add a Dim for OBJ1 as acadBlock or text or line whatever and use the set OBJ1 = Obj and get other info.

dim Obj as acadentity

for each Obj in ss
obj.handle
obj.insertionpoint
.......
next Message was edited by: Dragnsbld
0 Likes
Message 6 of 6

Anonymous
Not applicable
Thank you thank you thank you!!!!!!
0 Likes