Skip to content

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

Class: McDbMLine

2d.McDbMLine

Multi line custom entity class Implement multi line drawing function, support multi line style, endpoint style, fill and other features

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbMLine(imp?)

Parameters

NameType
imp?any

Overrides

McDbCustomEntity.constructor

Properties

imp

imp: any = 0

Internal implementation object.

Inherited from

McDbCustomEntity.imp

Accessors

colorIndex

get colorIndex(): number

Obtain object color index

Example

ts
 import { McDbEntity, ColorIndexType } from 'mxcad'
 const ent = new McDbEntity();
 ent.colorIndex = ColorIndexType.kByblock;
 console.log(ent.colorIndex)

Returns

number

Inherited from

McDbCustomEntity.colorIndex

set colorIndex(val): void

Set object color index

Parameters

NameTypeDescription
ValnumberColorIndexType

Returns

void

Inherited from

McDbCustomEntity.colorIndex


drawOrder

get drawOrder(): number

Display order of objects

Example

ts
//Assuming ent is a valid instance object
const order = ent.drawOrder();

Returns

number

Inherited from

McDbCustomEntity.drawOrder

set drawOrder(order): void

Display order of objects

Example

ts
import { MxCpp, MxCADSelectionSet } from "mxcad";

let ss = new MxCADSelectionSet();
If (! Await ss.userSelect) return;
//Obtain the maximum and minimum display order of objects on the current graph
let minmaxOrder = MxCpp.getCurrentDatabase().currentSpace.getMinMaxDrawOrder();
//Place the object at the top.
let lOrder = minmaxOrder.maxDrawOrder + 1;
ss.forEach((id) => {
  let ent = id.getMcDbEntity();
  if (ent) {
    ent.drawOrder = lOrder;
  }
})

Parameters

NameTypeDescription
Ordernumbersequential value

Returns

void

Inherited from

McDbCustomEntity.drawOrder


dxf0

get dxf0(): string

Obtain the type name of the object's DXF group code, which is the same as the DXF group code in AutoCAD. For example, the type name of the line is McDbLine, and the group code value for DXF0 is: LINE and DXF0 group code values can be used for type filtering when constructing sets.

Returns

string

Inherited from

McDbCustomEntity.dxf0


layer

get layer(): string

Obtain the layer name of the object

Returns

string

Inherited from

McDbCustomEntity.layer

set layer(val): void

Set object layer name

Example

ts
 import { McDbEntity } from 'mxcad'
 const ent = new McDbEntity();
 ent.layer = "newLayerName";
 console.log(ent.layer)

Parameters

NameTypeDescription
ValstringLayer Name

Returns

void

Inherited from

McDbCustomEntity.layer


layerId

get layerId(): McObjectId

Get layer ID object

Example

ts
//Assuming ent is a valid instance object
const layerId = ent.layerId;

Returns

McObjectId

Inherited from

McDbCustomEntity.layerId

set layerId(id): void

Set Layer Id Object

Example

ts
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
Const layerId=mxcad. addLayer (Test Layer)
ent.layerId = layerId;

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCustomEntity.layerId


linetype

get linetype(): string

Obtain the object line type name

Returns

string

Inherited from

McDbCustomEntity.linetype

set linetype(val): void

Set object line type name

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetype = "MyLineType";
console.log(ent.linetype)

Parameters

NameTypeDescription
ValstringLine type name

Returns

void

Inherited from

McDbCustomEntity.linetype


linetypeId

get linetypeId(): McObjectId

Get entity object line type ID

Example

ts
//Assuming ent is a valid instance object
const linetypeId = ent.linetypeId;

Returns

McObjectId

Inherited from

McDbCustomEntity.linetypeId

set linetypeId(id): void

Set entity object line type ID

Example

ts
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
const lineId = mxcad.addLinetypeEx("TestMyLine", '25,-5');
ent.linetypeId = lineId;

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCustomEntity.linetypeId


linetypeScale

get linetypeScale(): number

Obtain the proportion of object line types

Returns

number

Inherited from

McDbCustomEntity.linetypeScale

set linetypeScale(val): void

Set object line type scale

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetypeScale = 0.8;
console.log(ent.linetypeScale)

Parameters

NameTypeDescription
ValnumberLine type ratio

Returns

void

Inherited from

McDbCustomEntity.linetypeScale


lineweight

get lineweight(): number

Obtain object line weight

Returns

number

Inherited from

McDbCustomEntity.lineweight

