Skip to content
tishad.net
SearchCtrl K

Lessons / Part 9. Figures, drawings and deliverables made from code

62 Draw from a record, and put every correction in a checker

A drawing generated from a record of equipment, lines and valves, with a checker that reports what the record leaves out.

What people usually ask

Draw a P&ID like this picture, with my changes: add a relief valve on the still and send the condenser outlet to the receiver.

What comes back

A drawing that imitates the look of the picture, with the changes placed by guesswork and nothing that says whether any rule was met.

Ask this instead

First
Do not draw yet. Build the record for my 200 L solvent recovery still from the attached equipment list: equipment.csv, lines.csv and valves.csv, one row per item, columns for tag, type, size, rating, from and to. Leave a field empty when the list does not give it; never fill it with a typical value.
Then write draw.py, which reads the three files and draws the P&ID from them. Nothing appears on the drawing that is not in a file.
Then write check.py, which applies the attached written rules (every vessel has a relief path, every pump has an isolation valve on each side, every line has a size) and prints each failure with the tag and the rule number. An empty field is a failure.
Run check.py and show me the output. Fix nothing yet.

Then
Each correction I give goes into the record. When it is a new rule, it goes into rules.md and into check.py as well. Never edit the drawing by hand.

Attach: The equipment list and the written rules as plain text.

Why it works: The drawing is a view of the record, and the checker catches the missing fields and broken rules that an eye on the picture does not.

Drafted with Fable 5.1 from my notes; chosen and edited by me.