Get Text Question

Get Text Question

Anonymous
Not applicable
381 Views
4 Replies
Message 1 of 5

Get Text Question

Anonymous
Not applicable
Can someone tell me how to select a single line of text in AutoCad and make it display in my VBFORM.TEXT1.TEXT?
0 Likes
382 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
I figured out how to get the text from AutoCad and store it to a textstring. I named the textstring TEXTSELECTED. I would like to search the textstring and turn all of the "N" into "S", all of the "S" into "N", all of the "E" into "W" and all of the "W" into "E" Laurie posted a very good idea earlier but it won't work with all autocad versions. Can someone help. My code to get the textstring is as follows:

Dim acadApp As Object
Set acadApp = GetObject(, "AutoCAD.application")
acadApp.Application.Visible = True
DoEvents
Set Thisdrawing = acadApp.activedocument
DoEvents
Set Thisdrawing = acadApp.activedocument
DoEvents
Dim activedocument As Object
DoEvents
ForceSwitchtoAutoCAD
Dim entText As Object
Dim AcadText As Object
Dim AcadMText As Object
Dim TextString As String
Dim textselected As String


Thisdrawing.Utility.GetEntity entText, vPt, vbCr & "Select AutoCad Text:"


'If TypeOf entText Is AcDbText Or TypeOf entText Is AcDbMText Then
textselected = entText.TextString

Please help.
0 Likes
Message 3 of 5

Anonymous
Not applicable
I figured it out. Just add this code to the bottom of the previous code. But I have one more question...

textselected = entText.TextString
textselected = Replace(textselected, "N", "XX")
textselected = Replace(textselected, "S", "VVV")
textselected = Replace(textselected, "E", "QQQQ")
textselected = Replace(textselected, "W", "ZZZZZ")
textselected = Replace(textselected, "XX", "S")
textselected = Replace(textselected, "VVV", "N")
textselected = Replace(textselected, "QQQQ", "W")
textselected = Replace(textselected, "ZZZZZ", "E")

I need to update the text that I selected in AutoCad with textselected????????????
0 Likes
Message 4 of 5

Anonymous
Not applicable
wrote in message
news:5865163@discussion.autodesk.com...
I figured it out. Just add this code to the bottom of the previous code.
But I have one more question...

textselected = entText.TextString
textselected = Replace(textselected, "N", "XX")
textselected = Replace(textselected, "S", "VVV")
textselected = Replace(textselected, "E", "QQQQ")
textselected = Replace(textselected, "W", "ZZZZZ")
textselected = Replace(textselected, "XX", "S")
textselected = Replace(textselected, "VVV", "N")
textselected = Replace(textselected, "QQQQ", "W")
textselected = Replace(textselected, "ZZZZZ", "E")

I need to update the text that I selected in AutoCad with
textselected????????????

entText.TextString = textselected
entText.Update
hth
mark
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thanks Mark!
0 Likes