set lineweight(val): void

Set object line weight

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.lineweight = 20;
console.log(ent.lineweight)

Parameters

NameTypeDescription
Valnumberline weight

Returns

void

Inherited from

McDbCustomEntity.lineweight


normal

get normal(): McGeVector3d

Return the normal of the object

Example

ts

Returns

McGeVector3d

Inherited from

McDbCustomEntity.normal

set normal(val): void

Set the normal of the object

Example

ts

Parameters

NameType
valMcGeVector3d

Returns

void

Inherited from

McDbCustomEntity.normal


objectName

get objectName(): string

Get the object name.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.objectName);

Returns

string

Return object name

Inherited from

McDbCustomEntity.objectName


textStyle

get textStyle(): string

Obtain the text style of the object

Returns

string

Inherited from

McDbCustomEntity.textStyle

set textStyle(val): void

Set object text style

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";

Parameters

NameTypeDescription
ValstringText style name

Returns

void

Inherited from

McDbCustomEntity.textStyle


textStyleId

get textStyleId(): McObjectId

Get entity text style

Example

ts
//Assuming ent is a valid instance object
const textStyleId = ent.textStyleId;

Returns

McObjectId

Inherited from

McDbCustomEntity.textStyleId

set textStyleId(id): void

Set the text style of the entity

Example

ts
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
const textStyleId = mxcad.addTextStyle("MyLineTypeTextStyle", "txt.shx", "hztxt.shx", 1);
ent.textStyleId = textStyleId;

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCustomEntity.textStyleId


trueColor

get trueColor(): McCmColor

Obtain the color of the object

Example

ts
 import { McDbEntity, McCmColor} from 'mxcad'
 const ent = new McDbEntity();
 ent.trueColor = new McCmColor(255, 0, 0);
 console.log(ent.trueColor)

Returns

McCmColor

Inherited from

McDbCustomEntity.trueColor

set trueColor(val): void

Set object color

Parameters

NameType
valMcCmColor

Returns

void

Inherited from

McDbCustomEntity.trueColor


visible

get visible(): boolean

Is the object visible

Returns

boolean

Inherited from

McDbCustomEntity.visible

set visible(val): void

Set whether it is visible

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.visible = true;
console.log(ent.visible)

Parameters

NameTypeDescription
ValbooleanBoolean value

Returns

void

Inherited from

McDbCustomEntity.visible

Methods

IntersectWith

IntersectWith(intersectObject, exOption): McGePoint3dArray

Intersection with other entities to obtain the intersection point

Example

ts
import { McDbLine, McDb } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
const line2 = new McDbLine(new McGePoint3d(10,10,0), new McGePoint3d(11,1,0));
const ptArr = line1.IntersectWith(line2, McDb.Intersect.kExtendBoth)

Parameters

NameTypeDescription
IntersectObject[McDbEntity] (2d. McDbEntity. md)The entity object that needs to intersect is the entity object
ExOptionIntersection (../enums/2d. McDb. Intersect. md)Intersection options

Returns

McGePoint3dArray

Obtain all intersection points

Inherited from

McDbCustomEntity.IntersectWith


addVertex

addVertex(point): void

add vertex

Parameters

NameType
pointMcGePoint3d

Returns

void


assertObjectModification

assertObjectModification(autoUndo?): number

Setting the state of the object to be changed can automatically trigger the update display function to update the display. For example, if the block table record is updated and the block reference needs to be notified to update the display, this function can be called.

Example

ts
//Assuming obj is a database object
obj.assertObjectModification()

Parameters

NameTypeDefault value
autoUndobooleanfalse

Returns

number

Inherited from

McDbCustomEntity.assertObjectModification


clearSegmentRelation

clearSegmentRelation(segmentIndex, relatedSegmentIndex?): void

Clear the associated data of the specified line segment

Parameters

NameTypeDescription
SegmentIndexNumberThe segment index to be cleared
relatedSegmentIndex? numberThe associated segment index to be cleared (optional, if not provided, clear the entire segment index data)

Returns

void


clearVertices

clearVertices(): void

Clear all vertices

Returns

void


clone

clone(): null | McDbObject

Copy entity

Example

ts
import { McDbCustomEntity } from "mxcad";

const customEnt = new McDbCustomEntity();//  Construct a new custom entity object
const cloneEnt = customEnt.clone();//  Copy entity

Returns

null | McDbObject

Inherited from

McDbCustomEntity.clone


create

create(imp): McDbMLine

Factory method for creating entities

