Author Topic: Insert Text from .RTF to Mtext  (Read 1801 times)

0 Members and 1 Guest are viewing this topic.

gumbtg

  • Mosquito
  • Posts: 12
Insert Text from .RTF to Mtext
« on: May 11, 2022, 08:28:25 AM »
My company is switching from SHX to TTF fonts. Historically we write our drawing notes in Word, convert to an .Ans file, and then a custom lisp reads the .Ans file line by line and imports them into CAD. Each line being its own text object. The advantage of the lisp routine is that we can do Batch Updates/Inserts of drawing notes across the entire project.

Now that we have switched to non-monoscaped TTF fonts we are having problems with paragraph indentation formatting. Text objects in CAD are no longer the answer; Mtext objects with paragraph formatting are. If I apply paragraph indentation formatting to the Mtext object they look perfect!

Problem:
The only way to bring in our notes files into CAD with the proper formatting is to use the "Insert Text" option within the Text Editor Contextual Tab. This allows you to import text from a .RTF or .TXT file. It brings in all the formatting if you select a .RTF file. The problem is that I have been unable to find any documentation on how to call this "Import Text" command via Lisp. Does anyone know if this command is targetable by Lisp???
I can't find ANY documentation on how to call this! Is there anyway for me to launch this command from a lisp routine???

See the screenshot below
------------
(If you arent aware a .rtf file is a "Rich Text File". It maintains the formatting from Word, but is a universal file type.)
------------
Thanks for any and all help

mhupp

  • Bull Frog
  • Posts: 250
Re: Insert Text from .RTF to Mtext
« Reply #1 on: May 11, 2022, 11:54:03 AM »
Maybe using entmake and reading line by line. see last post by CAB.
https://www.theswamp.org/index.php?topic=949.msg12527#msg12527

gumbtg

  • Mosquito
  • Posts: 12
Re: Insert Text from .RTF to Mtext
« Reply #2 on: May 11, 2022, 01:36:26 PM »
That would be an option if this was a monospaced font. Since it is not paragraph formatting is needed to get the formatting indention to line up correctly.  :reallysad:
Your suggestion is how we did our notes files in the past. But that method requires a monospaced font for presentation fidelity.

d2010

  • Bull Frog
  • Posts: 323
Re: Insert Text from .RTF to Mtext
« Reply #3 on: May 11, 2022, 01:41:00 PM »
My company is switching from SHX to TTF fonts. Historically we write our drawing notes in Word, convert to an .Ans file, and then a custom lisp reads the .Ans file line by line and imports them into CAD. Each line being its own text object. The
Please you do not write documents.DOc inside model-space.Dwg
because you slow down too much your/s the speed Acad, and
you generate too many incompatibilities with Revit.exe, Briscad.exe.ProgeCad, NanoCad
. I think worst .. after i got experienced with others... O
 :idiot2:=another method, We can" Transpile DOc to RegenRTF.lsp "
The programe "RegenRTF.lsp"  create  the file.doc on disk, reading
information/s from acad.exe
 :hahanot:=The RegenRTF.lsp read information/s from files*.cpxml and
the RegenRTF.lsp create the file "Drawing1__203114.doc"
the RegenRTF.lsp input *.cpxml and export the file "Drawing1__203115.doc"
Code: [Select]
Best Regards...MsWord.exe si too powerfull with processing the file*.doc
Other companies are rejected  the operations 
importing the *.doc inside Model-space.dwg
« Last Edit: May 11, 2022, 02:15:29 PM by d2010 »

mhupp

  • Bull Frog
  • Posts: 250
Re: Insert Text from .RTF to Mtext
« Reply #4 on: May 11, 2022, 05:38:53 PM »
Your suggestion is how we did our notes files in the past. But that method requires a monospaced font for presentation fidelity.

Sorry thought (read-line) brought over the formatting to,

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Insert Text from .RTF to Mtext
« Reply #5 on: May 11, 2022, 08:35:52 PM »
2 answers

Have you tried simple copy and paste into Mtext ? We have standard notes that were made in WORD and they allow more lines and renum auto when lines removed.


You can read direct from Word using VL lisp with Autocad its the same as the method of linking excel, you open a Application link. For me to write code is a waste, copy paste is like 2 seconds.
A man who never made a mistake never made anything

gumbtg

  • Mosquito
  • Posts: 12
Re: Insert Text from .RTF to Mtext
« Reply #6 on: May 12, 2022, 08:21:53 AM »
BigAl, thank you for confirming that ActiveX method will work. I will investigate this. This is the only way that I saw possible.

We can not go the Copy/Paste method. We need to the ability to batch update/insert drawing notes across hundreds of dwgs for some of our projects.
Thank you for providing help.

gumbtg

  • Mosquito
  • Posts: 12
Re: Insert Text from .RTF to Mtext
« Reply #7 on: May 12, 2022, 08:24:18 AM »
Your suggestion is how we did our notes files in the past. But that method requires a monospaced font for presentation fidelity.

Sorry thought (read-line) brought over the formatting to,

Not a bad suggestion. Unfortuantly you can not read a .rtf file line by line and come out with the correct text. It reads a lot of useless information instead. Only can be done with .txt.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Insert Text from .RTF to Mtext
« Reply #8 on: May 14, 2022, 01:41:24 AM »
Have a look at this, do apologise no author name in one of them.

A man who never made a mistake never made anything


d2010

  • Bull Frog
  • Posts: 323
Re: Insert Text from .RTF to Mtext
« Reply #10 on: July 26, 2022, 12:47:55 AM »
You  can create .RTF from input Samples\*.cgxml
You unpack on drive C:\.
You view the tmtlogo.avi
In attach, here temporally.

« Last Edit: July 26, 2022, 02:45:21 AM by d2010 »