Filtering lines and polylines

Filtering lines and polylines

Anonymous
Not applicable
1,641 Views
4 Replies
Message 1 of 5

Filtering lines and polylines

Anonymous
Not applicable
Hi there.

I´m trying to use a selectionset with a filter to lines and polylines, but it just don´t work. Can someone help me?
I´m doing it like that:

Dim sst As AcadSelectionSet
Dim filtertype(2) As Integer
Dim filterdata(2) As Variant

filtertype(0) = 0
filterdata(0) = "Polyline,LWPolyline,Line"

sst.SelectOnScreen filtertype, filterdata

But then i get error 91 = "Object variable or With block variable not set"

Thanks!
0 Likes
1,642 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Your missing a line like this that initialises the selection set object. The
Dim statement just allocates memory for it.

Set sst = ThisDrawing.SelectionSets("sst")




"dangirotto" wrote in message news:5842617@discussion.autodesk.com...
Hi there.

I´m trying to use a selectionset with a filter to lines and polylines, but
it just don´t work. Can someone help me?
I´m doing it like that:

Dim sst As AcadSelectionSet
Dim filtertype(2) As Integer
Dim filterdata(2) As Variant

filtertype(0) = 0
filterdata(0) = "Polyline,LWPolyline,Line"

sst.SelectOnScreen filtertype, filterdata

But then i get error 91 = "Object variable or With block variable not set"

Thanks!
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks!!

I added the line
Set sst = ThisDrawing.SelectionSets.Add("sst")

and it solved my problems..

but it doesn´t select any of my lwpolylines..

do you know what might be the problems?
0 Likes
Message 4 of 5

Anonymous
Not applicable
Try : sst.Select acSelectionSetAll, , , filtertype, filterdata

"dangirotto" wrote in message news:5842627@discussion.autodesk.com...
Thanks!!

I added the line
Set sst = ThisDrawing.SelectionSets.Add("sst")

and it solved my problems..

but it doesn´t select any of my lwpolylines..

do you know what might be the problems?
0 Likes
Message 5 of 5

Anonymous
Not applicable
The below sub will allow selection of lines, polylines and lwpolylines. The function ASet will check for the selection set and remove it if it exist and then create it and return it to the calling sub
Sub GetPolyLwPolyLine()
Dim ssetA As AcadSelectionSet
Dim gpCode(2) As Integer
Dim dataValue(2) As Variant
Dim groupCode As Variant
Dim dataCode As Variant

gpCode(0) = 0
dataValue(0) = "LINE"
gpCode(1) = 0
dataValue(1) = "LWPOLYLINE"
gpCode(2) = 0
dataValue(2) = "POLYLINE"

groupCode = gpCode
dataCode = dataValue
Set ssetA = Aset("POLY")
ssetA.SelectOnScreen groupCode, dataCode
While ssetA.Count
ssetA.Highlight True
Wend
ssetA.Delete
End Sub
Function Aset(iSSetName As String) As AcadSelectionSet
Dim ssetA As AcadSelectionSet
On Error Resume Next
Set ssetA = ThisDrawing.SelectionSets.Add(iSSetName)
If Err.Number <> 0 Then
Set ssetA = ThisDrawing.SelectionSets(iSSetName)
ssetA.Delete
Set ssetA = ThisDrawing.SelectionSets.Add(iSSetName)
Err.Clear
End If
On Error GoTo 0
Set Aset = ssetA
End Function
0 Likes