Skip to content

[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADBaseCustomizaText

Class: MxCADBaseCustomText

2d.MxCADBaseCustomText

Represents the base class for custom text elements, used to define layout calculations and entity generation for text nodes.

Description

MxCADBaseCustomizaText is an abstract base class responsible for providing width and height calculation and entity creation interfaces for custom text nodes. The implementation class that inherits this class can calculate the size based on the content of the text node and generate the corresponding McDbEntity or McDbCCustoms Entity entity. Instructions:

  1. Inherit MxCADBaseCustomizaText and implement type, calculate, and create methods.
  2. Calculate layout data such as width and height based on text nodes in Calculate.
  3. Generate a printable entity array in create based on the calculation results and positions.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new MxCADBaseCustomText()

Properties

type

Abstract type: string

type

Methods

calculate

Abstract calculate(entity, textNode): MxCADCustomTextCalculateData

Calculate layout data

Parameters

NameType
entityMxCADMText
textNodeMarksStyleText

Returns

MxCADCustomTextCalculateData


create

Abstract create(entity, textNode, calculateData, renderData): (McDbEntity | McDbCustomEntity)[]

Create entity

Parameters

NameType
entityMxCADMText
textNodeMarksStyleText
calculateDataMxCADCustomTextCalculateData
renderDataCreateData

Returns

(McDbEntity | McDbCustomEntity)[]