Author Topic: Strip Mtext formatting revisited  (Read 3355 times)

0 Members and 1 Guest are viewing this topic.

BazzaCAD

  • Guest
Strip Mtext formatting revisited
« on: December 19, 2017, 07:38:08 PM »
I've seen a number of old posts that deal with stipping the formatting out of Mtext objects:
http://www.theswamp.org/index.php?topic=7272.0

However, they're all failing on me because my Mtext object has a path to a file in it.

Quote
User note:
refer to
G:\Resources\Codes and Design\Wood\APA\Sheet metal and staple blocking N370.pdf
for test results and staple design guidelines

Code: [Select]
User note: \\Prefer to \\PG:\\\\Resources\\\\Codes and Design\\\\Wood\\\\APA\\\\Sheet metal and staple blocking N370.pdf\\Pfor test results and staple design guidelines
The "\\\\" seems to be screwing things up.

When I run (HumptyDumpty) from here:
https://www.theswamp.org/index.php?topic=7272.msg90627#msg90627

I get back:
Code: [Select]
User note:  refer to  G:\\\\Resources\\
I'm guessing because "\\C" is a format code, but "\\R" isn't.
Any suggestions?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Strip Mtext formatting revisited
« Reply #1 on: December 20, 2017, 09:12:49 AM »
Perhaps the following may produce better results:

http://lee-mac.com/unformatstring.html
http://lee-mac.com/gettruecontent.html

I have also posted a more recently developed 'Quick Unformat' function here:

https://www.theswamp.org/index.php?topic=52929.msg577561#msg577561

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Strip Mtext formatting revisited
« Reply #2 on: December 20, 2017, 09:47:16 AM »
... and there is this one:
http://cadabyss.wordpress.com/

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Strip Mtext formatting revisited
« Reply #3 on: December 20, 2017, 10:32:47 AM »
Hi,

This is not LISP, but the SwampTools LISP extension library contains a swp-stripmtext LISP function (the .NET MText.Text property returns the the MText contents with all formatting removed).

(swp-stripmtext (car (entsel))) shoud return:
"User note:\r\nrefer to\r\nG:\\Resources\\Codes and Design\\Wood\\APA\\Sheet metal and staple blocking N370.pdf\r\nfor test results and staple design guidelines"


Speaking English as a French Frog

BazzaCAD

  • Guest
Re: Strip Mtext formatting revisited
« Reply #4 on: December 20, 2017, 01:21:03 PM »
Thanks everyone for the suggestions, I'll give them a try.
Does anyone have the formatting codes documented anywhere?
I think I want to stip some of them, but keep others.
From Lee's code, I got these "ACcFfHLlOopQTW"

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Strip Mtext formatting revisited
« Reply #5 on: December 20, 2017, 01:25:54 PM »
From Lee's code, I got these "ACcFfHLlOopQTW"

The later code linked above also includes the new strikethough formatting option, therefore "ACcFfHKkLlOopQTW".

BazzaCAD

  • Guest
Re: Strip Mtext formatting revisited
« Reply #6 on: December 20, 2017, 01:29:49 PM »
From Lee's code, I got these "ACcFfHLlOopQTW"

The later code linked above also includes the new strikethrough formatting option, therefore "ACcFfHKkLlOopQTW".

Thanks, Lee, but do you have something like this?
C = Color
F = Font
Etc...

Are uppercase & lower case the same?
e.g. "C" & "c" = color?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Strip Mtext formatting revisited
« Reply #7 on: December 20, 2017, 01:31:35 PM »
There's this:
http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-7D8BB40F-5C4E-4AE5-BD75-9ED7112E5967

But the rest of the possible codes I've gleaned from extensive testing & experimentation...

BazzaCAD

  • Guest
Re: Strip Mtext formatting revisited
« Reply #8 on: December 20, 2017, 01:34:05 PM »
There's this:
http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-7D8BB40F-5C4E-4AE5-BD75-9ED7112E5967

But the rest of the possible codes I've gleaned from extensive testing & experimentation...

