Problem with selectionset

Problem with selectionset

Anonymous
Not applicable
301 Views
2 Replies
Message 1 of 3

Problem with selectionset

Anonymous
Not applicable
Hi,

can anybody tell me why is it the Count =0 instead of 3?

Public Sub test()
Dim selSet As AcadSelectionSet
Dim FType As Variant
Dim FData As Variant
Dim PLObject As AcadPolyline

ReDim FType(1) As Integer
ReDim FData(1) As Variant
If ThisDrawing.SelectionSets.Count = 0 Then Set selSet = ThisDrawing.SelectionSets.Add("New") Else Set selSet = ThisDrawing.SelectionSets(0)
selSet.Clear
FType(0) = 0: FData(0) = "POLYLINE"
FType(1) = 8: FData(1) = "Pline"
Call selSet.Select(acSelectionSetAll, , , FType, FData)
Set PLObject = selSet(0)


selSet.Clear
ReDim FType(2) As Integer
ReDim FData(2) As Variant
FType(0) = 0: FData(0) = "TEXT"
FType(1) = 1: FData(1) = "xy"
FType(2) = 8: FData(2) = "Text"
Call selSet.SelectByPolygon(acSelectionSetCrossingPolygon, PLObject.Coordinates, FType, FData)
Debug.Print ("Count: " + CStr(selSet.Count))
End Sub


Thanks!
szab0a
0 Likes
302 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi szab0a,

The data returned by your code is drawing specific. Hence only you
could possibly know by examining the data in your drawing.

Note that as you've posted it the code is missing an "End If"

It would be a lot easier to handle your query if you enclose the code in
makers like:

'' Place your code here.


Regards


Laurie Comerford

szab0a wrote:
> Hi, can anybody tell me why is it the Count =0 instead of 3? Public Sub
> test() Dim selSet As AcadSelectionSet Dim FType As Variant Dim FData As
> Variant Dim PLObject As AcadPolyline ReDim FType(1) As Integer ReDim
> FData(1) As Variant If ThisDrawing.SelectionSets.Count = 0 Then Set
> selSet = ThisDrawing.SelectionSets.Add("New") Else Set selSet =
> ThisDrawing.SelectionSets(0) selSet.Clear FType(0) = 0: FData(0) =
> "POLYLINE" FType(1) = 8: FData(1) = "Pline" Call
> selSet.Select(acSelectionSetAll, , , FType, FData) Set PLObject =
> selSet(0) selSet.Clear ReDim FType(2) As Integer ReDim FData(2) As
> Variant FType(0) = 0: FData(0) = "TEXT" FType(1) = 1: FData(1) = "xy"
> FType(2) = 8: FData(2) = "Text" Call
> selSet.SelectByPolygon(acSelectionSetCrossingPolygon,
> PLObject.Coordinates, FType, FData) Debug.Print ("Count: " +
> CStr(selSet.Count)) End Sub Thanks! szab0a
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hi Laurie,

thanks for your answer.
I have my drawing attached in draw_2000.zip.
In my code isn't line bake, where if Then Else it.

Best Regards
szab0a
0 Likes