Skip to content
On this page

mxcad_2d API 文档 / 2d / McDbLinetypeTableRecord

Class: McDbLinetypeTableRecord

2d.McDbLinetypeTableRecord

表示一个线型表记录对象,实现了对线型的属性相关操作函数。

Example

ts
// 添加线型
   import { MxCpp, McDbLinetypeTableRecord } from "mxcad"

   const mxcad = MxCpp.getCurrentMxCAD();
   // 拿到当前线型样式表
   let linetypeTable = mxcad.getDatabase().getLinetypeTable();
   // 构造新线型表记录对象
   let newLinetypeRecord = new McDbLinetypeTableRecord();
   // 设置线型对象的虚线数量
   newLinetypeRecord.numDashes = 0.2
   // 设置线型对象的名字
   newLinetypeRecord.name = "TestMyLine"
   // 添加线型
   const res = linetypeTable.add(newLinetypeRecord).isValid()
   if (res) {
       console.log("add ok");
   }

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbLinetypeTableRecord(imp?)

构造函数。

Parameters

NameTypeDescription
imp?any内部实现对象。

Example

ts
import { McDbLinetypeTableRecord  } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();

Overrides

McDbObject.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbObject.imp

Accessors

comments

get comments(): string

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

Returns

string

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.comments = "说明字符串"
console.log(linetypeRec.comments) // 说明字符串

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

布尔值

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.isScaledToFit = true;
console.log(linetypeRec.isScaledToFit) // true

set isScaledToFit(scaledToFit): void

Parameters

NameType
scaledToFitboolean

Returns

void


name

get name(): string

获取或设置线型名称。

Returns

string

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.name = "测试线型"
console.log(linetypeRec.name) // 测试线型

set name(val): void

Parameters

NameType
valstring

Returns

void


numDashes

get numDashes(): number

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

Returns

number

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.numDashes = 6
console.log(linetypeRec.numDashes) // 6

set numDashes(val): void

Parameters

NameType
valnumber

Returns

void


objectName

get objectName(): string

获取对象名称。

Returns

string

返回对象名

Example

ts
import { McRxObject } from 'mxcad';

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

Inherited from

McDbObject.objectName

Methods

assertObjectModification

assertObjectModification(autoUndo?): number

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

Parameters

NameTypeDefault value
autoUndobooleanfalse

Returns

number

Example

ts
//假设obj为一个数据库对象
obj.assertObjectModification()

Inherited from

McDbObject.assertObjectModification


clone

clone(): null | McDbObject

克隆对象。

Returns

null | McDbObject

克隆出的对象。

Example

ts
//假设obj为一个数据库对象
const obj_clone = obj.clone();

Inherited from

McDbObject.clone


createExtensionDictionary

createExtensionDictionary(): boolean

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

Returns

boolean

Example

ts
//假设obj为一个数据库对象
const res = obj.createExtensionDictionary();

Inherited from

McDbObject.createExtensionDictionary


dashLengthAt

dashLengthAt(index): number

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

Parameters

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

Returns

number

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setDashLengthAt(0, 8)
console.log(linetypeRec.dashLengthAt(0)) // 8

erase

erase(): boolean

删除对象。

Returns

boolean

是否删除成功。

Example

ts
//假设obj为一个数据库对象
const res = obj.erase();
console.log(res);

Inherited from

McDbObject.erase


freeTempRelationObject

freeTempRelationObject(): void

释放临时关系对象

Returns

void

Example

ts
//假设obj为一个数据库对象
obj.freeTempRelationObject();

Inherited from

McDbObject.freeTempRelationObject


getDatabase

getDatabase(): McDbDatabase

得到对象所在的数据库

Returns

McDbDatabase

返回数据库

Example

ts
//假设obj为一个数据库对象
const data = obj.getDatabase();

Inherited from

McDbObject.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Returns

number

Example

ts
//假设obj为一个数据库对象
const id = obj.getDatabaseIndexId();

Inherited from

McDbObject.getDatabaseIndexId


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

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

Returns

McDbDictionary

扩展字典数据

Example

ts
//假设obj为一个数据库对象
const id = obj.getOwnerID();

Inherited from

McDbObject.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的控制点

Returns

McGePoint3dArray

Example

ts
//假设obj为一个数据库对象
const ptArr = obj.getGripPoints();

Inherited from

McDbObject.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Returns

string

返回对象句柄

Example

ts
//假设obj为一个数据库对象
const handle = obj.getHandle();

Inherited from

McDbObject.getHandle


getImp

getImp(): any

获取内部实现对象。

Returns

any

内部实现对象。

Example

ts
import { McRxObject } from 'mxcad';

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

Inherited from

McDbObject.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Returns

string

JSON 格式的字符串。

Example

ts
import { McRxObject } from 'mxcad';

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

Inherited from

McDbObject.getJson


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Returns

McObjectId

对象 ID。

Example

ts
import { McDbObject } from "mxcad";