Great, thanks much.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Strip Mtext formatting revisited
« Reply #9 on: December 20, 2017, 01:50:46 PM »
I have distilled the documentation to this:
Code: [Select]
;;; ======================================================================
;;; Mtext formatting information:
;;;
;;; See: http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-7D8BB40F-5C4E-4AE5-BD75-9ED7112E5967
;;;
;;; "\\\\"     Escape sequence for \
;;; "\\{"                          {
;;; "\\}"                          }
;;;
;;; Codes without attributes and without a text sequence:
;;; "\\~"      Non-breaking space.
;;; "\\P"      Paragraph.
;;;
;;; Codes without attributes and with a text sequence ending in ";": "\\S1/2;"
;;; Code letter can be upper case or lower case.
;;; "\\S"      Stacking. Stacking happens at the next "/", "#" or "^" symbol.
;;;
;;; Codes without attributes and with or without a bracketed text sequence: "{\\LText}"
;;;                                        or an alternative text sequence: "\\OText\\o"
;;; Code letter can be upper case (= start of sequence) or lower case (= end of sequence).
;;; "\\K"      Strikethrough. Not supported in BricsCAD: is displayed but mtext cannot be edited.
;;; "\\L"      Underscore.
;;; "\\O"      Overscore.
;;;
;;; Codes with attributes and without a text sequence:
;;; "\\A...;   Alignment. Not supported in BricsCAD.
;;; "\\p...;"  Bullets, numbered paragraphs and columns (tabs).
;;;
;;; Codes with attributes and with or without a bracketed text sequence: "{\\C1;Text}"
;;; Code letter can be upper or lower case.
;;; "\\C...;"  Color. "\\C" for ACI color; "\\c" for true color.
;;; "\\F...;"  Font.
;;; "\\H..x;"  Height. The "x" is optional and indicates relative height.
;;; "\\Q...;"  Obliquing (degrees).
;;; "\\T...;"  Tracking, character spacing (factor).
;;; "\\W...;"  Width, character width (factor).
;;; ======================================================================

BazzaCAD

  • Guest
Re: Strip Mtext formatting revisited
« Reply #10 on: December 20, 2017, 01:58:04 PM »
I have distilled the documentation to this:
Code: [Select]
;;; ======================================================================
;;; Mtext formatting information:
;;;
;;; See: http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-7D8BB40F-5C4E-4AE5-BD75-9ED7112E5967
;;;
;;; "\\\\"     Escape sequence for \
;;; "\\{"                          {
;;; "\\}"                          }
;;;
;;; Codes without attributes and without a text sequence:
;;; "\\~"      Non-breaking space.
;;; "\\P"      Paragraph.
;;;
;;; Codes without attributes and with a text sequence ending in ";": "\\S1/2;"
;;; Code letter can be upper case or lower case.
;;; "\\S"      Stacking. Stacking happens at the next "/", "#" or "^" symbol.
;;;
;;; Codes without attributes and with or without a bracketed text sequence: "{\\LText}"
;;;                                        or an alternative text sequence: "\\OText\\o"
;;; Code letter can be upper case (= start of sequence) or lower case (= end of sequence).
;;; "\\K"      Strikethrough. Not supported in BricsCAD: is displayed but mtext cannot be edited.
;;; "\\L"      Underscore.
;;; "\\O"      Overscore.
;;;
;;; Codes with attributes and without a text sequence:
;;; "\\A...;   Alignment. Not supported in BricsCAD.
;;; "\\p...;"  Bullets, numbered paragraphs and columns (tabs).
;;;
;;; Codes with attributes and with or without a bracketed text sequence: "{\\C1;Text}"
;;; Code letter can be upper or lower case.
;;; "\\C...;"  Color. "\\C" for ACI color; "\\c" for true color.
;;; "\\F...;"  Font.
;;; "\\H..x;"  Height. The "x" is optional and indicates relative height.
;;; "\\Q...;"  Obliquing (degrees).
;;; "\\T...;"  Tracking, character spacing (factor).
;;; "\\W...;"  Width, character width (factor).
;;; ======================================================================

Very nice, thanks!