sch-rnd-aux knowledge pool
Size conventions
sizes by Tibor 'Igor2' Palinkas on 2022-01-21 | Tags: convention, size, mm, inch, mil, pitch, print |
Abstract: The cschem specification states that coordinates are integer, but leaves details on the interpretation of actual coordinate values up to the implementation. The user is free to follow whatever convention. This pool node describes the default conventions sch-rnd choose for sizes and explains the research behind these values.
sch-rnd size conventions
Librnd uses nanometer as coordinate units when drawing to screen, so sch-rnd needs to convert every coord to nanometer. Since sch-rnd is not naturally tied to the physical world, this conversion could be anything, e.g a cschem integer unit could be 1 nanometer or 1 mm or 1 cm. To keep things simple and code fast, I decided rationale to use the following conversion:
1 cschem unit = 1024 nm = 1.024 um 1000 cschem units = 1.024mm
Note: mm and mil values below assume the matching drawing area size was and print page size is used. (Sch-rnd scales automatically.) Sch-rnd UI and user always uses the integer cschem unit, never mm or mil or inch; mm and mil values in the table below is only to predict approximate size of objects on typical printouts.
name | size in cschem coord | expected approx. size in print |
---|---|---|
pin distance rationale | 4000 | 4.096 mm (~161 mil) |
font height: pin label rationale | 3000 | 3.072 mm (~121 mil) |
font height: name ("refdes") label rationale | 4000 | 4.096 mm (~161 mil) |
wire line thickness | 250 | 0.256 mm (~6.5 mil) |
wire junction thickness | 1000 | 1.024 mm (~40 mil) |
terminal line thickness | 250 | 0.256 mm (~6.5 mil) |
decoration line thickness | 125 | 0.128 mm (~3.25 mil) |
lib: resistor body/zigzag box | 12000 * 4000 | 12.228 mm * 4.096 mm (~481 mil * 161 mil) |
lib: resistor/capacitor/coil total length (pin ends) | 20000 | 20.480 mm (~806 mil) |
lib: diode triangle base:height | 8000:4000 | 8.192 mm : 4.096mm (~322 mil : 161 mil) |
lib: opamp triangle base:height | 16000:16000 | 16.384 mm : 16.384 mm (~645 mil : 645 mil) |
lib: transistor circle diameter | 11000 | 11.264 mm (~443 mil) |
Rationale
1024 multiplier
We need to choose a base grid size first. A good reference for starting that is looking at "default pin pitch". The considerations:
- the smallest integer coord we want to specify, typically line widths, is about 100 times smaller than pin pitch
- to avoid rounding errors, line widths should be in the magnitude of at least a few dozen coords
- for translation to physical world, look at existing printed schematics
Considerations for the physical world conversion:
- our print will auto-scale, so we are not drawing anything on screen thinking in millimeters or inches; autoscale means: you can print the same drawing to A/4 or A/3; the A/3 print will be twice as big (assuming you used portrait for one and landscape for the other).
- sch-rnd size conventions should be picked to suit the most common case automatically: make a dense schematics printed on A/4 just readable
I took printed schematics in a local HAM radio magazine as reference. The target audience of such magazines include veteran users, which often means not perfect eye sight; the size that works in this context is probably the smallest safe size. I found research that their pin pitch is about 4mm. Thus the choice of approx. 4mm pin pitch in sch-rnd.
This led to defining default pin pitch convention to 4000 grid units, which results in:
- about 4mm in default print
- about 40..100 units for smallest line thickness
- convenient for halving grid density twice on the GUI for precision placement of labels, still having 1000 as grid unit
1024 vs. 1000: it's a conflict of interest between screen-only and print usage. On screen, the multiplier doesn't matter at all, since the user can zoom in and out arbitrarily; 1024 is faster for the computer. On paper this value matters because it determines the final sizes in mm, which will not be round: for 1000 units, we will have 1.024mm (assuming the right border is set up). This means sch-rnd can not be used easily for accurate 1:1 mm drawing.
My decision as to prefer screen over paper. Rationale: devices such as tablets and portable computers are very accessible so as years pass the total number of hours spent on looking at printed schematics decreases in favor of looking at the screen. Accurate mm scale drawing is not in the scope of sch-rnd (use a mechanical CAD or pcb-rnd for that).
Values in mil/inch system is even less round: this design has a preference of metric over imperial units. This is because the metric system is simpler in general and is used in a smaller part of the world.
Font size
Font is a complex topic. After some research my oversimplified model for figuring optimal font size convention in this research is:
- font height is the total height from the lowest to highest pixel in the tallest glyph and the lowest pixel in the most ascender glyph.
- I use pt only as an approximation so readers with word processor experience can estimate font size; when you see a pt value in this document, always take it with an error margin of +-1.
- for whatever reason, different font at the same pt size results in different height meusured in mm. So I took a shortcut and said 72 pt = 1 inch, which means 1 pt is 0.3528 mm
I've measured different text labels research in (HAM magazine) printed schematics to get an approximate font height. I concluded smallest font, typically used for pin labels, is about 3mm high. So I choose 3000 for sch-rnd default pin font height.
Then looked at gschem's ratio research between pin and refdes font and found their refdes font is 25% larger than pin font. To keep things round, I decided to go for 33% larger and use 4000 for names.
Research
Print: HAM magazine
From a 2005 issue of Radiotechnika :
- pin pitch: ~4 mm
- font height (pin label): height=3mm ~9pt (capital part: ~ 2mm)
- resistor body: 5mm*2mm, pin-to-pin len: 10mm
- diode: triangle 2.5mm:2.5mm
- transistor dia: 8mm
- opamp triangle: 9mm:9mm
- line thickness (normal; wire, deco): 0.25mm
- thin line thickness (deco): 0.15mm
- junction dia: 1mm
gschem
With A/4 titleblock.
- default grid: 100
- A4 titleblock is 116*82 grid; 11600*8200; 1mm = 39 grid; 1mil = 1 grid
- pin pitch: 200 = 5.1mm
-
font height
- pin label: cap100+desc30 = 2.56+0.76 = ~3.3mm (9.5pt)
- refdes label: cap125+desc39 = 3.2+1 = ~4.2mm (12pt)
- resistor body: 600*200 = 15.4mm*5.1mm, pin-to-pin len: 900 = 23mm
- diode: trinagle 400:300 = 10.25mm:7.7mm
- transitor dia: 640 = 16mm
- opamp triangle: 800:600 = 20.5mm : 15.4mm
-
line thickness
- deco: 5 = 0.128mm
- wire: 10 = 0.256mm
- pin: 10 = 0.256mm
- junction dia: 40 = 1.02mm