Object selection grips

Discussion in 'AutoCAD' started by vijaya, Jul 1, 2004.

  1. vijaya

    vijaya Guest

    Hello all,
    Can anyone help me, how to show the grips of an entity on the screen, if we know the entity handle through VBA (e.g. If we select an entity on screen, grips will be shown)

    vijaya
     
    vijaya, Jul 1, 2004
    #1
    1. Advertisements

  2. It's not possible except via AcadX (www.acadx.com) and, presumably,
    AcadUnsupported library... If I guess right, Tony T. developed functions for
    pickfirstselectionset manipulation, and AcadUnsupp.arx offers similar
    functionality but not within VBA (VB and external libraries only if I'm
    right).

    Regards,
    Maksim Sestic

    we know the entity handle through VBA (e.g. If we select an entity on
    screen, grips will be shown)
     
    Maksim Sestic, Jul 1, 2004
    #2
    1. Advertisements

  3. vijaya

    abccorsicad

    Joined:
    Dec 23, 2012
    Messages:
    1
    Likes Received:
    0
    Activate grips in vba (newer versions of AutoCAD)

    Sure you can. You have to invoke SELECT command from VBA in AutoCAD command prompt and then pass entities through lisp (handent <handle>) function. There are some examples in free plugins on abccorsicad.it website. Anyway, try this in your vba code:

    Public Sub test()
    Dim c As Collection, obj As AcadEntity
    Set c = New Collection
    For Each obj In ThisDrawing.ModelSpace
    If TypeOf obj Is AcadLine Then
    c.Add obj
    End If
    Next
    SetSelection c
    End Sub
    Private Sub SetSelection(objs As Collection)
    Dim obj
    If ThisDrawing.PickfirstSelectionSet.Count > 0 Then
    'just send any command to remove grips
    ThisDrawing.SendCommand Chr(27)
    End If
    ThisDrawing.SendCommand "_SELECT" & Chr(13)
    For Each obj In objs
    ThisDrawing.SendCommand "(handent """ & obj.Handle & """)" & vbCr
    Next
    ThisDrawing.SendCommand vbCr
    End Sub
     
    abccorsicad, Dec 23, 2012
    #3
    1. Advertisements

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.