Example: Qucs schematic → ROOM → round-trip
The qucs_to_room program — schematic import, save, reload, export
1. Run (VS Code)
Tasks: Run Task → Example: Qucs to ROOM
2. Run (command line)
.\build\qucs_to_room.exe examples\qucs_to_room\data\rc_lowpass.sch examples\qucs_to_room\output\schematic.room
| Argument | Description |
|---|---|
input.sch | Qucs schematic (default: examples/qucs_to_room/data/rc_lowpass.sch) |
output.room | ROOM file — any path/name, e.g. schematic.room |
dump.txt | Text dump (optional) |
roundtrip.sch | Exported Qucs file after reload (optional) |
3. Source code
examples/qucs_to_room/main.cpp
#include "database.h"
#include "qucs_importer.h"
#include "qucs_exporter.h"
#include "text_dump.h"
room::QucsImporter importer;
room::Database db = importer.importFile("rc_lowpass.sch");
db.saveToFile("schematic.room");
room::Database loaded = room::Database::loadFromFile("schematic.room");
room::QucsExporter exporter;
exporter.exportCell(loaded, "rc_lowpass", "schematic_roundtrip.sch");
4. Data flow
Qucs .sch (text)
│
▼
QucsImporter::importFile()
│ Components → Instance, Wires → Net/Term
▼
Database → Cell → CellContent(schematic).payload.schematic.block
│
├─► Database::saveToFile() → schematic.room
├─► Database::loadFromFile() → reload check
└─► QucsExporter::exportCell() → schematic_roundtrip.sch
5. Qucs → ROOM mapping
| Qucs | ROOM |
|---|---|
<Components> line | Instance (cellName = Qucs type, qucs.instName = R1, C1, …) |
<Wires> label | Net name |
| Wire endpoints | Term positions; dbuPerEditorUnit=1 (1 DBU = 1 Qucs grid unit) |
| Coordinate scale | CellContent::dbuPerEditorUnit() = 1 |
| View type | ViewType::Schematic |
6. Attached primitive libraries (LibMan / Qucs-S)
When a project attaches tech or common libraries, LibMan sets environment variables consumed by PrimitiveResolver and QucsExporter::Options:
| Variable | Purpose |
|---|---|
CORE_PRIMITIVE_LIBS_FILE | Newline-separated list of *.symbol.room paths (preferred for large libraries) |
LIBMAN_TECH_LIBRARY | Logical library names (commonLib;sg13g2_pr) |
QUCS_PRIMITIVE_LIB | Qucs <Lib> name for PDK cells |
On export to Qucs, passives map to native devices (res → R).
PDK and hierarchy cells use <Lib> with ROOM symbol geometry.
Xschem-only decorations (lab_wire, code_shown) are omitted in Qucs.
7. Sample text dump
cell "rc_lowpass"
type schematic dbuPerMicron=1.000 dbuPerEditorUnit=1.000
shapes=0 instances=4 nets=3
instance -> "R" at (280,200)
instance -> "C" at (480,200)
net "N1" sig=signal terms=4
Limitations
- Only schematic topology is mapped; simulation diagrams are stored but not interpreted
- Implicit connectivity through unlabeled wire junctions uses endpoint union-find (anonymous nets
N$N) - Qucs component libraries (
.lib) are not imported yet
See also: GDS layout import example · Coordinate scale