text help

Discussion in 'AutoCAD' started by fischer, Sep 24, 2004.

  1. fischer

    fischer Guest

    the following code works fine if i add a new text what if i choose a
    currently created text

    Sub Example_TextString()
    ' This example creates a text object in model space.
    ' It then returns the text string for that object.

    Dim textObj As AcadText
    Dim alfa As AcadText

    Dim text As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
    Dim a As Variant



    ' Define the text object
    text = "Hello, World."
    insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
    height = 500

    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(text, insertionPoint,
    height)
    ZoomAll


    ' Return the current text string for the object
    text = textObj.TextString


    a = textObj.insertionPoint

    Debug.Print a(0)
    Debug.Print a(1)
    Debug.Print a(2)
    end Sub


    this works really fine with addtext. what i wanna do is to choose a group of
    text with

    On Error Resume Next
    ThisDrawing.SelectionSets.Item("data").Delete
    Set sset = ThisDrawing.SelectionSets.Add("data")

    filtertype(0) = 0
    filtervalue(0) = "text"
    sset.SelectOnScreen filtertype, filtervalue
    say = sset.Count
    For i = 1 To say - 1
    secim = sset.Item(i)
    yazi = secim.TextString

    'wow again quiet good to get the writen expression of the text. now the best
    part. how am i gonna figure the insertion point of that "yazi".

    thnx anyway
     
    fischer, Sep 24, 2004
    #1
  2. fischer

    fischer Guest

    hola think i got it

    nokta = sset.Item(i).insertionPoint

    is working.
     
    fischer, Sep 24, 2004
    #2
  3. fischer

    VBA Guest

    Try this:

    Public Sub RetrieveTextInsertionPoints()
    Dim sset As AcadSelectionSet
    Dim filtertype(0) As Integer
    Dim filtervalue(0) As Variant
    Dim oText As AcadText
    Dim Index As Long

    On Error Resume Next

    ThisDrawing.SelectionSets.Item("data").Delete

    Set sset = ThisDrawing.SelectionSets.Add("data")

    filtertype(0) = 0
    filtervalue(0) = "text"

    sset.SelectOnScreen filtertype, filtervalue

    For Index = 0 To sset.Count - 1
    Set oText = sset(Index)
    With oText
    Debug.Print .insertionPoint(0) & ": " & .insertionPoint(1) & ": " &
    ..insertionPoint(2)
    End With
    Next Index
    End Sub
     
    VBA, Sep 24, 2004
    #3
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.