Having problem with acSelectionSetWindowPolygon

Discussion in 'AutoCAD' started by Tony M, Aug 27, 2004.

  1. Tony M

    Tony M Guest

    Hi all,

    I am having a problem with the following code. I get an error message
    "Invalid argument Model or Pointlist in SelectByPolygon" when the code
    gets to the line with the *****'s around it. I've stepped through the
    code and checked the variable "coords" and the coordinates for the
    polygon window are there just as I would expect.

    I'm still on a learning curve with VBA coming from LISP, so any help or
    suggestions would be greatly appreciated.

    Thanks in advance,
    Tony M



    Sub Get_Panel_Size()

    Dim obj As AcadObject
    Dim blockrefobj As AcadBlockReference
    Dim pline As AcadLWPolyline
    Dim block As AcadObject
    Dim ssblock As AcadSelectionSet
    Dim test As Variant
    Dim coords() As Double
    Dim FilterType() As Integer
    Dim FilterData As Variant
    Dim InsertPt As Variant
    Dim varAttributes As Variant
    Dim panel_no As String
    Dim I As Integer
    Dim J As Integer


    Set ssblock = ThisDrawing.SelectionSets.Add("PANEL-NO")
    mode = acSelectionSetWindowPolygon

    ReDim FilterType(1): ReDim FilterData(1) 'Resize filter arrays

    FilterType(0) = 0: FilterData(0) = "Insert"
    FilterType(1) = 8: FilterData(1) = "A-Part-No"


    For Each obj In ThisDrawing.SelectionSets("PANEL")
    If TypeOf obj Is AcadLWPolyline Then
    Set pline = obj
    test = pline.Coordinates
    ReDim coords(UBound(test))
    For J = 0 To UBound(test)
    coords(J) = test(J)
    Next
    End If

    ******ssblock.SelectByPolygon mode, coords, FilterType, FilterData******

    For Each block In ThisDrawing.SelectionSets("PANEL-NO")
    Set blockrefobj = block
    InsertPt = blockrefobj.insertionPoint
    If blockrefobj.HasAttributes Then
    varAttributes = blockrefobj.GetAttributes
    For I = LBound(varAttributes) To UBound(varAttributes)
    If varAttributes(I).TagString = "_PART_" Then

    panel_no = varAttributes(I).TextString
    End If
    Next I
    End If
    Next

    Next




    End Sub
     
    Tony M, Aug 27, 2004
    #1
  2. Tony M

    Tony M Guest

    Duh! I figured it out. I forgot to include the "Z" coordinate for the
    point list.

    TM
     
    Tony M, Aug 27, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.