Object selection

Discussion in 'AutoCAD' started by Joldy, Apr 5, 2004.

  1. Joldy

    Joldy Guest

    Hi,

    I've a closed LWpolyline and with the select on screen method, I can easely select it and do what I want with but ( f.e: hatch it).

    But I have a block partially inside the LWpolyline. I'd like to select this block automatically while selecting the LW...

    I don't know which methods to use. I've tried with intersectwith which has failed.

    Could you help me please in showing me the good way !!

    Thanks a lot
     
    Joldy, Apr 5, 2004
    #1
  2. Joldy

    Jeff Mishler Guest

    Hi Joldy,

    How does the intersectWith fail?
    Do you know the name of the block? the layer it's on? something else to be
    able to select it automatically? or just that it intersects?

    Here's a way if the block name is known:

    Sub test()
    Dim objPoly As AcadLWPolyline
    Dim objBlock As AcadBlockReference
    Dim point As Variant
    Dim ss As AcadSelectionSet
    Dim fType(0) As Integer, fData(0) As Variant

    fType(0) = 2: fData(0) = "test" 'my test block name
    ThisDrawing.Utility.GetEntity objPoly, point, "Select pline: "
    On Error Resume Next
    ThisDrawing.SelectionSets.Item("test").Delete
    On Error GoTo 0
    Set ss = ThisDrawing.SelectionSets.Add("test")
    ss.Select acSelectionSetAll, , , fType, fData
    Set objBlock = ss.Item(0) 'I know there's only one, may need to revise
    point = objPoly.IntersectWith(objBlock, acExtendNone)
    If UBound(point) > 0 Then
    MsgBox "Block intersects Polyline....."
    Else
    MsgBox "Block does not intersect Polyline"
    End If
    End Sub

    HTH,
    Jeff

    easely select it and do what I want with but ( f.e: hatch it).
    this block automatically while selecting the LW...
     
    Jeff Mishler, Apr 5, 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.