Scripting

Automate the drawing you repeat every week, or let another program draw for you. Each way below has a guide in the docs; this page is the overview.

Every way to script it

Pick the one that suits what you already know. They work on the same drawings.

  1. AutoLISP

    Your .lsp routines load as they are: with APPLOAD, by dropping the file on the window, or from the Lisps folder. Their DCL dialogs show in the app's window. Read about AutoLISP

  2. Python tools

    A tool is a folder in Pythons with a requirements.txt, an __init__.py and a plugin.json. A function marked @command becomes a command of the command line. Each tool runs in a python.exe and a venv of its own, so a tool that fails takes nothing of the app with it. Read about Python tools

  3. C# plugins

    A folder in Plugins with a .csproj and .cs files, which OpenCAD2D compiles when it loads, with no build. A plugin can also be a .dll, and the .csproj may name NuGet packages; the app asks before it downloads any. Read about C# plugins

  4. Remote

    Another program, in Python or .NET, reads and edits the drawings of a running OpenCAD2D, types commands on its command line and asks the user to pick a point, through a named pipe on your own computer. Read about Remote

  5. The opencad2d package

    pip install opencad2d reads, draws and saves DXF and DWG from a script with no window, and draws a drawing to a picture. Read about the Python package

  6. MCP

    A Model Context Protocol server installed beside the app, so an AI assistant can open a drawing, read it, draw in it and plot it. Read about MCP

Share your routine

Tools that people wrote for their own projects and now give away are collected in Share, which is not open yet.

About Share