Parameters

NameType
impany

Returns

McDbMLine

Overrides

McDbCustomEntity.create


createExtensionDictionary

createExtensionDictionary(): boolean

Create extended dictionary data for objects

Example

ts
//Assuming obj is a database object
const res = obj.createExtensionDictionary();

Returns

boolean

Inherited from

McDbCustomEntity.createExtensionDictionary


deleteXData

deleteXData(appName): boolean

Delete data related to entity specified application name

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.deleteXData("DataName");
if(res){
//Delete successfully
}else
//Delete failed
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name

Returns

boolean

Inherited from

McDbCustomEntity.deleteXData


disableDisplay

disableDisplay(isDisable): void

Disable automatic update display of objects

Example

ts
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)

Parameters

NameTypeDescription
IsDisablebooleanDo you want to disable automatic object update display

Returns

void

Inherited from

McDbCustomEntity.disableDisplay


dwgInFields

dwgInFields(filter): boolean

Read entity data from data files

Parameters

NameType
filterIMcDbDwgFiler

Returns

boolean

Overrides

McDbCustomEntity.dwgInFields


dwgOutFields

dwgOutFields(filter): boolean

Write entity data to a data file

Parameters

NameType
filterIMcDbDwgFiler

Returns

boolean

Overrides

McDbCustomEntity.dwgOutFields


erase

erase(): boolean

Delete object.

Example

ts
//Assuming obj is a database object
const res = obj.erase();
console.log(res);

Returns

boolean

Whether the deletion was successful.

Inherited from

McDbCustomEntity.erase


explode

explode(): MxCADResbuf

Break the object and return the linked list of the object's data after being broken

Example

ts
import { McDbEntity, MxCADResbuf } from "mxcad";
//Obtain the target object
let getEnt = new MxCADUiPrEntity();
GetEnt.setMessage ("Select object to break: ");
let id = await getEnt.go();
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
//Smash objects
      let retExplode: MxCADResbuf = ent.explode();
      if (retExplode.GetCount() == 0) return;
      let iExplodeConut = retExplode.GetCount();
      for (let j = 0; j < iExplodeConut; j++) {
          let tmpobj = retExplode.AtObject(j).val;
          if(tmpobj instanceof McDbEntity ){
              mxcad.drawEntity(tmpobj);
          }
      }

Returns

MxCADResbuf

Rebuf data

Inherited from

McDbCustomEntity.explode


getAllAppName

getAllAppName(): McGeStringArray

Get the application name (AppName) of all XData records contained in the entity

Example

ts
//Assuming ent is a valid instance object
const appNames = ent.getAllAppName();
console.log(appNames);

Returns

McGeStringArray

Inherited from

McDbCustomEntity.getAllAppName


getAllSegmentRelations

getAllSegmentRelations(): SegmentRelationsData

Retrieve all line segment associated data

Returns

SegmentRelationsData

Complete line segment association data structure


getArea

getArea(): Object

Calculate Area

Example

ts
import { McGePoint3d, McDbCircle } from "mxcad"

const center = new McGePoint3d(0,0,0);
const circle = new McDbCircle(center, 20);
const area = circle.getArea();
Console.log ("Circle area: ", area)

Returns

Object

Is the val area value | ret successfully obtained

NameType
retboolean
valnumber

Inherited from

McDbCustomEntity.getArea


getBoundingBox

getBoundingBox(): Object

Obtain the minimum outsourcing of the object

Returns

Object

NameType
maxPtMcGePoint3d
minPtMcGePoint3d
retboolean

Inherited from

McDbCustomEntity.getBoundingBox


getDatabase

getDatabase(): McDbDatabase

Get the database where the object is located

Example

ts
//Assuming obj is a database object
const data = obj.getDatabase();

Returns

McDbDatabase

Return to database

Inherited from

McDbCustomEntity.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

Get the index ID of the object

Example

ts
//Assuming obj is a database object
const id = obj.getDatabaseIndexId();

Returns

number

Inherited from

McDbCustomEntity.getDatabaseIndexId


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

Obtain the extended dictionary data of the object

Example

ts
//Assuming obj is a database object
const id = obj.getOwnerID();

Returns

McDbDictionary

Expand dictionary data

Inherited from

McDbCustomEntity.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

Obtain the control points of the entity

Returns

McGePoint3dArray

Overrides

McDbCustomEntity.getGripPoints


getHandle

getHandle(): string

Obtain object handle

Example

