text help

text help

Anonymous
Not applicable
262 Views
2 Replies
Message 1 of 3

text help

Anonymous
Not applicable
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
0 Likes
263 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
hola think i got it nokta = sset.Item(i).insertionPoint is working. "fischer" wrote in message news:41547c9c_1@newsprd01... > 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 > > >
0 Likes
Message 3 of 3

Anonymous
Not applicable
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 "fischer" wrote in message news:41547c9c_1@newsprd01... > 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 > > >
0 Likes