how to look the AcadEntity

Discussion in 'AutoCAD' started by nalsur8, Aug 19, 2004.

  1. nalsur8

    nalsur8 Guest

    this code corret or not to look all entity
    in 1 selection object (1 object)

    Private Sub CommandButton1_Click()
    Dim ssget As AcadSelectionSet
    Set ssget = ThisDrawing.SelectionSets.Add("ssname")
    Me.Hide
    ssget.SelectOnScreen
    UserForm1.Show
    Dim entity As AcadEntity
    For Each entity In ssget
    ..... here how to put the coding for looking entity

    Next entity
    ThisDrawing.SelectionSets("ssname").Delete
    End Sub
     
    nalsur8, Aug 19, 2004
    #1
  2. Depends what you looking for..Object have different methods & properties...

    Some are common to all objects though.. See sample..I also changed you
    syntax a bit....I wouldn't use a LISP method(ssget) as a Varaible
    name in VBA...Saves confusion if your going to be using both languages in a
    program...Evern if not just a good idea im my opinion...

    Private Sub CommandButton1_Click()
    Me.Hide
    Dim ssEntities As AcadSelectionSet
    Dim eName As String
    Dim eID As Double
    Set ssEntities = ThisDrawing.SelectionSets.Add("ssname")

    ssEntities.SelectOnScreen

    Dim entity As AcadEntity
    For Each entity In ssEntities
    eName = entity.ObjectName 'Holds name of current obj
    eID = entity.ObjectID 'Holds ID of current obj
    MsgBox "Entity name is: " & eName & vbCrLf & _
    "Entity ID is: " & eID
    Next entity

    ThisDrawing.SelectionSets("ssname").Delete
    End Sub
     
    Paul Richardson, Aug 19, 2004
    #2
  3. Sorry...
    "Holds" probably wasn't a good choice of words..."Points to" would have been
    better choice...The object holds(owns) it's properties...We just point to
    them...

    Someone please save me if I'm off base...tks...Nothing like fixing your own
    mistake by stating another...
     
    Paul Richardson, Aug 19, 2004
    #3
  4. nalsur8

    TomD Guest

    Thanks for that, Paul. Interesting (at least to me) change of words.
     
    TomD, Aug 19, 2004
    #4
  5. nalsur8

    jdinardi Guest

    I thought he might have meant how to look at it, maybe highlight it or zoom to it. I may be wrong there, but in either case...

    Sub TryThis()
    Dim oEnt As AcadEntity
    Dim pt, ptMin, ptMax

    ThisDrawing.Utility.GetEntity oEnt, pt, "Select an entity: "
    oEnt.Highlight True
    oEnt.GetBoundingBox ptMin, ptMax
    Application.ZoomWindow ptMin, ptMax
    End Sub
     
    jdinardi, Aug 19, 2004
    #5
  6. ah...:)
    zoom to it. I may be wrong there, but in either case...
     
    Paul Richardson, Aug 19, 2004
    #6
  7. nalsur8

    nalsur8 Guest

    thank guys i'm now clear.... what yours mean
     
    nalsur8, Aug 20, 2004
    #7
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.