MLightCAD
    Preparing search index...

    Options for creating AcApDocManager instance

    interface AcApDocManagerOptions {
        autoResize?: boolean;
        baseUrl?: string;
        commandAliases?: Record<string, string | string[]>;
        container?: HTMLElement;
        height?: number;
        notLoadDefaultFonts?: boolean;
        plugins?: {
            fromConfig?: (AcApPlugin | (() => AcApPlugin))[];
            fromFolder?: {
                continueOnError?: boolean;
                folderPath: string;
                pluginList: string[];
            };
        };
        useMainThreadDraw?: boolean;
        webworkerFileUrls?: AcApWebworkerFiles;
        width?: number;
    }
    Index

    Properties

    autoResize?: boolean

    The flag whether to auto resize canvas when container size changed. Default is false.

    baseUrl?: string

    Base URL to load resources (such as fonts annd drawing templates) needed

    commandAliases?: Record<string, string | string[]>

    Optional command alias overrides.

    Key is command global name, value is one alias or alias list. If a command is not configured here, built-in default aliases are used.

    commandAliases: {
    LINE: ['L', 'LN'],
    CIRCLE: 'CI'
    }
    container?: HTMLElement

    Optional HTML container element for rendering. If not provided, a new container will be created

    height?: number

    Height of the canvas element. If not provided, use container's height

    notLoadDefaultFonts?: boolean

    The flag whether to load default fonts when initializing viewer. If no default font loaded, texts with fonts which can't be found in font repository will not be shown correctly.

    plugins?: {
        fromConfig?: (AcApPlugin | (() => AcApPlugin))[];
        fromFolder?: {
            continueOnError?: boolean;
            folderPath: string;
            pluginList: string[];
        };
    }

    Configuration for automatic plugin loading.

    Plugins can be loaded automatically during initialization from:

    • A configuration array of plugin instances or factory functions
    • A folder path with a list of plugin files to load

    Type Declaration

    • OptionalfromConfig?: (AcApPlugin | (() => AcApPlugin))[]

      Load plugins from a configuration array. Each item can be a plugin instance or a factory function that returns a plugin.

    • OptionalfromFolder?: { continueOnError?: boolean; folderPath: string; pluginList: string[] }

      Load plugins from a folder using dynamic imports.

      • OptionalcontinueOnError?: boolean

        Continue loading other plugins if one fails (default: false)

      • folderPath: string

        Path to the folder containing plugin files

      • pluginList: string[]

        List of plugin file names to load

    // Load plugins from configuration
    AcApDocManager.createInstance({
    plugins: {
    fromConfig: [
    new MyPlugin1(),
    () => new MyPlugin2()
    ]
    }
    });

    // Load plugins from folder
    AcApDocManager.createInstance({
    plugins: {
    fromFolder: {
    folderPath: './plugins',
    pluginList: ['Plugin1.js', 'Plugin2.js'],
    continueOnError: true
    }
    }
    });
    useMainThreadDraw?: boolean

    The flag whether to use main thread or webwork to render drawing.

    • true: use main thread to render drawing. This approach take less memory and take longer time to show rendering results.
    • false: use web worker to render drawing. This approach take more memory and take shorter time to show rendering results.
    webworkerFileUrls?: AcApWebworkerFiles

    URLs for Web Worker JavaScript bundles used by the CAD viewer.

    width?: number

    Width of the canvas element. If not provided, use container's width