ts
//Assuming obj is a database object
const handle = obj.getHandle();

Returns

string

Return object handle

Inherited from

McDbCustomEntity.getHandle


getImp

getImp(): any

Retrieve internal implementation objects.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let imp = obj.getImp();

Returns

any

Internal implementation object.

Inherited from

McDbCustomEntity.getImp


getIsClosed

getIsClosed(): boolean

Get closed status

Returns

boolean


getJson

getJson(): string

Retrieve a string in JSON format.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
const json = obj.getJson()

Returns

string

A string in JSON format.

Inherited from

McDbCustomEntity.getJson


getJustification

getJustification(): number

Get alignment method

Returns

number


getName

getName(): string

Get custom object name

Returns

string

Inherited from

McDbCustomEntity.getName


getObjectID

getObjectID(): McObjectId

Get the object ID.

Example

ts
import { McDbObject } from "mxcad";
const id = obj.getObjectID();

Returns

McObjectId

Object ID.

Inherited from

McDbCustomEntity.getObjectID


getOwnerID

getOwnerID(): number

Obtain the ID of the object owner

Example

ts
//Assuming obj is a database object
const id = obj.getOwnerID();

Returns

number

Inherited from

McDbCustomEntity.getOwnerID


getScale

getScale(): number

Obtain proportion

Returns

number


getSegmentByIndex

getSegmentByIndex(segmentIndex): null | PointSegmentRelation

Retrieve line segment data based on the index

Parameters

NameTypeDescription
SegmentIndexNumberSegment Index

Returns

null | PointSegmentRelation

Found line segment information, including line segment index, offset line segment index, and related data


getSegmentByPoint

getSegmentByPoint(point): null | PointSegmentRelation

Obtain line segment index based on points

Parameters

NameTypeDescription
Point[McGePoint3d] (2d. McGePoint3d. md)Select point coordinates

Returns

null | PointSegmentRelation

Found line segment information, including line segment index, offset line segment index, and click position


getSegmentRelation

getSegmentRelation(segmentIndex, relatedSegmentIndex?): null | SegmentPointPair[] | { [relatedSegmentIndex: number]: SegmentPointPair[]; }

Obtain segment association data

Parameters

NameTypeDescription
SegmentIndexNumberThe segment index of the current polyline
relatedSegmentIndex? numberLine segment index associated with multiple lines (optional)

Returns

null | SegmentPointPair[] | { [relatedSegmentIndex: number]: SegmentPointPair[]; }

If relatdSegmentIndex is provided, return the corresponding point pair array; Otherwise, return all associated data


getStyleName

getStyleName(): string

Get style name

Returns

string


getTypeName

getTypeName(): string

Get entity type name

Returns

string

Overrides

McDbCustomEntity.getTypeName


getVertexAt

getVertexAt(index): null | McGePoint3d

Get vertices

Parameters

NameType
indexnumber

Returns

null | McGePoint3d


getVertexCount

getVertexCount(): number

Obtain the number of vertices

Returns

number


getVertices

getVertices(): McGePoint3d[]

Returns

McGePoint3d[]


getxData

getxData(appName?): MxCADResbuf

Obtain the extended data of the object

Example

ts
//Assuming ent is a valid instance object
const xData = ent.getXData();

Parameters

NameTypeDefault valueDescription
AppNamestring""Extended Data Name

Returns

MxCADResbuf

Inherited from

McDbCustomEntity.getxData


getxDataDouble

getxDataDouble(appName): Object

Retrieve the double value from the specified XData type of the entity

Example

