SelectOnScreen method...

SelectOnScreen method...

Anonymous
Not applicable
868 Views
9 Replies
Message 1 of 10

SelectOnScreen method...

Anonymous
Not applicable
When using the .SelectOnScreen method of an AcadSelectionSet, what is the
easies way to filter so i can select only blocks (preferably with editable
attributes)?

Rodney
0 Likes
869 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Hi Rodney,

Here is the first part.

'DXF Group Code Constants
Public Const ENTITY = 0 'an entity
Public Const NAME = 2 'by name (i.e. attribute tag, block name,
etc)
Public Const HANDLE = 5 'entity handle
Public Const LINETYPE = 6 'by linetype
Public Const TEXTSTYLE = 7 'by textstyle
Public Const LAYER = 8 'by layer
Public Const THICKNESS = 39 'by the entity's thickness
Public Const LTSCALE = 48 'by entity linetype scale
Public Const VISIBILITY = 60 'by entity visibility
Public Const COLOR = 62 'by entity color
Public Const SPACE = 67 'Model or Paper space

Public Function CreateSelectionSet(SelectionSet As AcadSelectionSet, _
FilterCode As Integer, _
FilterValue As String) As Boolean
Dim intFilterCode(0) As Integer
Dim varFilterValue(0) As Variant

'assume success
CreateSelectionSet = True

intFilterCode(0) = FilterCode
varFilterValue(0) = FilterValue

SelectionSet.SelectOnScreen intFilterCode, varFilterValue

If Not SelectionSet.Count Then
CreateSelectionSet = False
End If
End Function

Public Sub Test()
Dim objSS As AcadSelectionSet
Dim intFilterCode(0) As Integer
Dim strFilterValue(0) As String

Set objSS = ThisDrawing.SelectionSets.Add("Inserts")

Call CreateSelectionSet(objSS, ENTITY, "INSERT")

MsgBox "Number of entities selected: " & objSS.Count

objSS.Delete
End Sub

Joe
Rodney D. Lester wrote in message
news:[email protected]...
> When using the .SelectOnScreen method of an AcadSelectionSet, what is the
> easies way to filter so i can select only blocks (preferably with editable
> attributes)?
>
> Rodney
>
>
0 Likes
Message 3 of 10

Anonymous
Not applicable
I understand this and this works if I know the block name, tag, etc. But
what if I want to select any number of different blocks with editable
attributes. Is that possible.

Rodney


"Joe Sutphin" wrote in message
news:[email protected]...
> Hi Rodney,
>
> Here is the first part.
>
> 'DXF Group Code Constants
> Public Const ENTITY = 0 'an entity
> Public Const NAME = 2 'by name (i.e. attribute tag, block name,
> etc)
> Public Const HANDLE = 5 'entity handle
> Public Const LINETYPE = 6 'by linetype
> Public Const TEXTSTYLE = 7 'by textstyle
> Public Const LAYER = 8 'by layer
> Public Const THICKNESS = 39 'by the entity's thickness
> Public Const LTSCALE = 48 'by entity linetype scale
> Public Const VISIBILITY = 60 'by entity visibility
> Public Const COLOR = 62 'by entity color
> Public Const SPACE = 67 'Model or Paper space
>
> Public Function CreateSelectionSet(SelectionSet As AcadSelectionSet, _
> FilterCode As Integer, _
> FilterValue As String) As Boolean
> Dim intFilterCode(0) As Integer
> Dim varFilterValue(0) As Variant
>
> 'assume success
> CreateSelectionSet = True
>
> intFilterCode(0) = FilterCode
> varFilterValue(0) = FilterValue
>
> SelectionSet.SelectOnScreen intFilterCode, varFilterValue
>
> If Not SelectionSet.Count Then
> CreateSelectionSet = False
> End If
> End Function
>
> Public Sub Test()
> Dim objSS As AcadSelectionSet
> Dim intFilterCode(0) As Integer
> Dim strFilterValue(0) As String
>
> Set objSS = ThisDrawing.SelectionSets.Add("Inserts")
>
> Call CreateSelectionSet(objSS, ENTITY, "INSERT")
>
> MsgBox "Number of entities selected: " & objSS.Count
>
> objSS.Delete
> End Sub
>
> Joe
> Rodney D. Lester wrote in message
> news:[email protected]...
> > When using the .SelectOnScreen method of an AcadSelectionSet, what is
the
> > easies way to filter so i can select only blocks (preferably with
editable
> > attributes)?
> >
> > Rodney
> >
> >
>
>
0 Likes
Message 4 of 10

Anonymous
Not applicable
Hi Rodney,
I think you would have to create the set just filtering for
inserts/blocks, not by insert and name. Then iterate the set and use the
HasAttributes property to determine which blocks to keep and which
ones to throw out of the set.
-Josh

Rodney D. Lester wrote:

