Jump to content

Writing a text programmatically without a text object


mohsen62sm

Recommended Posts

Hello,

 

I need to create some texts using the following command in VBA:

ThisDrawing.SendCommand ("Text" & vbCr & "10,10,0" & vbCr & vbCr & vbCr)

 

But, I must enter the text manually. I want to enter the text programmatically. How?

 

Thank you

Link to comment
Share on other sites

Could a string returned from:

ThisDrawing.Utility.GetString()

Be used with the standard AddText method? That would allow manual text input yet avoid the issues associated with SendCommand.

Link to comment
Share on other sites

Hello Satish,

 

In fact, I am using a lisp file named "KATEB":

ThisDrawing.SendCommand ("KATEB" & vbCr & "10,10,0" & vbCr & vbCr & vbCr)

 

this lisp file converts english texts to Farsi (persian). I'm creating a Tool kit for my works, and in one of them I want to read texts from a Textbox and programmatically write texts to Farsi.

Link to comment
Share on other sites

without being familiar with this KATEB lisp command prompts makes it difficult to give you a solution - where in your SendCommand are you specifying the string you are translating to Farsi?

 

ThisDrawing.SendCommand ("KATEB" & vbCr & "10,10,0" & vbCr & vbCr & vbCr & sTextToInsert)

 

but that code is going to insert each item into the same location, so you would need some variables for your text insertion points too

 

I'm sure most people will agree that using SendCommand is a last resort, but in your case I can see why you are doing it, because you dont have a VBA function that converts English to Farsi, and you are relying on LISP that you dont want to write, or just plain dont know how to write.

 

Do you have any contact information for the author of the KATEB code? usually the author leaves some sort of contact details on the website where you get the code in the first place

Link to comment
Share on other sites

Hello abraxus,

The code that I wrote is a sample. You can use the Text command to examine. When you execute this routine:

sub Text()

ThisDrawing.SendCommand ("Text" & vbCr & "10,10,0" & vbCr & vbCr & vbCr)

end sub

 

the autocad is waiting to enter a text manually. The sTextToInsert that you wrote is not executed and focus is given to AutoCAD.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...