Table of Contents

CadMTextEditorLayout

from OpenCAD2D import CadMTextEditorLayout

class CadMTextEditorLayout(System.Object) ยท CadMTextEditorLayout in the .NET reference

The words of an MTEXT being edited in place, laid out as the canvas will draw them: the one layout of the display, wrapped at the width, its lines spaced by the MTEXT's rule, its stacks, tabs, indents, paragraph spacing, columns, mask and frame, in the drawing's fonts; with where each place of the editor (CadMTextEditor) stands, for its caret and selection. Everything is in the MTEXT's own frame and drawing units: its location at nought, x along its direction, y up.

Constructors

__init__

.NET

def __init__(self, document: CadDocument, edit: CadInPlaceEdit) -> None

Makes the layout of an MTEXT edited in place: the MTEXT of the edit's handle, its spacing style, columns, mask and frame kept; for an MTEXT being made or a table cell, an MTEXT of the edit's height, width, style and attachment.

Properties and fields

Bounds

.NET

@property
def Bounds(self) -> System.Array[float]

Gets the box of everything drawn: the defined box, the ink of the letters and the mask and frame; left, bottom, right and top.

Box

.NET

@property
def Box(self) -> System.Array[float]

Gets the box the MTEXT is defined by, as its grips stand: left, bottom, right and top.

ColumnCount

.NET

@property
def ColumnCount(self) -> int

Gets how many columns the words stand in now: 1 with none, those the words fill with dynamic ones.

Frame

.NET

@property
def Frame(self) -> CadMTextFrame | None

Gets the MTEXT's box as last laid out: the editor's frame; null before the first CadMTextEditorLayout.Update with it.

LineCount

.NET

@property
def LineCount(self) -> int

Gets how many lines the words make, an empty paragraph at the end one of them.

Parts

.NET

@property
def Parts(self) -> System.Collections.Generic.IReadOnlyList[DisplayItem2]

Gets the parts the words are drawn as, as the canvas draws an MTEXT (DisplayText2.Parts): the mask and the frame first, then the runs and their lines.

Methods

BaselineOf

.NET

def BaselineOf(self, line: int) -> float

Gets the baseline of a line.

BottomOf

.NET

def BottomOf(self, line: int) -> float

Gets the foot of a line's cell: the ink below its baseline, or a third of the MTEXT's height.

ColumnOf

.NET

def ColumnOf(self, line: int) -> int

Gets the column a line stands in, from nought.

LineEnd

.NET

def LineEnd(self, line: int) -> int

Gets the place at the end of a line, where End goes: before the space it breaks at or the paragraph break that ends it, or after the last place of the words.

LineOfPlace

.NET

def LineOfPlace(self, place: int) -> int

Gets the line a place stands on.

LineStart

.NET

def LineStart(self, line: int) -> int

Gets the first place of a line, where Home goes.

PlaceAt

.NET

def PlaceAt(self, x: float, y: float) -> int

Gets the place nearest a point, for a click: on the line under it (of the column under it, or the nearest), before the first letter whose middle is right of it, else at the line's end.

PlaceOnLine

.NET

def PlaceOnLine(self, line: int, x: float) -> int

Gets the place of a line nearest an X, for the arrows up and down: before the first letter whose middle is right of it, else at the line's end.

RightOf

.NET

def RightOf(self, place: int) -> float

Gets where a place's letter ends along the line: the X of the caret after it on the same line.

SetMask

.NET

def SetMask(self, mask: CadMTextMask) -> None

Gives the words the background mask the editor shows them on, drawn by the next CadMTextEditorLayout.Update; the MTEXT's own where none is given. A file older than R2004 has no background, and keeps the words as they are.

TopOf

.NET

def TopOf(self, line: int) -> float

Gets the top of a line: of its tallest letters.

Update

.NET

def Update(self, editor: CadMTextEditor, attachment: int, lineSpacing: float, rgb: int, layerRgb: int) -> None

Lays the words out again, as they are and in the box the editor has now (CadMTextEditor.Frame): its width, defined height and columns, as the ruler and Column Settings change them.

def Update(
    self,
    editor: CadMTextEditor,
    width: float,
    attachment: int,
    lineSpacing: float,
    rgb: int,
    layerRgb: int,
) -> None

Lays the words out again, as they are and with the box as the editor has it now. A width of nought wraps nothing; with columns, the width is the columns'.

XOf

.NET

def XOf(self, place: int) -> float

Gets where the caret stands before a place, along the line: the left of its letter.