Only if it's text

Discussion in 'AutoCAD' started by Dave F, Dec 22, 2003.

  1. Dave F

    Dave F Guest

    Hi

    I want to select an individual entity & make sure it is text
    This is what I came up with. It seems a bit repetitive.
    Is there a better way?

    ThisDrawing.Utility.GetEntity Ent1, Pt1, "Select the Text Object"
    If TypeOf Ent1 Is AcadMText Then
    Set Mtxt = Ent1
    IPt = Mtxt.InsertionPoint
    ElseIf TypeOf Ent1 Is AcadText Then
    Set Txt = Ent1
    IPt = Txt.InsertionPoint
    End If

    TIA

    Dave F.
     
    Dave F, Dec 22, 2003
    #1
  2. Dave F

    Warren M Guest

    Hi Dave.

    Well, there's always more than one way to skin a cat...
    And there's nothing 'wrong' with what you are doing, but here is another perspective...

    Public Sub GetText()

    Dim objText As AcadEntity
    Dim varPtPicked As Variant

    On Error Resume Next

    ThisDrawing.Utility.GetEntity objText, varPtPicked

    Do Until objText.ObjectName = "AcDbText" Or objText.ObjectName = "AcDbMText"
    ThisDrawing.Utility.GetEntity objText, varPtPicked
    Loop

    MsgBox "Got some " & objText.ObjectName

    End Sub

    And I'm sure there's even more efficient ways to accomplish this...

    Hope this helps

    Warren M
     
    Warren M, Dec 23, 2003
    #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.