Options for creating AcApDocManager instance

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

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

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