DansCAD Posted June 30, 2016 Share Posted June 30, 2016 Hi guys and girls, I am new to this and have a (hopefully) simple question. I have a script file that creates mtext and writes a list of items like this: Name - description OtherName - Description What I want is for it to be neatly tabbed out so that the dashes line up vertically, however I cannot find a command to insert a {TAB} into the text. An example of my script is -Mtext 96000,24000 S HEAD1 J TL 120000,14000 \H0.75x;\C2 \H1.333333333x;\C4\LUPPER ROOF FRAMING\l\H0.75x;\C2 (1:100)\P UL.1 - 90x63 LVL and 100x75x10 Galintel Angle UL.2 - 90x45 LVL and 100x75x10 Galintel Angle and i want to insert tab as shown: UL.2 {TAB}- 90x45 LVL and 100x75x10 Galintel Angle Is there a way to do what i want? Thanks Dan Quote Link to comment Share on other sites More sharing options...
steven-g Posted July 1, 2016 Share Posted July 1, 2016 I can get most special characters using the unicode format, \U+00B1 but TAB refuses to work Quote Link to comment Share on other sites More sharing options...
DansCAD Posted July 4, 2016 Author Share Posted July 4, 2016 Thanks steven, I will give it a go - at least I will be able to use other characters. Cheers Dan Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 6, 2016 Share Posted July 6, 2016 Just did this as a dump TextString = "abcde\t2345 678\t{\\C1;90}" abcde..... 2345 678...... 90 Quote Link to comment Share on other sites More sharing options...
DansCAD Posted July 6, 2016 Author Share Posted July 6, 2016 Thanks BigAl, What you have written there looks more like a LISP routine or something. the "\t" unfortunately doesn't work in an AutoCAD LT14 script. Cheers, Dan Quote Link to comment Share on other sites More sharing options...
YZ Posted July 7, 2016 Share Posted July 7, 2016 Hey DansCAD, welcome to the forum. With the limitation of LT, maybe another option is to create two distinct text object per line, and create the alignment manually that way... Quote Link to comment Share on other sites More sharing options...
DansCAD Posted July 7, 2016 Author Share Posted July 7, 2016 Thanks YZ, I have thought about creating the titles in one Mtext and then the descriptions in another with a preset offset. It all comes down to the preference of the other guys, as they'll be using it more than me. Cheers Dan Quote Link to comment Share on other sites More sharing options...
YZ Posted July 7, 2016 Share Posted July 7, 2016 Haha, don't give them the option! Just tell them it had to be that way for whatever reason! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 11, 2016 Share Posted July 11, 2016 Just maybe a way around it. Make your script in notepad. Add the tabs at required locations. Copy and paste the 1st half of the mtext set up colour ht etc. Copy and paste the re-mainder which has tabs in it to the mtext the tabs should remain. Tested with normal Autocad and works. Quote Link to comment Share on other sites More sharing options...
DansCAD Posted July 11, 2016 Author Share Posted July 11, 2016 Thanks Al, I gather you mean manual copy/paste from the script? The purpose of the exercise is to have a singe click operation which inserts the tabs - I don't want to be opening scripts to copy text - it kinda defeats the purpose! I tried having tabs in the script file and running the script file but it just reads it as an extra space. I understand understand why this is even a problem... Why can't CAD just read the unicode format properly??? Quote Link to comment Share on other sites More sharing options...
YZ Posted July 18, 2016 Share Posted July 18, 2016 If BIGAL's solution works and you can add tabs in Notepad that successfully translate in to AutoCAD format how you want them, then perhaps there is a way to programmatically do that using a third party software like a batch file that opens notepad, then opens AutoCAD?... But yeah, it seems like AutoCAD is not playing this game for you. Quote Link to comment Share on other sites More sharing options...
DansCAD Posted July 18, 2016 Author Share Posted July 18, 2016 Hmmm... yeah that could work. I have written batch scripts that are called by Word before and they work ok. They are harder to implement than a standard cad macro. If I get a chance I might give it a try and see how it goes. I will update this thread as to how it goes. (It might be a while until I get around to it though...) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 19, 2016 Share Posted July 19, 2016 Word has VBA inside it so maybe you can control commands to Autocad, as a start search for excel controlling Autocad you will find examples and the code should be the same. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 20, 2016 Share Posted July 20, 2016 Steven-g I googled the VBA to Autocad and had it say "hello" and draw some points from excel. Make sure if you try must add the Autocad libray type in excel VBA. http://howtoautocad.com/excel-and-autocad-%E2%80%93-a-match-made-in-heaven-again/ Does it work with LT ? If so opens up a pandoras box of power, a little clumsy but useable. Copy/paste or enter corner pt then do 20 questions and object appears. Quote Link to comment Share on other sites More sharing options...
steven-g Posted July 20, 2016 Share Posted July 20, 2016 That's a shame, it fails on the very first line, It is possibly calling the vba module used in Autocad, and this is not available to LT. I use excel vba to to create scripts for Autocad but saving on the copy / paste (or creating a named ????.scr file to run from a macro) would have saved a few steps. I really do need to get my web site running (it's so close) EDIT - this is a quote from the link, it does need the VBA option of full Autocad, this library isn't available to LT users If you’ve done any programming before, you will know that you can have variables, and variables can have different types. These types can be simple, or can be more complex things known as objects. AutoCAD® has its own type library containing all the object types that we are likely to need. This is very useful to load into our application. To do this, go to Tools>References in the VBA window, and look for an option called AutoCAD® 2010 Type Library, or whatever version of AutoCAD® you are using. This has now made available some extra types that weren’t available before. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 21, 2016 Share Posted July 21, 2016 (edited) Another more interesting if you have the non commercial version of excel it will not let you pick the libraries, finds them but greyed out. Works now did something wrong yesterday. acax20enu.tlb is the file it looks for this is the english version, others like acax20ita.tlb I would guess to be Italian. Edited July 21, 2016 by BIGAL 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.