[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McDbLinetypeTableRecord
Class: McDbLinetypeTableRecord
2d.McDbLinetypeTableRecord
McDbLinetypeTableRecord is a single record in a line type table, responsible for saving and managing the definition of a certain line type.
Description
This class is used to describe specific parameters of a line type, such as line type name, dashed line length, offset, scaling, and text description. It can accomplish: -Create and save a custom line type; -Read and set line type names, dashed line parameters, and descriptive information; -Control the shape, offset, rotation, and scaling properties in line types; -Participate in drawing style management as a record object in the line type table.
Usage:
- Create an instance of McDbLinetypeTableRecord;
- Set properties such as name/numDashes/dashLengthAt;
- Add instances to the linetype table;
- Apply style sheets to graphic objects.
Summary: In practical development, McDbLinetypeTableRecord is used to define and edit a line type, and is the most fine-grained object for line style control.
Example
import { MxCpp, McDbLinetypeTableRecord } from "mxcad";
//Create and configure a custom line type record.
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
↳
McDbLinetypeTableRecord
Table of contents
Constructors
Properties
Accessors
Methods
- assertObjectModification
- clone
- createExtensionDictionary
- dashLengthAt
- erase
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripEditBasePointsIndex
- 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 |
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
• 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 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
McDbObject.dxf0
isScaledToFit
• get isScaledToFit(): boolean
Gets or sets whether the line type is scaled according to the drawing scale.
Returns
boolean
Boolean value
• set isScaledToFit(scaledToFit): void
Parameters
| Name | Type |
|---|---|
scaledToFit | boolean |
Returns
void
name
• get name(): string
Get or set the linetype name.
Returns
string
• 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
• set numDashes(val): void
Parameters
| Name | Type |
|---|---|
val | number |
Returns
void
objectName
• get objectName(): string
Get the object name.
Returns
string
Return object name
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 | Description |
|---|---|---|---|
| AutoUndo | boolean | false | Should this modification automatically support undo? Default is false |
Returns
number
Inherited from
McDbObject.assertObjectModification
clone
▸ clone(): null | McDbObject
Clone objects.
Returns
null | McDbObject
The cloned object.
Inherited from
createExtensionDictionary
▸ createExtensionDictionary(): boolean
Create extended dictionary data for objects
Returns
boolean
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
erase
▸ erase(): boolean
Delete object.
Returns
boolean
Whether the deletion was successful.
Inherited from
getDatabase
▸ getDatabase(): McDbDatabase
Get the database where the object is located
Returns
Return to database
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
Get the index ID of the object
Returns
number
Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
Obtain the extended dictionary data of the object
Returns
Expand dictionary data
Inherited from
McDbObject.getExtensionDictionary
getGripEditBasePointsIndex
▸ getGripEditBasePointsIndex(): number[]
Retrieve the edit base point index corresponding to the grip of the object.
Returns
number[]
Inherited from
McDbObject.getGripEditBasePointsIndex
getGripPoints
▸ getGripPoints(): McGePoint3dArray
Get the grip array of the object
Returns
Inherited from
getHandle
▸ getHandle(): string
Obtain object handle
Returns
string
Return object handle
Inherited from
getImp
▸ getImp(): any
Retrieve internal implementation objects.
Returns
any
Internal implementation object.
Inherited from
getJson
▸ getJson(): string
Retrieve a string in JSON format.
Returns
string
A string in JSON format.
Inherited from
getObjectID
▸ getObjectID(): McObjectId
Get the object ID.
Returns
Object ID.
Inherited from
getOwnerID
▸ getOwnerID(): number
Obtain the ID of the object owner
Returns
number
Inherited from
initTempObject
▸ initTempObject(imp): void
Initialize temporary objects.
Parameters
| Name | Type | Description |
|---|---|---|
| 'imp' | 'any' | Internal implementation object |
Returns
void
Inherited from
isErased
▸ isErased(): boolean
Has the object been deleted
Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
Is there any extended dictionary data available
Returns
boolean
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
Inherited from
isNull
▸ isNull(): any
Determine if it is an empty object
Returns
any
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any
Grips 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
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.
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
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
setShapeScaleAt
▸ setShapeScaleAt(index, scale): boolean
Parameters
| Name | Type |
|---|---|
index | number |
scale | number |
Returns
boolean
setShapeStyleAt
▸ setShapeStyleAt(index, id): boolean
Parameters
| Name | Type |
|---|---|
index | number |
id | McObjectId |
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
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
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
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
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
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
shapeStyleAt
▸ shapeStyleAt(index): McObjectId
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
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
unErase
▸ unErase(): boolean
Anti delete object.
Returns
boolean
