Skip to content

mxcad_2d API 文档 / 2d / McDbLinetypeTableRecord

Class: McDbLinetypeTableRecord

2d.McDbLinetypeTableRecord

McDbLinetypeTableRecord 是线型表中的单条记录,负责保存和管理某一条线型定义。

Description

该类用于描述一条线型的具体参数,如线型名称、虚线长度、偏移、缩放和文本说明。 通过它可以完成:

  • 创建并保存一条自定义线型;
  • 读取和设置线型名称、虚线参数和说明信息;
  • 控制线型中的形状、偏移、旋转和缩放属性;
  • 作为线型表中的记录对象参与图纸样式管理。

使用方式:

  1. 创建 McDbLinetypeTableRecord 实例;
  2. 设置 name / numDashes / dashLengthAt 等属性;
  3. 将实例添加到线型表中;
  4. 通过样式表应用到图形对象上。

总结:在实际开发中,McDbLinetypeTableRecord 用于定义和编辑一条线型,是线型样式控制的最细粒度对象。

Example

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

// 创建并配置一条自定义线型记录。
async function testLinetypeRecord() {
  const mxcad = MxCpp.getCurrentMxCAD();
  const table = mxcad.getDatabase().getLinetypeTable();
  const rec = new McDbLinetypeTableRecord();
  rec.name = "MyDashLine";
  rec.numDashes = 2;
  rec.setDashLengthAt(0, 8);
  rec.setDashLengthAt(1, 4);
  table.add(rec);
}

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbLinetypeTableRecord(imp?)

构造函数。

Parameters

NameTypeDescription
imp?any内部实现对象。

Overrides

McDbObject.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbObject.imp

Accessors

comments

get comments(): string

获取或设置线型说明字符串。

Returns

string

set comments(val): void

Parameters

NameType
valstring

Returns

void


dxf0

get dxf0(): string

得到对象的DXF组码的类型名,这个和AutoCAD中的DXF组码是一样。 比如直线的类型名为:McDbLine,DXF0组码值: LINE,DXF0组码值可以用来构造集时的类型过滤。

Returns

string

Inherited from

McDbObject.dxf0


isScaledToFit

get isScaledToFit(): boolean

获取或设置线型是否根据绘图比例进行缩放。

Returns

boolean

布尔值

set isScaledToFit(scaledToFit): void

Parameters

NameType
scaledToFitboolean

Returns

void


name

get name(): string

获取或设置线型名称。

Returns

string

set name(val): void

Parameters

NameType
valstring

Returns

void


numDashes

get numDashes(): number

获取或设置线型的虚线数量

Returns

number

set numDashes(val): void

Parameters

NameType
valnumber

Returns

void


objectName

get objectName(): string

获取对象名称。

Returns

string

返回对象名

Inherited from

McDbObject.objectName

Methods

assertObjectModification

assertObjectModification(autoUndo?): number

设置对象被改变的状态,可自动触发更新显示函数,更新显示。 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。

Parameters

NameTypeDefault valueDescription
autoUndobooleanfalse这次修改是否要自动支持撤销,默认为false

Returns

number

Inherited from

McDbObject.assertObjectModification


clone

clone(): null | McDbObject

克隆对象。

Returns

null | McDbObject

克隆出的对象。

Inherited from

McDbObject.clone


createExtensionDictionary

createExtensionDictionary(): boolean

创建对象的扩展字典数据.

Returns

boolean

Inherited from

McDbObject.createExtensionDictionary


dashLengthAt

dashLengthAt(index): number

获取或设置指定索引处的虚线长度。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

number


erase

erase(): boolean

删除对象。

Returns

boolean

是否删除成功。

Inherited from

McDbObject.erase


getDatabase

getDatabase(): McDbDatabase

得到对象所在的数据库

Returns

McDbDatabase

返回数据库

Inherited from

McDbObject.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Returns

number

Inherited from

McDbObject.getDatabaseIndexId


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

得到对象的扩展字典数据.

Returns

McDbDictionary

扩展字典数据

Inherited from

McDbObject.getExtensionDictionary


getGripEditBasePointsIndex

getGripEditBasePointsIndex(): number[]

