MLightCAD
    Preparing search index...

    Centralizes layer table mutations for commands and UI consumers.

    Wraps on/off, freeze/thaw, lock/unlock, color, isolation (LAYISO/LAYUNISO), deletion (LAYDEL), and related operations with consistent undo handling. Document-scoped session state (LAYERP, LAYUNISO snapshots) lives on AcApDocument.

    Index

    Constructors

    Methods

    • Collects distinct layer names from a set of entity ids.

      Parameters

      • objectIds: string[]

        Entity ids to inspect.

      Returns { layerNames: string[]; missingLayerNames: string[] }

      Resolved layer names and names missing from the layer table.

    • Resolves live layer-table traits for rendering and style synchronization.

      Parameters

      • layerName: string

        Name of the layer to resolve from the layer table.

      Returns Partial<AcGiSubEntityTraits> | undefined

      Resolved sub-entity traits, or undefined when the layer is missing.

    • Keeps one layer visible and turns all others off (UI quick-isolate).

      Does not capture a LAYUNISO snapshot; use isolateLayers for command semantics.

      Parameters

      • layerName: string

        Layer to keep visible.

      Returns boolean

      true when the layer exists and isolation was applied.

    • Parses color input for layer color assignment.

      Accepts ACI index (1–255) or color strings understood by AcCmColor.fromString.

      Parameters

      • input: string

        Raw color string from the user or UI.

      Returns AcCmColor | undefined

      Parsed color, or undefined when invalid.

    • Updates a layer description.

      Parameters

      • name: string

        Target layer name.

      • description: string

        New description text.

      Returns boolean

      true when the layer exists and description was set.

    • Freezes or thaws a single layer.

      UI callers should pass { switchCurrentLayer: true } when freezing the current layer so drawing continues on a visible, thawed layer.

      Parameters

      • layerName: string

        Target layer name.

      • frozen: boolean

        Desired frozen state.

      • options: AcApSetLayerOnOptions = {}

        Optional behavior when freezing the current layer.

      Returns boolean

      true when the layer exists and was updated.

    • Restores frozen state by layer name for LAYFRZ session undo.

      Parameters

      • layerName: string

        Target layer name.

      • frozen: boolean

        Frozen state to restore.

      Returns boolean

      true when the layer exists and state was applied.

    • Assigns a linetype name to a single layer.

      Parameters

      • layerName: string

        Target layer name.

      • linetype: string

        Linetype table record name.

      Returns boolean

      true when the layer exists and linetype was set.

    • Assigns line weight to a single layer.

      Parameters

      • layerName: string

        Target layer name.

      • lineWeight: number

        Line weight value to assign.

      Returns boolean

      true when the layer exists and line weight was set.

    • Restores off state by layer name for LAYOFF session undo.

      Parameters

      • layerName: string

        Target layer name.

      • off: boolean

        Off state to restore.

      Returns boolean

      true when the layer exists and state was applied.

    • Turns a single layer on or off.

      When turning off the current layer, pass { switchCurrentLayer: true } (as AcApLayerStore does) to move CLAYER first. CLI commands leave the default false and rely on batch helpers to skip the current layer.

      Parameters

      • layerName: string

        Target layer name.

      • isOn: boolean

        Desired visibility (true = on).

      • options: AcApSetLayerOnOptions = {}

        Optional behavior when turning off the current layer.

      Returns boolean

      true when the layer exists and was updated.

    • Sets whether a layer is included when plotting.

      Parameters

      • layerName: string

        Target layer name.

      • isPlottable: boolean

        true to plot the layer; false to exclude it.

      Returns boolean

      true when the layer exists and was updated.

    • Assigns transparency to a single layer.

      Parameters

      • layerName: string

        Target layer name.

      • transparency: AcCmTransparency

        Transparency value to assign.

      Returns boolean

      true when the layer exists and transparency was set.

    • Moves CLAYER away from a layer before turning it off or freezing it.

      Parameters

      • targetLayerName: string

        Layer that will be turned off or frozen.

      Returns boolean

      true when CLAYER is no longer the target layer, or target was not current.

    • Opens an existing layer table record for write.

      Returns the layer-table instance from AcDbLayerTable.getAt, not the result of AcDbDatabase.openObjectForWrite. Some drawings reuse the same handle in different symbol tables (for example layer PLATE and text style Standard both using id 11); global id lookup would open the wrong record and layer visibility edits would silently no-op.

      Parameters

      • db: AcDbDatabase

        Database containing the layer table.

      • layerOrName: string | AcDbLayerTableRecord

        Layer record or name to open.

      Returns AcDbLayerTableRecord | undefined

      Opened layer record, or undefined when not found.

    • Resolves live layer-table traits from the given database.

      Parameters

      • db: AcDbDatabase

        Database whose layer table supplies the record.

      • layerName: string

        Name of the layer to resolve.

      Returns Partial<AcGiSubEntityTraits> | undefined

      Resolved sub-entity traits, or undefined when the layer is missing.