Import a txt file into Mtext

Discussion in 'AutoCAD' started by Matthew.Corbin, Mar 3, 2004.

  1. Hello,
    I've been asked to create a way to update some text automatically. I have played with xrefs and rtext, but neither of these allow me to adjust the wrapping. So I am trying to develop an mtext object that automatically updates itself whenever the drawing is opened. I'm not extremely proficient with LISP, but I do know the basics so i'm going to approach this in small chunks. First i'd like some advice on how to import a .txt file into mtext.Any help or points in the right direction would be greatly appreciated.
    Kind Regards,
    Matthew Corbin
     
    Matthew.Corbin, Mar 3, 2004
    #1
  2. Matthew.Corbin

    R.K. McSwain Guest

    Unless you are set on writing this yourself, it's already been done.
    http://www.dotsoft.com/livetext.htm
     
    R.K. McSwain, Mar 3, 2004
    #2
  3. Well, that was easy. I had stumbled on this tool before and completely forgot about it. Luckily they have a free version on the site. Thanks for your help.

    Matthew Corbin
     
    Matthew.Corbin, Mar 3, 2004
    #3
  4. Well, I came in this morning and tried out the free version of ltext. Turns out you can't use external files in the free version. Also there is far too much user interaction. This process needs to be invisible to the users. We've only got two different text files that will be used in this way. I think it would be a good learning experience to try this on my own. So in response to my original thread, i've only found topics dealing with retrieving lines from an external file and then iterating through them. How do I read the whole file and return it's contents as a string?

    Thanks,
    Matthew Corbin
     
    Matthew.Corbin, Mar 3, 2004
    #4
  5. Read in each line and strcat them together would be one way
     
    Allen Johnson, Mar 3, 2004
    #5
  6. Matthew.Corbin

    ECCAD Guest

    Matthew,
    In order to preserve the CR/LF - you will need to strcat a "\\P" also.

    (STRCAT "LINE 1" "\\P" "LINE 2" "\\P" "LINE3")

    Bob
     
    ECCAD, Mar 3, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.