const obj = new McDbObject();
const id = obj.getObjectID();

Inherited from

McDbObject.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Returns

number

Example

ts
//假设obj为一个数据库对象
const id = obj.getOwnerID();

Inherited from

McDbObject.getOwnerID


initTempObject

initTempObject(imp): void

初始化临时对象。

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Example

ts
import { McRxObject } from 'mxcad';

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

Inherited from

McDbObject.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Returns

boolean

Example

ts
//假设obj为一个数据库对象
const res = obj.isErased();
console.log(res);

Inherited from

McDbObject.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Returns

boolean

Example

ts
//假设obj为一个数据库对象
const res = obj.isHaveExtensionDictionary();

Inherited from

McDbObject.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

判断对象类型

Parameters

NameTypeDescription
sObjectNamestring类型名

Returns

boolean

返回对象是否是目标类型

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); // 输出: true 或 false

Inherited from

McDbObject.isKindOf


isNull

isNull(): any

判断是否为空对象

Returns

any

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.isNull()); // 输出: true 或 false

Inherited from

McDbObject.isNull


moveGripPointsAt

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

移动对象的控制点

Parameters

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

Returns

any

Example

ts
//假设obj为一个数据库对象
obj.moveGripPointsAt(1,10,10,10);

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

是否设置成功。

Example

ts
import { McRxObject } from 'mxcad';

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

Inherited from

McDbObject.setJson


setShapeIsUcsOrientedAt

setShapeIsUcsOrientedAt(index, isUcsOriented): boolean

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

Parameters

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

Returns

boolean

布尔值

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
const res = linetypeRec.setShapeIsUcsOrientedAt(0, true);
if(res){
 //设置成功
}else{
 //设置失败
}

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

布尔值

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setShapeRotationAt(0, Math.PI / 2);

setShapeScaleAt

setShapeScaleAt(index, scale): boolean

Parameters

NameType
indexnumber
scalenumber

Returns

boolean


setShapeStyleAt

setShapeStyleAt(index, value): boolean

Parameters

NameType
indexnumber
valuenumber

Returns

boolean


setTextAt

setTextAt(index, text): boolean

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

Parameters

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

Returns

boolean

布尔值

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setTextAt(0, "测试文本");

shapeIsUcsOrientedAt

shapeIsUcsOrientedAt(index): boolean

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

Parameters

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

Returns

boolean

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
console.log(linetypeRec.shapeIsUcsOrientedAt(0))

shapeNumberAt

shapeNumberAt(index): number

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

Parameters

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

Returns

number

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();

const shapeNumberAtIndex = linetypeRec.shapeNumberAt(0);
console.log(shapeNumberAtIndex);

// 设置指定索引处的形状编号为新值
const newIndex = 5;
const newValue = 10;
const isSetSuccessful = linetypeRec.setShapeNumberAt(newIndex, newValue);
if (isSetSuccessful) {
   //设置成功
} else {
   //设置失败
}

shapeOffsetAt

shapeOffsetAt(index): McGeVector3d

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

Parameters

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

Returns

McGeVector3d

偏移向量

Example

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

const linetypeRec = new McDbLinetypeTableRecord();

const vec = linetypeRec.shapeOffsetAt(0);
console.log(vec);

// 设置指定索引处的形状偏移量为新值
const isSetSuccessful = linetypeRec.setShapeNumberAt(0, new McGeVector3d(10, 10, 0));
if (isSetSuccessful) {
   //设置成功
} else {
   //设置失败
}

shapeRotationAt

shapeRotationAt(index): number

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

Parameters

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

Returns

number

旋转角度

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
console.log(linetypeRec.shapeRotationAt(0))

shapeScaleAt

shapeScaleAt(index): number

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

Parameters

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

Returns

number

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setShapeScaleAt(0,0.8);
console.log(linetypeRec.shapeScaleAt(0));// 0.8

shapeStyleAt

shapeStyleAt(index): number

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

Parameters

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

Returns

number

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();

const shapeStyleAtIndex = linetypeRec.shapeStyleAt(0);
console.log(shapeStyleAtIndex);

// 设置指定索引处的形状样式为新值
const newIndex = 5;
const newValue = 10;
const isSetSuccessful = linetypeRec.setShapeStyleAt(newIndex, newValue);
if (isSetSuccessful) {
   //设置成功
} else {
   //设置失败
}

tempRelationObject

tempRelationObject(): number

与对象相关的临时关系数

Returns

number

Inherited from

McDbObject.tempRelationObject


textAt

textAt(index): string

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

Parameters

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

Returns

string

文本信息

Example

ts
import { McDbLinetypeTableRecord } from "mxcad";

const linetypeRec = new McDbLinetypeTableRecord();
const text = linetypeRec.textAt(0);
console.log(text)

unErase

unErase(): boolean

反删除对象。

Returns

boolean

Example

ts
//假设obj为一个数据库对象
const res = obj.unErase();
console.log(res);

Inherited from

McDbObject.unErase