获取对象的夹点对应的编辑基点索引。

Returns

number[]

Inherited from

McDbObject.getGripEditBasePointsIndex


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的夹点数组

Returns

McGePoint3dArray

Inherited from

McDbObject.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Returns

string

返回对象句柄

Inherited from

McDbObject.getHandle


getImp

getImp(): any

获取内部实现对象。

Returns

any

内部实现对象。

Inherited from

McDbObject.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Returns

string

JSON 格式的字符串。

Inherited from

McDbObject.getJson


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Returns

McObjectId

对象 ID。

Inherited from

McDbObject.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Returns

number

Inherited from

McDbObject.getOwnerID


initTempObject

initTempObject(imp): void

初始化临时对象。

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Inherited from

McDbObject.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Returns

boolean

Inherited from

McDbObject.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Returns

boolean

Inherited from

McDbObject.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

判断对象类型

Parameters

NameTypeDescription
sObjectNamestring类型名

Returns

boolean

返回对象是否是目标类型

Inherited from

McDbObject.isKindOf


isNull

isNull(): any

判断是否为空对象

Returns

any

Inherited from

McDbObject.isNull


moveGripPointsAt

moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any

移动对象的夹点

Parameters

NameTypeDescription
iIndexnumber索引
dXOffsetnumberX轴偏移量
dYOffsetnumberY轴偏移量
dZOffsetnumberZ轴偏移量

Returns

any

Inherited from

McDbObject.moveGripPointsAt


setDashLengthAt

setDashLengthAt(index, value): boolean

Parameters

NameType
indexnumber
valuenumber

Returns

boolean


setJson

setJson(str): boolean

设置 JSON 格式的字符串。

Parameters

NameTypeDescription
strstringJSON 格式的字符串。

Returns

boolean

是否设置成功。

Inherited from

McDbObject.setJson


setShapeIsUcsOrientedAt

setShapeIsUcsOrientedAt(index, isUcsOriented): boolean

设置指定形状是否按照用户坐标系(UCS)方向排列。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。
isUcsOrientedboolean是否按照用户坐标系(UCS)方向排列

Returns

boolean

布尔值


setShapeNumberAt

setShapeNumberAt(index, shapeNumber): boolean

Parameters

NameType
indexnumber
shapeNumbernumber

Returns

boolean


setShapeOffsetAt

setShapeOffsetAt(index, offset): boolean

Parameters

NameType
indexnumber
offsetMcGeVector3d

Returns

boolean


setShapeRotationAt

setShapeRotationAt(index, rotation): boolean

设置指定索引处的形状旋转角度。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。
rotationnumber旋转角度

Returns

boolean

布尔值


setShapeScaleAt

setShapeScaleAt(index, scale): boolean

Parameters

NameType
indexnumber
scalenumber

Returns

boolean


setShapeStyleAt

setShapeStyleAt(index, id): boolean

Parameters

NameType
indexnumber
idMcObjectId

Returns

boolean


setTextAt

setTextAt(index, text): boolean

设置指定索引处的文本信息。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。
textstring文本信息

Returns

boolean

布尔值


shapeIsUcsOrientedAt

shapeIsUcsOrientedAt(index): boolean

获取指定形状是否按照用户坐标系(UCS)方向排列。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

boolean


shapeNumberAt

shapeNumberAt(index): number

获取或设置指定索引处的形状编号。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

number


shapeOffsetAt

shapeOffsetAt(index): McGeVector3d

获取或设置指定索引处的形状偏移量。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

McGeVector3d

偏移向量


shapeRotationAt

shapeRotationAt(index): number

获取指定索引处的形状旋转角度。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

number

旋转角度


shapeScaleAt

shapeScaleAt(index): number

获取或设置指定索引处的形状缩放比例。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

number


shapeStyleAt

shapeStyleAt(index): McObjectId

获取或设置指定索引处的形状样式。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

McObjectId


textAt

textAt(index): string

获取或设置指定索引处的文本信息。

Parameters

NameTypeDescription
indexnumber线型定义数组中索引。

Returns

string

文本信息


unErase

unErase(): boolean

反删除对象。

Returns

boolean

Inherited from

McDbObject.unErase