mohsen62sm Posted October 7, 2013 Share Posted October 7, 2013 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 Quote Link to comment Share on other sites More sharing options...
satishrajdev Posted October 7, 2013 Share Posted October 7, 2013 You can do it by lisp also.... why do you need VBA??? Quote Link to comment Share on other sites More sharing options...
SEANT Posted October 7, 2013 Share Posted October 7, 2013 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. Quote Link to comment Share on other sites More sharing options...
mohsen62sm Posted October 7, 2013 Author Share Posted October 7, 2013 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. Quote Link to comment Share on other sites More sharing options...
abraxus Posted October 10, 2013 Share Posted October 10, 2013 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 Quote Link to comment Share on other sites More sharing options...
mohsen62sm Posted October 11, 2013 Author Share Posted October 11, 2013 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. Quote Link to comment Share on other sites More sharing options...
abraxus Posted October 11, 2013 Share Posted October 11, 2013 you cannot use send command to prompt for text you have to have it "saved up" programatically Quote Link to comment Share on other sites More sharing options...
mohsen62sm Posted October 11, 2013 Author Share Posted October 11, 2013 How? I do not know. Quote Link to comment Share on other sites More sharing options...
abraxus Posted October 11, 2013 Share Posted October 11, 2013 explain your programming experience then, dude, im not going to just write code for you - never use "sendCommand" Quote Link to comment Share on other sites More sharing options...
abraxus Posted October 11, 2013 Share Posted October 11, 2013 since your code depends on a LISP command that cannot be substituted, name the source of your lisp command Quote Link to comment Share on other sites More sharing options...
mohsen62sm Posted October 11, 2013 Author Share Posted October 11, 2013 I think it's better that convert the lisp to VB code. Quote Link to comment Share on other sites More sharing options...
abraxus Posted October 11, 2013 Share Posted October 11, 2013 i agree - but can you do that? if you can, then you can use all the flexibility of vba - passing vba variables lisp is too complex Quote Link to comment Share on other sites More sharing options...
mohsen62sm Posted October 11, 2013 Author Share Posted October 11, 2013 Yes, I already changed a lisp to vb. It's easy, but time-consuming. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.