> I understand this and this works if I know the block name, tag, etc. But
> what if I want to select any number of different blocks with editable
> attributes. Is that possible.
>
> Rodney
>
>
> "Joe Sutphin" wrote in message
> news:[email protected]...
>
>>Hi Rodney,
>>
>>Here is the first part.
>>
>>'DXF Group Code Constants
>>Public Const ENTITY = 0 'an entity
>>Public Const NAME = 2 'by name (i.e. attribute tag, block name,
>>etc)
>>Public Const HANDLE = 5 'entity handle
>>Public Const LINETYPE = 6 'by linetype
>>Public Const TEXTSTYLE = 7 'by textstyle
>>Public Const LAYER = 8 'by layer
>>Public Const THICKNESS = 39 'by the entity's thickness
>>Public Const LTSCALE = 48 'by entity linetype scale
>>Public Const VISIBILITY = 60 'by entity visibility
>>Public Const COLOR = 62 'by entity color
>>Public Const SPACE = 67 'Model or Paper space
>>
>>Public Function CreateSelectionSet(SelectionSet As AcadSelectionSet, _
>> FilterCode As Integer, _
>> FilterValue As String) As Boolean
>>Dim intFilterCode(0) As Integer
>>Dim varFilterValue(0) As Variant
>>
>>'assume success
>>CreateSelectionSet = True
>>
>> intFilterCode(0) = FilterCode
>> varFilterValue(0) = FilterValue
>>
>> SelectionSet.SelectOnScreen intFilterCode, varFilterValue
>>
>> If Not SelectionSet.Count Then
>> CreateSelectionSet = False
>> End If
>>End Function
>>
>>Public Sub Test()
>>Dim objSS As AcadSelectionSet
>>Dim intFilterCode(0) As Integer
>>Dim strFilterValue(0) As String
>>
>> Set objSS = ThisDrawing.SelectionSets.Add("Inserts")
>>
>> Call CreateSelectionSet(objSS, ENTITY, "INSERT")
>>
>> MsgBox "Number of entities selected: " & objSS.Count
>>
>> objSS.Delete
>>End Sub
>>
>>Joe
>>Rodney D. Lester wrote in message
>>news:[email protected]...
>>
>>>When using the .SelectOnScreen method of an AcadSelectionSet, what is
>>>
> the
>
>>>easies way to filter so i can select only blocks (preferably with
>>>
> editable
>
>>>attributes)?
>>>
>>>Rodney
>>>
>>>
>>>
>>
>
>
0 Likes
Message 5 of 10

Anonymous
Not applicable
add the filter (66 . 1) to the selection set filter to only select block
inserts w/ attribs.
--
Bobby C. Jones
Dots & Parens living in harmony...
0 Likes
Message 6 of 10

Anonymous
Not applicable
Hi Bobby,
This would be great, but,,,,, "I don't understand" 🙂 Is that a decimal
group code? Have you tried this and if so can you post a clip of sample
code?
-Josh

Bobby Jones wrote:

> add the filter (66 . 1) to the selection set filter to only select block
> inserts w/ attribs.
> --
> Bobby C. Jones
> Dots & Parens living in harmony...
>
>
>
>
0 Likes
Message 7 of 10

Anonymous
Not applicable
Good catch, Bobby.

--
"That's no ordinary rabbit."
http://www.acadx.com


"Bobby Jones" wrote in message
news:[email protected]...
> add the filter (66 . 1) to the selection set filter to only select
block
> inserts w/ attribs.
> --
> Bobby C. Jones
> Dots & Parens living in harmony...
0 Likes
Message 8 of 10

Anonymous
Not applicable
My apologies...I posted in lisp format...

Dim intFilterCode(0) As Integer
Dim varFilterValue(0) As Variant

intFilterCode(0) = 66
varFilterValue(0) = 1

SelectionSet.SelectOnScreen intFilterCode, varFilterVal

hopefully that makes a little more sense 🙂

And thanks Frank.
--
Bobby C. Jones
Dots & Parens living in harmony...
0 Likes
Message 9 of 10

Anonymous
Not applicable
Thanks Bobby,
I'll tuck that one away for future reference 🙂

Bobby Jones wrote:

> My apologies...I posted in lisp format...
>
> Dim intFilterCode(0) As Integer
> Dim varFilterValue(0) As Variant
>
> intFilterCode(0) = 66
> varFilterValue(0) = 1
>
> SelectionSet.SelectOnScreen intFilterCode, varFilterVal
>
> hopefully that makes a little more sense 🙂
>
> And thanks Frank.
> --
> Bobby C. Jones
> Dots & Parens living in harmony...
>
>
>
0 Likes
Message 10 of 10

Anonymous
Not applicable
Thats exactly what I needed... Thanks..

Rodney

"Bobby Jones" wrote in message
news:[email protected]...
> My apologies...I posted in lisp format...
>
> Dim intFilterCode(0) As Integer
> Dim varFilterValue(0) As Variant
>
> intFilterCode(0) = 66
> varFilterValue(0) = 1
>
> SelectionSet.SelectOnScreen intFilterCode, varFilterVal
>
> hopefully that makes a little more sense 🙂
>
> And thanks Frank.
> --
> Bobby C. Jones
> Dots & Parens living in harmony...
>
>
0 Likes