CadMTextContent
from OpenCAD2D import CadMTextContent
class CadMTextContent(System.Object) ยท CadMTextContent in the .NET reference
The words of an MTEXT read into paragraphs of runs of one look, and written back in AutoCAD's inline codes. Reading takes every code AutoCAD 2021 writes: \P (and the column and dimension breaks \N, \X) between paragraphs, \L \l \O \o \K \k the lines under, over and through, \f and \F the fonts, \C and \c the colours, \H the height (x after it a factor of the height before), \Q, \T, \W the slant, spacing and width, \A the alignment in the line, \p the paragraph, braces around a look of its own, \\ \{ \} the letters themselves, \~ a hard space; stacks (\S), symbols (%%d, %%p, %%c, \U+2248) and codes not known are kept as written, each one run.
Properties and fields
IsOneLook
@property
def IsOneLook(self) -> bool
Gets whether every run is CadMTextLook.Plain but for one font, slant or width set before the first letter, and no paragraph is aligned: what a drawing of the words in one look shows whole.
Paragraphs
@property
def Paragraphs(self) -> System.Collections.Generic.IReadOnlyList[CadMTextParagraph]
Gets the paragraphs, at least one.
PlainText
@property
def PlainText(self) -> str
Gets the letters as shown, the paragraphs separated by line feeds.
Methods
Of
@staticmethod
def Of(paragraphs: System.Collections.Generic.IEnumerable[CadMTextParagraph]) -> CadMTextContent
Makes the content of paragraphs.
Parse
@staticmethod
def Parse(contents: str, height: float) -> CadMTextContent
Reads the words of an MTEXT as its group 1 and 3 write them. A height set to the MTEXT's own is read as no height, so that {\H2.5;A} of an MTEXT 2.5 high is plain.
@staticmethod
def Parse(contents: str, height: float, styleWidth: float) -> CadMTextContent
Reads the words as CadMTextContent.Parse does, for laying them out: a width factor in times (W1.2x;) before any other is times the style's, 0.9 in a style of 0.75.
Write
def Write(self, height: float, defaultAlignment: str = ...) -> str
Writes the content in AutoCAD's codes, as the class says.