Halaman ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.
Plugins
A plugin adds commands of its own to Tools > Plugins: a packaging box, a cutting layout, a shape you draw often, or a feature you miss. It is a script, written in JavaScript like the scripts of the Scripts panel, that you install once and then run from the menu. Plugins can be shared as .js files.
To install a plugin
- Choose Tools > Plugins > Install Plugin.
- Pick the plugin's
.jsfile. Its commands appear under Tools > Plugins, each plugin in a submenu of its own (a plugin of one command shows that command alone).
Installing a plugin with the name of one already installed replaces it.
To write a plugin
- Choose Tools > Plugins > New Plugin. The Scripts panel opens with an example plugin of two commands.
- Change its name, description and commands. Each command has a
nameand arun()function, which works with the drawing as any script does (see Scripts and automation). - Click Install as Plugin.
A plugin defines one object, TraceDrawPlugin:
const TraceDrawPlugin = {
name: 'Boxes',
description: 'Packaging boxes.',
version: '1.0',
commands: [
{ name: 'Square box', run() { ActiveLayer.CreateRectangle(20, 20, 50, 50); } },
],
};
Each command's changes are one step to undo. What it prints goes to the Scripts panel's output. When a command stops with an error, the status bar says why and what it did before the error is kept.
The Plugin Manager
Tools > Plugins > Plugin Manager lists the installed plugins with their descriptions and commands.
- On Turned off, a plugin stays installed but its commands leave the menu.
- Edit Opens the plugin in the Scripts panel, to change it and install it again.
- Remove Uninstalls it.
Plugins are kept with your preferences.