ts
//Assuming ent is a valid instance object
let data = ent.getxDataDouble("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name

Returns

Object

Double value

NameType
retboolean
valnumber

Inherited from

McDbCustomEntity.getxDataDouble


getxDataLong

getxDataLong(appName): Object

Retrieve the long (integer) value from the specified XData type of the entity

Example

ts
//Assuming ent is a valid instance object
let data = ent.getxDataLong("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name

Returns

Object

Long value

NameType
retboolean
valnumber

Inherited from

McDbCustomEntity.getxDataLong


getxDataPoint

getxDataPoint(appName): Object

Retrieve point objects from the specified XData type of entity

Parameters

NameTypeDescription
AppNamestringExtended Data Name

Returns

Object

Obtain results and 3D point objects

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCustomEntity.getxDataPoint


getxDataString

getxDataString(appName): Object

Retrieve XData information associated with a specific entity and return it in string form

Example

ts
//Assuming ent is a valid instance object
let data = ent.getxDataString("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name

Returns

Object

Val XData information | whether ret returns success

NameType
retboolean
valstring

Inherited from

McDbCustomEntity.getxDataString


highlight

highlight(isHighlight): void

Set whether the object is highlighted

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.highlight(true);

Parameters

NameTypeDescription
IsHighlightbooleanIs it highlighted

Returns

void

Inherited from

McDbCustomEntity.highlight


initTempObject

initTempObject(imp): void

Initialize temporary objects.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
obj.initTempObject()

Parameters

NameTypeDescription
'imp''any'Internal implementation object

Returns

void

Inherited from

McDbCustomEntity.initTempObject


insertVertexAt

insertVertexAt(index, point): boolean

Insert a vertex at the specified location

Parameters

NameTypeDescription
IndexnumberIndex of the position to be inserted
Point[McGePoint3d] (2d. McGePoint3d. md)Point to be inserted

Returns

boolean

Is the insertion successful


isErased

isErased(): boolean

Has the object been deleted

Example

ts
//Assuming obj is a database object
const res = obj.isErased();
console.log(res);

Returns

boolean

Inherited from

McDbCustomEntity.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

Is there any extended dictionary data available

Example

ts
//Assuming obj is a database object
const res = obj.isHaveExtensionDictionary();

Returns

boolean

Inherited from

McDbCustomEntity.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

Determine object type

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); //  Output: True or false

Parameters

NameTypeDescription
SOrtNamestringType Name

Returns

boolean

Return whether the object is of the target type

Inherited from

McDbCustomEntity.isKindOf


isNull

isNull(): any

Determine if it is an empty object

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.isNull()); //  Output: True or false

Returns

any

Inherited from

McDbCustomEntity.isNull


mergeSegmentRelation

mergeSegmentRelation(segmentIndex, relatedSegmentIndex, startPt, endPt): void

Merge the associated data of the specified area (from startPt to endPt)

Parameters

NameType
segmentIndexnumber
relatedSegmentIndexnumber
startPtMcGePoint3d
endPtMcGePoint3d

Returns

void


mirror

mirror(point1, point2): boolean

Mirror oriented object

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.mirror(new McGePoint3d(0,0,0), new McGePoint3d(20,10,0))

Parameters

NameTypeDescription
Point1[McGePoint3d] (2d. McGePoint3d. md)Mirror Base Point
point2McGePoint3d-

Returns

boolean

Inherited from

McDbCustomEntity.mirror


move

move(fromPoint, toPoint): boolean

move objects

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))

Parameters

NameTypeDescription
From Point[McGePoint3d] (2d. McGePoint3d. md)Move the starting point
ToPoint[McGePoint3d] (2d. McGePoint3d. md)Move End Point

Returns

boolean

Inherited from

McDbCustomEntity.move


moveGripPointsAt

moveGripPointsAt(index, deltaX, deltaY, deltaZ): void

Move the control point of the specified index

Parameters

NameType
indexnumber
deltaXnumber
deltaYnumber
deltaZnumber

Returns

void

Overrides

McDbCustomEntity.moveGripPointsAt


removeVertexAt

removeVertexAt(index): void

Remove vertex

Parameters

NameType
indexnumber

Returns

void


rotate

rotate(basePoint, dRotationAngle): boolean

Rotate object

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)

Parameters

NameTypeDescription
BasePoint[McGePoint3d] (2d. McGePoint3d. md)Rotate the base point
DRotationAnglenumberRotation angle

Returns

boolean

Inherited from

McDbCustomEntity.rotate


rxInit

rxInit(): void

Custom Entity Registration

Example

ts
import { MxFun } from 'mxdraw
//MxCAD created successfully
MxFun.on("mxcadApplicationCreatedMxCADObject", (param) => {
//McDbtTestLineCustomizing Entity Custom Entity
new McDbTestLineCustomEntity().rxInit();//  Custom Entity Registration
MxFun.addCommand("MxTest_DrawCustomEntity");//  Register drawing entity command
})

Returns

void

Inherited from

McDbCustomEntity.rxInit


scaleEntity

scaleEntity(basePoint, dScaleFactor): boolean

Scaling objects

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)

Parameters

NameTypeDescription
BasePoint[McGePoint3d] (2d. McGePoint3d. md)Scale Base Point
DScaleFactornumberscaling factor (<1 zoom out;>1 zoom in)

Returns

boolean

Inherited from

McDbCustomEntity.scaleEntity


