Represents a record in the line type table within the AutoCAD drawing database.

Each line type table record contains the information necessary to define a specific line type, including its pattern, description, and rendering characteristics. Line types define how lines are drawn, including patterns of dashes, dots, and spaces.

Within the line type table record, the dashes (line segments that make up characteristics of the linetype) are stored in a list with an index that is zero based. If the linetype is complex, then embedded shapes or text strings are stored in the list at the same index as the dash that preceded them in the linetype definition. So there will always be a dashLength for any valid index in the list, even if there is a shape or text string sharing the same index. When the linetype is elaborated, a shape's insertion point will coincide with the end of the dash that it shares an index with.

Hierarchy (View Summary)

Constructors

Accessors

  • get comments(): string
  • Gets the description or comments associated with this line type.

    This property provides additional information about the line type, such as its intended use or any special characteristics.

    Returns string

    The description text for the line type

  • get database(): AcDbDatabase
  • Gets the database in which this object is resident.

    When an object isn't added to a database, this property returns the current working database. After it is added to a database, it will be set automatically. You should never set this value manually.

    Returns AcDbDatabase

    The database this object belongs to

    const db = obj.database;
    
  • set database(db: AcDbDatabase): void
  • Sets the database for this object.

    This is typically set automatically when the object is added to a database. Manual setting should be avoided unless you know what you're doing.

    Parameters

    Returns void

    obj.database = myDatabase;
    
  • get name(): string
  • Gets or sets the name of the symbol table record.

    This property corresponds to DXF group code 2 and is used for identifying and referencing the symbol table record.

    Returns string

    The name of the symbol table record

    const recordName = record.name;
    record.name = 'NewRecordName';
  • set name(value: string): void
  • Parameters

    • value: string

    Returns void

  • get numDashes(): number
  • Gets the number of dash elements in the line type pattern.

    This value represents the total count of dashes, spaces, dots, and other pattern elements that make up the line type. It corresponds to DXF group code 73 in the AutoCAD file format.

    Returns number

    The number of pattern elements in the line type

  • get objectId(): string
  • Gets the object ID.

    AutoCAD uses 64-bit integers to represent handles, which exceed the maximum integer value of JavaScript. Therefore, strings are used to represent object handles.

    Returns string

    The object ID as a string

    const id = obj.objectId;
    console.log(`Object ID: ${id}`);
  • set objectId(value: string): void
  • Sets the object ID.

    Parameters

    • value: string

      The new object ID

    Returns void

    obj.objectId = 'new-object-id';
    
  • get ownerId(): string
  • Gets the object ID of the owner of this object.

    Returns string

    The owner object ID

    const ownerId = obj.ownerId;
    
  • set ownerId(value: string): void
  • Sets the object ID of the owner of this object.

    Parameters

    • value: string

      The new owner object ID

    Returns void

    obj.ownerId = 'parent-object-id';
    
  • get patternLength(): number
  • Gets the total pattern length in AutoCAD drawing units.

    The pattern length represents the total length of all dashes and spaces when the line type scale is 1.0. This value is used to calculate how the pattern repeats along a line.

    Note: Embedded shapes or text strings do not add to the pattern length because they are overlaid and do not interrupt the actual dash pattern.

    Returns number

    The total length of the line type pattern in drawing units

Methods

  • Closes the object.

    All changes made to the object since it was opened are committed to the database, and a "closed" notification is sent. This method can be overridden by subclasses to provide specific cleanup behavior.

    Returns void

    obj.close();
    
  • Gets the length of a specific dash element in the line type pattern.

    Each dash element in the pattern has a specific length that determines how it appears when the line type is rendered. Positive values represent visible dashes, while negative values represent spaces (pen up).

    Parameters

    • index: number

      Zero-based index of the dash element. Must be greater than or equal to zero, but less than the value of property 'numDashes'

    Returns number

    The length of the specified dash element in drawing units

    When the index is out of range

  • Gets the value of the specified attribute.

    This method will throw an exception if the specified attribute doesn't exist. Use getAttrWithoutException() if you want to handle missing attributes gracefully.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute

    When the specified attribute doesn't exist

    try {
    const value = obj.getAttr('objectId');
    } catch (error) {
    console.error('Attribute not found');
    }
  • Gets the value of the specified attribute without throwing an exception.

    This method returns undefined if the specified attribute doesn't exist, making it safer for optional attributes.

    Parameters

    • attrName: string

      The name of the attribute to retrieve

    Returns any

    The value of the specified attribute, or undefined if it doesn't exist

    const value = obj.getAttrWithoutException('optionalAttribute');
    if (value !== undefined) {
    // Use the value
    }