[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McDbLinetypeTableRecord
Class: McDbLinetypeTableRecord
2d.McDbLinetypeTableRecord
Represents a line type table that records objects and implements attribute related operation functions for line types.
Example
//Add line type
import { MxCpp, McDbLinetypeTableRecord } from "mxcad"
const mxcad = MxCpp.getCurrentMxCAD();
//Get the current line style sheet
let linetypeTable = mxcad.getDatabase().getLinetypeTable();
//Construct a new line type table to record objects
let newLinetypeRecord = new McDbLinetypeTableRecord();
//Set the number of dashed lines for line type objects
newLinetypeRecord.numDashes = 0.2
//Set the name of the line type object
newLinetypeRecord.name = "TestMyLine"
//Add line type
const res = linetypeTable.add(newLinetypeRecord).isValid()
if (res) {
console.log("add ok");
}Hierarchy
↳
McDbLinetypeTableRecord
Table of contents
Constructors
Properties
Accessors
Methods
- assertObjectModification
- clone
- createExtensionDictionary
- dashLengthAt
- erase
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getObjectID
- getOwnerID
- initTempObject
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- moveGripPointsAt
- setDashLengthAt
- setJson
- setShapeIsUcsOrientedAt
- setShapeNumberAt
- setShapeOffsetAt
- setShapeRotationAt
- setShapeScaleAt
- setShapeStyleAt
- setTextAt
- shapeIsUcsOrientedAt
- shapeNumberAt
- shapeOffsetAt
- shapeRotationAt
- shapeScaleAt
- shapeStyleAt
- textAt
- unErase
Constructors
constructor
• new McDbLinetypeTableRecord(imp?)
Constructor.
Parameters
| Name | Type | Description |
|---|---|---|
imp? | any | Internal implementation object. |
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();Overrides
Properties
imp
• imp: any = 0
Internal implementation object.
Inherited from
Accessors
comments
• get comments(): string
Get or set the line type description string.
Returns
string
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
LinetypeRec.coments="Explanation string"
Console. log (linetypeRec. comments)//Explanation string• set comments(val): void
Parameters
| Name | Type |
|---|---|
val | string |
Returns
void
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 a line is McDbLine, and the DXF0 group code value is LINE. The DXF0 group code value can be used for type filtering when constructing sets.
Returns
string
Inherited from
McDbObject.dxf0
isScaledToFit
• get isScaledToFit(): boolean
Gets or sets whether the line type is scaled according to the drawing scale.
Returns
boolean
Boolean value
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.isScaledToFit = true;
console.log(linetypeRec.isScaledToFit) // true• set isScaledToFit(scaledToFit): void
Parameters
| Name | Type |
|---|---|
scaledToFit | boolean |
Returns
void
name
• get name(): string
Get or set the linetype name.
Returns
string
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
LinetypeRec.name="Test Linetype"
Console. log (linetypeRec. name)//Test line type• set name(val): void
Parameters
| Name | Type |
|---|---|
val | string |
Returns
void
numDashes
• get numDashes(): number
Get or set the number of dashed lines for the line type.
Returns
number
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.numDashes = 6
console.log(linetypeRec.numDashes) // 6• set numDashes(val): void
Parameters
| Name | Type |
|---|---|
val | number |
Returns
void
objectName
• get objectName(): string
Get the object name.
Returns
string
Return object name
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.objectName);Inherited from
McDbObject.objectName
Methods
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.
Parameters
| Name | Type | Default value |
|---|---|---|
autoUndo | boolean | false |
Returns
number
Example
//Assuming obj is a database object
obj.assertObjectModification()Inherited from
McDbObject.assertObjectModification
clone
▸ clone(): null | McDbObject
Clone objects.
Returns
null | McDbObject
The cloned object.
Example
//Assuming obj is a database object
const obj_clone = obj.clone();Inherited from
createExtensionDictionary
▸ createExtensionDictionary(): boolean
Create extended dictionary data for objects
Returns
boolean
Example
//Assuming obj is a database object
const res = obj.createExtensionDictionary();Inherited from
McDbObject.createExtensionDictionary
dashLengthAt
▸ dashLengthAt(index): number
Gets or sets the length of the dashed line at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
number
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setDashLengthAt(0, 8)
console.log(linetypeRec.dashLengthAt(0)) // 8erase
▸ erase(): boolean
Delete object.
Returns
boolean
Whether the deletion was successful.
Example
//Assuming obj is a database object
const res = obj.erase();
console.log(res);Inherited from
getDatabase
▸ getDatabase(): McDbDatabase
Get the database where the object is located
Returns
Return to database
Example
//Assuming obj is a database object
const data = obj.getDatabase();Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
Get the index ID of the object
Returns
number
Example
//Assuming obj is a database object
const id = obj.getDatabaseIndexId();Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
Obtain the extended dictionary data of the object
Returns
Expand dictionary data
Example
//Assuming obj is a database object
const id = obj.getOwnerID();Inherited from
McDbObject.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
Get the control points of the object
Returns
Example
//Assuming obj is a database object
const ptArr = obj.getGripPoints();Inherited from
getHandle
▸ getHandle(): string
Obtain object handle
Returns
string
Return object handle
Example
//Assuming obj is a database object
const handle = obj.getHandle();Inherited from
getImp
▸ getImp(): any
Retrieve internal implementation objects.
Returns
any
Internal implementation object.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let imp = obj.getImp();Inherited from
getJson
▸ getJson(): string
Retrieve a string in JSON format.
Returns
string
A string in JSON format.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const json = obj.getJson()Inherited from
getObjectID
▸ getObjectID(): McObjectId
Get the object ID.
Returns
Object ID.
Example
import { McDbObject } from "mxcad";
const id = obj.getObjectID();Inherited from
getOwnerID
▸ getOwnerID(): number
Obtain the ID of the object owner
Returns
number
Example
//Assuming obj is a database object
const id = obj.getOwnerID();Inherited from
initTempObject
▸ initTempObject(imp): void
Initialize temporary objects.
Parameters
| Name | Type | Description |
|---|---|---|
| 'imp' | 'any' | Internal implementation object. |
Returns
void
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
obj.initTempObject()Inherited from
isErased
▸ isErased(): boolean
Has the object been deleted
Returns
boolean
Example
//Assuming obj is a database object
const res = obj.isErased();
console.log(res);Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
Is there any extended dictionary data available
Returns
boolean
Example
//Assuming obj is a database object
const res = obj.isHaveExtensionDictionary();Inherited from
McDbObject.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName): boolean
Determine object type
Parameters
| Name | Type | Description |
|---|---|---|
| SOrtName | string | Type Name |
Returns
boolean
Return whether the object is of the target type
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); //Output: true or falseInherited from
isNull
▸ isNull(): any
Determine if it is an empty object
Returns
any
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.isNull()); //Output: true or falseInherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any
Control points for moving objects
Parameters
| Name | Type | Description |
|---|---|---|
| IIndex | Number | Index |
| DXOffset | number | X-axis offset |
| DYOffset | number | Y-axis offset |
| DZOffset | number | Z-axis offset |
Returns
any
Example
//Assuming obj is a database object
obj.moveGripPointsAt(1,10,10,10);Inherited from
setDashLengthAt
▸ setDashLengthAt(index, value): boolean
Parameters
| Name | Type |
|---|---|
index | number |
value | number |
Returns
boolean
setJson
▸ setJson(str): boolean
Set a string in JSON format.
Parameters
| Name | Type | Description |
|---|---|---|
| Str | string | JSON formatted string. |
Returns
boolean
Is the setting successful.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)Inherited from
setShapeIsUcsOrientedAt
▸ setShapeIsUcsOrientedAt(index, isUcsOriented): boolean
Set whether the specified shape is arranged in the direction of the User Coordinate System (UCS).
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
| Is the 'isUcsOriented' | 'boolean' | arranged in the direction of the User Coordinate System (UCS) |
Returns
boolean
Boolean value
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
const res = linetypeRec.setShapeIsUcsOrientedAt(0, true);
if(res){
//Setting successful
}else{
//Setting failed
}setShapeNumberAt
▸ setShapeNumberAt(index, shapeNumber): boolean
Parameters
| Name | Type |
|---|---|
index | number |
shapeNumber | number |
Returns
boolean
setShapeOffsetAt
▸ setShapeOffsetAt(index, offset): boolean
Parameters
| Name | Type |
|---|---|
index | number |
offset | McGeVector3d |
Returns
boolean
setShapeRotationAt
▸ setShapeRotationAt(index, rotation): boolean
Set the rotation angle of the shape at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
| Rotation | number | Rotation angle |
Returns
boolean
Boolean value
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setShapeRotationAt(0, Math.PI / 2);setShapeScaleAt
▸ setShapeScaleAt(index, scale): boolean
Parameters
| Name | Type |
|---|---|
index | number |
scale | number |
Returns
boolean
setShapeStyleAt
▸ setShapeStyleAt(index, value): boolean
Parameters
| Name | Type |
|---|---|
index | number |
value | number |
Returns
boolean
setTextAt
▸ setTextAt(index, text): boolean
Set the text information at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
| Text | string | Text information |
Returns
boolean
Boolean value
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
LinetypeRec. setTextAt (0, "test text");shapeIsUcsOrientedAt
▸ shapeIsUcsOrientedAt(index): boolean
Retrieve whether the specified shape is arranged in the direction of the User Coordinate System (UCS).
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
boolean
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
console.log(linetypeRec.shapeIsUcsOrientedAt(0))shapeNumberAt
▸ shapeNumberAt(index): number
Get or set the shape number at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
number
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
const shapeNumberAtIndex = linetypeRec.shapeNumberAt(0);
console.log(shapeNumberAtIndex);
//Set the shape number at the specified index to a new value
const newIndex = 5;
const newValue = 10;
const isSetSuccessful = linetypeRec.setShapeNumberAt(newIndex, newValue);
if (isSetSuccessful) {
//Setting successful
} else {
//Setting failed
}shapeOffsetAt
▸ shapeOffsetAt(index): McGeVector3d
Get or set the shape offset at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
Offset vector
Example
import { McDbLinetypeTableRecord, McGeVector3d } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
const vec = linetypeRec.shapeOffsetAt(0);
console.log(vec);
//Set the shape offset at the specified index to a new value
const isSetSuccessful = linetypeRec.setShapeNumberAt(0, new McGeVector3d(10, 10, 0));
if (isSetSuccessful) {
//Setting successful
} else {
//Setting failed
}shapeRotationAt
▸ shapeRotationAt(index): number
Get the rotation angle of the shape at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
number
rotation angle
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
console.log(linetypeRec.shapeRotationAt(0))shapeScaleAt
▸ shapeScaleAt(index): number
Gets or sets the scaling ratio of the shape at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
number
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
linetypeRec.setShapeScaleAt(0,0.8);
console.log(linetypeRec.shapeScaleAt(0));// 0.8shapeStyleAt
▸ shapeStyleAt(index): number
Retrieve or set the shape style at the specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
number
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
const shapeStyleAtIndex = linetypeRec.shapeStyleAt(0);
console.log(shapeStyleAtIndex);
//Set the shape style at the specified index to a new value
const newIndex = 5;
const newValue = 10;
const isSetSuccessful = linetypeRec.setShapeStyleAt(newIndex, newValue);
if (isSetSuccessful) {
//Setting successful
} else {
//Setting failed
}textAt
▸ textAt(index): string
Retrieve or set text information at a specified index.
Parameters
| Name | Type | Description |
|---|---|---|
| Index | Number | Line type defines the index in the array. |
Returns
string
Text information
Example
import { McDbLinetypeTableRecord } from "mxcad";
const linetypeRec = new McDbLinetypeTableRecord();
const text = linetypeRec.textAt(0);
console.log(text)unErase
▸ unErase(): boolean
Anti delete object.
Returns
boolean
Example
//Assuming obj is a database object
const res = obj.unErase();
console.log(res);