setAllSegmentRelations

setAllSegmentRelations(data): void

Set all line segment associated data

Parameters

NameTypeDescription
dataSegmentRelationsDataComplete line segment association data structure

Returns

void


setIsClosed

setIsClosed(isClosed): void

Set closed state

Parameters

NameType
isClosedboolean

Returns

void


setJson

setJson(str): boolean

Set a string in JSON format.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)

Parameters

NameTypeDescription
StrstringJSON formatted string

Returns

boolean

Is the setting successful.

Inherited from

McDbCustomEntity.setJson


setJustification

setJustification(justification): void

Set alignment method

Parameters

NameType
justificationnumber

Returns

void


setScale

setScale(scale): void

Set Scale

Parameters

NameType
scalenumber

Returns

void


setSegmentRelation

setSegmentRelation(segmentIndex, relatedSegmentIndex, pointPairs): void

Set segment association data

Parameters

NameTypeDescription
SegmentIndexNumberThe segment index of the current polyline
Related SegmentIndexNumberSegment Index of Related Multiple Lines
PointPairsSegmentPointPair (../modules/2d. md # segmentpointpair) []Point Pair Array [McGePoint3d, McGePoint3d] []

Returns

void


setStyleName

setStyleName(name): void

Set style name

Parameters

NameType
namestring

Returns

void


setVertexAt

setVertexAt(index, point): void

Set vertex

Parameters

NameType
indexnumber
pointMcGePoint3d

Returns

void


setxData

setxData(xdata): boolean

Set extended data for objects

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

//Set extended data
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
ent.setxData(new MxCADResbuf([{type:DxfCode.kExDataName,val:"DataName"},{type:DxfCode.kString,val:"yyyyy"}]));

Parameters

NameTypeDescription
Xdata[MxCADResbuf] (2d. MxCADResbuf. md)Extended data linked list

Returns

boolean

Inherited from

McDbCustomEntity.setxData


setxDataDouble

setxDataDouble(appName, val): boolean

Set the double value in the specified XData type of the entity

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataDouble("DataName", 0);
if(res){
//Setting successful
}else{
//Setting failed
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name
Valnumberdouble value

Returns

boolean

Boolean value

Inherited from

McDbCustomEntity.setxDataDouble


setxDataLong

setxDataLong(appName, val): boolean

Set the long (integer) value in the specified XData type of the entity

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataLong("DataName", 123456);
if(res){
//Setting successful
}else{
//Setting failed
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name
Valnumberlong value

Returns

boolean

Long value

Inherited from

McDbCustomEntity.setxDataLong


setxDataPoint

setxDataPoint(appName, val): boolean

Set the point object in the specified XData type of the entity

Parameters

NameTypeDescription
AppNamestringExtended Data Name
Val[McGePoint3d] (2d. McGePoint3d. md)Point Object

Returns

boolean

Obtain results and 3D point objects

Inherited from

McDbCustomEntity.setxDataPoint


setxDataString

setxDataString(appName, val): boolean

Set XData information associated with a specific entity and set it in string form

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataString("DataName", "xxxxx");
if(res){
//Setting successful
}else{
//Setting failed
}

Parameters

NameTypeDescription
AppNamestringExtended Data Name
Valstringstring value

Returns

boolean

Is the setting successful

Inherited from

McDbCustomEntity.setxDataString


syncData

syncData(toCpp?): boolean

JS object data and McDbCCustoms Entity: Synchronization of m_mapData.

Parameters

NameTypeDefault value
toCppbooleantrue

Returns

boolean

Inherited from

McDbCustomEntity.syncData


transformBy

transformBy(_mat): boolean

Get custom object matrix coordinate transformation

Parameters

NameType
_matMcGeMatrix3d

Returns

boolean

Inherited from

McDbCustomEntity.transformBy


unErase

unErase(): boolean

Anti delete object.

Example

ts
//Assuming obj is a database object
const res = obj.unErase();
console.log(res);

Returns

boolean

Inherited from

McDbCustomEntity.unErase


updateDisplay

updateDisplay(): void

Display the updated display of the calling object

Example

ts
//Assuming ent is a valid instance object
ent.updateDisplay()

Returns

void

Inherited from

McDbCustomEntity.updateDisplay


worldDraw

worldDraw(draw): void

Draw entities (unified scheduling, parameter transfer point set)

Parameters

NameType
drawMxCADWorldDraw

Returns

void

Overrides

McDbCustomEntity.worldDraw