SuperAPI AI Directory

librecad

General & other

View repository

Updated 10-16 09:45

About this skill

Project URL: https://github.com/LibreCAD/LibreCAD

Official website: https://librecad.org/

Wiki: https://github.com/LibreCAD/LibreCAD/wiki

License: GPL-2.0

Overview

Main features of LibreCAD:

  • 2D vector drawing: lines/circles/arcs/ellipses/polylines/splines/dimensions/text/hatches
  • Layers, blocks, attributes, coordinate input (absolute/relative/polar)
  • Files: DXF (R12/R2007 read and write), PDF/SVG/PNG (export), DWG (converted via ODA File Converter or LibreDWG)
  • Cross-platform: Windows, macOS, Linux
  • Internationalization: includes a complete Chinese interface

Native DWG read/write support is limited; it is recommended to first convert to DXF using LibreDWG or ODA.


Installation

# Linux
sudo apt install librecad

# macOS
brew install librecad

# Windows / 其它:从官网下载

Interface and basic operations

Area Purpose
Top menu File / Edit / View / Plugins / Tools / Drawing / Dimension / Modify / Info
Left toolbar Drawing (CAD Toolbars), snapping, modification
Command line (invoked by pressing ":") AutoCAD-like command input
Layer management Layer List on the right
Block management Block List on the right

Common command abbreviations

Command Function
li line straight line
ci circle circle
re rectangle
pl polyline polyline
tr trim trim
mi mirror mirror
co / cp copy
mv move
ro rotate
sc scale
os osnap object snap
di distance measure distance
pu purge

Coordinate input

Input Meaning
100,50 Absolute Cartesian
@100,50 Relative Cartesian (relative to previous point)
@100<30 Relative polar (length<angle)

Layers and blocks

  • Layers: right panel → New, where you can set color/linetype/lineweight/print toggle
  • Blocks: select elements → right-click → Create Block, or Drawing → Block → New
  • The current layer is switched in the status bar; lock/hide/freeze buttons

Dimensions

  • Linear, aligned, radius, diameter, angular, leader
  • Dimension style:Options → Drawing Preferences → Dimensions
  • Global dimension scale + text height

Hatches and text

  • Hatch: select boundary → choose pattern (ANSI/ISO/Earth/Solid) + scale + angle
  • Text: single-line / multi-line; supports SHX and TTF fonts; for Chinese use Noto Sans CJK SC , etc.

File interaction

# DXF(自带)
File → Open / Save As / Export

# DWG → DXF(需要 ODA File Converter)
ODAFileConverter input.dwg . ACAD2010 DXF 1 0
# 或
dwg2dxf -y input.dwg            # LibreDWG

# 导出 PDF
File → Export → Export as PDF

Command line (no interface)

# 启动并运行命令脚本(需自定义脚本插件支持)
librecad --no-startup-window

# 配合 dxf-tools / Python 脚本批处理

LibreCAD's own scripting capability is relatively weak; for batch conversion it is recommended to combine:

  • LibreDWG converts DWG ↔ DXF
  • ezdxf(Python library) for DXF parsing and generation
  • inkscape for DXF → SVG/PDF

Using ezdxf with LibreCAD

import ezdxf
doc = ezdxf.new('R2010')
msp = doc.modelspace()
msp.add_line((0,0), (100,0))
msp.add_circle((50,0), 10)
doc.saveas('out.dxf')   # LibreCAD 可直接打开

Performance and stability

  1. Manage large drawings by layer, turn off unnecessary layers
  2. Turn off too many options in OSNAP
  3. Before exporting PDF, Tools → Recalculate Dimensions
  4. Back up .dxf; DXF R2007 contains more complete information than R12
  5. Avoid Chinese paths under Windows

Common problems

Problem Solution
Garbled Chinese text Switch the font to TTF (SimHei/Noto), place SHX font files in fonts/
DWG cannot be opened Convert DXF with ODA File Converter or LibreDWG
Annotation scale is too small to see Drawing Preferences → Dimensions → General Scale
Crashes on open Delete ~/.config/LibreCAD/LibreCAD.conf reset
Unable to fill Close the polyline then hatch; check hole/outer boundary order

AI usage recommendations

  • Recommended workflow modes: The AI assistant should prioritize DXF as the intermediate exchange format—DWG files should first be converted to DXF via ODA File Converter or LibreDWG, then edited with LibreCAD. For batch-processing scenarios, use ezdxf(Python library) together with CLI tools.
  • Key considerations: ① Native DWG support is limited, so DXF should be the primary exchange format; ② Chinese text requires TTF fonts (Noto Sans CJK SC / SimHei), and SHX must be placed in the fonts/ directory; ③ Large drawings should be managed by layer, and unnecessary OSNAP should be turned off; ④ Command abbreviations (li/ci/pl/tr/mi) are similar to AutoCAD but not exactly the same.
  • Common code patterns: GUI interaction: press : to bring up the command line → enter the command abbreviation → coordinate input (@100,50 relative Cartesian,@100<30 relative polar). Python batch processing:ezdxf.new('R2010') → msp.add_line/add_circle → doc.saveas('out.dxf')。

Typical workflows

Workflow 1: Drawing an architectural floor plan

  1. Create a new file and set drawing units (Drawing Preferences → Units → mm)
  2. Create layers (walls/doors and windows/annotations/text) and set colors and line types
  3. Use the li command to draw axes,re to draw rectangular walls,ci to draw circular columns
  4. tr trim intersecting lines,pl draw polyline outlines
  5. Add linear/aligned dimensions (dimlinear/dimaligned)
  6. Export PDF for printing, or save DXF R2007 for AutoCAD exchange

Workflow 2: Batch convert DWG → DXF

  1. Install the ODA File Converter or LibreDWG tools (dwg2dxf)
  2. ODAFileConverter input.dwg . ACAD2010 DXF 1 0 or dwg2dxf -y input.dwg
  3. Open the generated DXF in LibreCAD and check Chinese text and layers
  4. If necessary, use the ezdxf Python script to fix format issues
  5. Save as R2007 DXF to ensure compatibility

Related skills


Reference resources