From lines to logic: how software turns a P&ID into a connected model
A P&ID drawing is lines and text; a P&ID model is objects and connections. Converting one into the other is a chain of steps, each with its own way of going wrong. This is how that chain works, step by step, and how each step is checked.
Start from what the file actually holds
The first decision is made by the input, not the software. A DXF or DWG drawn without a P&ID database still holds exact geometry: blocks (often one per symbol, sometimes named usefully), lines and polylines, and real text. A PDF exported from CAD holds strokes and, usually, text — but no blocks, so a valve is just a few line segments that happen to form a valve. A scan holds pixels. Each step below is easier the more the file already knows, which is why a conversion project should sort its sheets by format before anything else (see our guide to P&ID digitisation).
Step 1: find and name the symbols
Symbols come from a library: the project's legend sheets, which usually follow ANSI/ISA-5.1 for instruments and ISO 10628-2 or a company standard for equipment and piping components. Finding them works differently by input:
- CAD: block references are candidates in themselves, but block names are unreliable across contractors, and many sheets draw symbols as loose lines. Matching the geometry of each candidate against the library, in every rotation and mirror, is more robust than trusting names.
- Vector PDF and scans: the page is rasterised and each library symbol is searched for across scales, rotations and mirror images, coarse to fine. The page's scale is estimated first from shapes that occur on every sheet, such as valves and instrument bubbles.
Two rules keep the result honest. A find keeps its name only when no other library shape fits as well and no unexplained ink hangs off it; otherwise it is reported as unknown with suggestions, for an engineer to classify. And a find must make sense where it sits: a simple shape like an orifice plate or an arrowhead only counts on a line. Mirror-image variants — a valve with its actuator on the left or the right — are the most common confusion, so they are named from the lettering and context where possible.
Step 2: read the text and give it an owner
A P&ID carries several kinds of text: equipment tags, instrument function letters and loop numbers inside bubbles, line numbers along pipes, valve tags, set pressures, notes and holds, and the title block. Reading the characters — from the file's own text where it exists, by OCR where it does not — is the easy half.
The harder half is association. A line number is placed beside the line it labels, sometimes with a leader, sometimes not; a set pressure belongs to the relief valve above it, not the line below. Association uses distance, orientation (text along a line usually labels that line), leaders, and grammar: text that parses as a line number in the project's format is a line label; letters inside a bubble are an instrument's function. Instrument letters are decoded by ISA-5.1's rules — a first letter for the measured variable, an optional modifier, then functions — so PDIT becomes a pressure, differential, indicating transmitter.
Step 3: trace the lines
Once symbols and text are known, what remains is mostly lines. Tracing turns them into continuous runs:
- Join the pieces. CAD lines are often drawn in many short segments; dashed signal lines are separate dashes. Collinear pieces with small gaps are joined, within thresholds measured on the drawings themselves rather than guessed.
- Tell crossings from branches. Two lines that cross without connecting are drawn with a gap or a hop on some sheets and with nothing at all on others; a branch is a tee, often with a dot. Getting this wrong silently connects two systems that are not connected.
- Separate line types. Process lines, signal lines (dashed, or with other ISA patterns), software links and pneumatic lines are kept apart by style, weight and layer, because they form different networks.
- Ignore the furniture. Border, title block, tables and notes are lines too; anything outside the drawing area is set aside before tracing.
Step 4: bind the line ends and build the networks
Each traced line end is bound to what it touches: a nozzle on a vessel, a port on a valve, another line at a tee, an off-page connector at the edge of the sheet. A line end that stops a little short of a symbol is extended along its own direction to what lies just ahead; a line end that touches nothing is flagged rather than forced. Flow arrows set direction where they are drawn.
The result is a graph: components as nodes, piping segments and signal lines as edges, grouped into process networks and instrument loops. Line attributes parsed from the line numbers — size, fluid code, piping class — are attached to the segments, and spec-break symbols split them where the class changes. Off-page connectors record where each network continues, so sheets can later be joined. Written out in an open format such as DEXPI, this graph is the intelligent P&ID.
Step 5: check it before anyone uses it
A model can look right and be wrong. Three checks catch most of it:
- Re-draw and compare. The sheet is regenerated from the model alone and laid over the original. Ink on only one side is something the model lacks or invented. Scoring how much of each lies on the other gives a per-sheet fidelity number that can gate the release.
- Validate the content. Rules test what a schema cannot: every segment has two ends, every nozzle connects or is deliberately open, tags are unique, line sizes agree with reducers. A file can pass schema validation while modelling almost nothing.
- Put an engineer on the flags. Unknown symbols, unbound line ends, unassociated text and failed rules go to a reviewer, who sees each one on the sheet. The engineer's job changes from transcribing the drawing to reviewing the exceptions.
Accuracy figures for each step should be measured against a hand-checked ground truth, per sheet and per input type. A tool that is excellent on clean CAD can struggle on a poor A3 scan, and the weakest sheet tells you more than the average.
From one sheet to a plant
A unit is drawn across many sheets, and a line that leaves one sheet through an off-page connector has to arrive on another. Joining sheets is a step of its own: each connector names its continuation (by sheet number, by line number, or both), and the conversion pairs the outgoing end on one sheet with the incoming end on the other. Unpaired connectors are reported — they are either a drafting error, a sheet missing from the set, or a boundary with another unit. Until sheets are joined, any question that crosses a sheet boundary, such as which valves isolate a pump whose discharge continues on the next drawing, can only be answered up to the edge of the sheet.
What a conversion should hand over
Per sheet, a useful conversion delivers more than a file:
- the model in an open format (DEXPI), and the registers read from it;
- a re-drawn sheet from the model, so the drafters have a clean CAD drawing and the reviewers can overlay it;
- the fidelity score from the re-draw, and the rule-check results;
- the exception list — unknown symbols, unbound line ends, unassociated text — with what the reviewer decided for each.
The exception list is the audit trail. It shows where the machine was unsure and who made the call, which is what an owner needs before trusting the model for a HAZOP or an isolation.
Where it still goes wrong
- Symbols the library does not contain — a company's own handwheel style, an unusual analyser — which is why unknowns must be reported, not guessed.
- Crossings drawn without a gap, and branches drawn without a dot, on the same sheet.
- Text placed equally close to two objects.
- Hand mark-ups, stamps and revision clouds on scans, which look like process lines to a tracer.
- Information that is simply not on the sheet: design conditions, instrument ranges, the as-built state.
Our P&ID Converter runs this chain on PDF exports, scans and DXF, re-draws every sheet from its model to measure fidelity, and puts an engineer's review before release as DEXPI and DXF. To see what it makes of your drawings, send us one sheet.

