Metric Units in schematic components

Hello dear peoples!

I don’t use standard libraries, I can create my own libraries with components that needed.
BUT! I can’t use metric units in schematic diagrams!

Open “LibrePCB Control Panel”, then “Library Manager”. Workspace library manager open, it’s OK still yet. Then I choose a “Create New Library”, or open existing library that I create ago. Open “Library Editor” with 6 rectangle areas. Symbol - New (or Edit existing). Symbol image editor opened. I draw lines, place pins… In METRIC units, change grid 2.54mm to 2.50mm. All lines and pins positionized to METRIC coordinates, for ex. (X:Y 0.000 : 5.000). But! After editing warning message appears: " WARNING: This library element contains errors, see exact messages below. You shound fix these errors before saving it, otherwise the library element may not work properly. " In Message rectangle shows “Pin not on 2.54mm grid”

But I don’t want to use a mils/inches grids! This is obsolete! I want use a METRIC grid in all units, schematic, symbol images, etc.

1 Like

Hi @Lantcoder,

Did you already try to just ignore this message? Basically the library element check (which shows this warning) is just a help to follow best practices and our library conventions. You can still ignore (some of) these warnings, save the symbol and use it in your schematics.

I think if you also use a metric grid in your schematics, everything should work fine as long as all pins are located on the same grid interval. But I didn’t test it, so please correct me if I’m wrong :slight_smile:

O yeah, I can ignore this warning. But really is this an exit, is there a solve of problem? Of course NO.
Ability to use metric units without stupid warnings… there must be a major feature, choosing measurements system (metric/imperial), please, make this!

Library conventions… Why are you use a “stone age” grid of 2.54 mm? All world came to metric units, even computer dimensions have migrate from Inches to Millimeters tens years ago (5’ floppy disc was in Inches, but 3’ floppys was in millimeters). Use this past-century grid in THEIR libraries, give us ability to use other grids! For example, P-CAD and Altium CADs give ability to use own grids for 20 years (I don’t remember exactly). But in a good way would be to convert your libraries to modern metric measurement units, there are two libraries sets, old and new, with gradually finishing of support old libraries.

I propose slightly correct a grid dialog window. Measurement units: Millimeters, micrometers, nanometers (OMG), inches, mils. Why you add nanometers? For nanocircuits? These units nobody to use.

Instead of “Interval” dialog make a dual choose of type units (Imperial / Metric), where Imperial is a Inch, Metric is a Meter. Next choose is a MULTIPLIER list, where are a list with multipliers: 1000,100, 10, 1, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001. Defaut values is a 0.001 in Metric and 0.1 in Imperial units. Next text input field where we can manually set a grid, default values is a 2.50000 in metric and 1.0000 in imperial

In file formats (*.lp) add parameter with measuring system (metric/imperial) and multiplier

Library conventions… Why are you use a “stone age” grid of 2.54 mm?

I’m a big fan of using SI units as much as possible. And @ubruhin is too. For example for the SMD resistor components in the base library, we use names like “3216 (1206)”, not “1206 (3216)”.

However, real-world packages/footprints usually use inch-based pin spacing. This means that the only sensible grid default for the board editor is inches (2.54 mm in this case).

And having different grid defaults for the board editor and the schematic editor would be inconsistent, therefore we also use a 2.54 mm grid by default in the schematic editor.

You are of course free to use any grid you want. But as of right now, the warning is still relevant because of missing snapping functionality in the schematic editor. IIRC if you mix different grid intervals, pins outside of the grid lines currently cannot be connected to. Definitely a bug that needs to be fixed, but adding a warning was a quicker (temporary!) solution than implementing grid snapping. Pull requests with fixes are welcome!

While the board editor will always have to express things relative to the measurement of some dead kings thumb I would argue that the schematic editor doesn’t have to follow simply to be consistent.

What if we tried this:

Create a parameter in each symbol set to the value of 2.54. Every position value is then divided by this parameter. Then the schematic editor could change this value to 2.50 for everybody and all the symbols would still fit on a metric grid.

That will only work for plain rectangular symbols without any graphical elements.

Why wouldn’t the graphics scale?Everything should resize by less than 2% Even if it wasn’t perfect it might not even be noticeable

Ah, I see. So you’d scale everything (including fonts) using the scale factor declared for every symbol?

I wonder if that’s worth the hassle, although it would indeed make it possible to switch over to a metric grid without backwards compatibility issues.

It wouldn’t just affect display logic though, but also print- and export-to-PDF logic, since there are document frames with specific sizes (e.g. A4) that would need to retain their “absolute size”.

You would need two sets of frames, one imperial and one metric but symbols could be written that would work for both.

You could also check for the existence of a SCALE parameter. If it doesn’t exist then use the data as written. If it does then switch between 2.54 and 2.50 based on mode and multiply everything by that factor.

Let’s reheat this theme. One year gone out.


This picture shows that my resistors (created with metric units) does not connected with wires. BUT. Wires are connecting with each other.

Pins of my resistors (I create my library) - exactly in metric 5.00mm (instead 5.08). Grid on symbol editor - 2.50mm. Grid on schematic editor - 2.50mm also. Whats TF?

schematic.lp file is ideal, all units in millimeters, see listing below:

(librepcb_schematic 62cb8038-78af-436a-a188-cef761ad7851
 (name "Main")
 (grid (type lines) (interval 2.5) (unit millimeters))

 (symbol 153d3f16-d021-4ecd-8c35-9a37d2cf2c3f
  (component 990c812d-da2c-4b3d-ac60-d0934751ba61)
  (lib_gate 3f68ada3-f230-4b69-9db5-dabf6701863d)
  (position 67.5 -35.0) (rotation 0.0) (mirror false)
 )
 (symbol 173f666a-c30f-4ad9-a44d-9ffd55fb3f17
  (component 39ced77f-610e-40ef-93d9-267c317b14b3)
  (lib_gate 3f68ada3-f230-4b69-9db5-dabf6701863d)
  (position 67.5 -45.0) (rotation 0.0) (mirror false)
 )
 (symbol 8df4a836-00e8-42ae-8973-248d4545eeb1
  (component de5e9da7-081f-4b13-ba22-9f0ffac6a703)
  (lib_gate 3f68ada3-f230-4b69-9db5-dabf6701863d)
  (position 67.5 -22.5) (rotation 0.0) (mirror false)
 )

 (netsegment 3a105b9b-42a7-4ada-b2cf-b2360be035db
  (net 038741ad-bd80-4516-812f-c6ef7a6e6b38)
  (junction 60cfdfa2-d00b-44b9-ae92-0321ee6204cf (position 62.5 -22.5))
  (junction b738434a-ad01-452f-a816-420cf88ef841 (position 62.5 -35.0))
  (junction ba13b4f6-ecea-400f-b2e4-433f114a83a2 (position 62.5 -45.0))
  (line 88016b7d-d453-42c3-bf2c-111668a7dec2 (width 0.15875)
   (from (junction 60cfdfa2-d00b-44b9-ae92-0321ee6204cf))
   (to (junction b738434a-ad01-452f-a816-420cf88ef841))
  )
  (line b0e2496c-9c16-4409-983c-c340c0ccc407 (width 0.15875)
   (from (junction b738434a-ad01-452f-a816-420cf88ef841))
   (to (junction ba13b4f6-ecea-400f-b2e4-433f114a83a2))
  )
 )
 (netsegment 9cadd1ab-bc91-43ba-b163-8be7299acf9c
  (net c9ce358a-007a-43b7-b4fd-d17fcc6b4d1c)
  (junction 19a64d41-f337-4b26-8712-0406fe48dbe3 (position 80.0 -22.5))
  (junction 52b9282d-5a6e-4aa4-8f61-a2db60ac64e8 (position 80.0 -40.0))
  (junction d30f6a61-23ca-46ed-9726-6fae52bc84f9 (position 95.0 -30.0))
  (junction d8a51593-25b1-4cd1-ae49-806e6cb63f0c (position 80.0 -30.0))
  (line 01d0b261-12ba-432a-8f26-25625f96fcd0 (width 0.15875)
   (from (junction d8a51593-25b1-4cd1-ae49-806e6cb63f0c))
   (to (junction 19a64d41-f337-4b26-8712-0406fe48dbe3))
  )
  (line a242ad93-a00b-4ce1-a125-e6ea98837f47 (width 0.15875)
   (from (junction d30f6a61-23ca-46ed-9726-6fae52bc84f9))
   (to (junction d8a51593-25b1-4cd1-ae49-806e6cb63f0c))
  )
  (line d06fb0bc-f5bc-4c68-b9d2-2026773054c9 (width 0.15875)
   (from (junction d8a51593-25b1-4cd1-ae49-806e6cb63f0c))
   (to (junction 52b9282d-5a6e-4aa4-8f61-a2db60ac64e8))
  )
 )
 (netsegment c4128af5-9f91-4a26-af64-5c12fb7fce8f
  (net 0187ee96-540e-41a0-ae7e-765b7c87bf93)
  (junction d193961e-622c-4cb2-862a-b57fcbcb2195 (position 72.5 -35.0))
  (junction ddd2f9ab-79bb-4adb-93de-caeb5add995d (position 72.5 -22.5))
  (line 41199333-8116-438f-b1a5-9aab7ec91fb6 (width 0.15875)
   (from (junction ddd2f9ab-79bb-4adb-93de-caeb5add995d))
   (to (junction d193961e-622c-4cb2-862a-b57fcbcb2195))
  )
 )
)

I can not reproduce this problem, it works properly if both the symbol and the schematic use 2.5mm grid.

So far I see only two possible reasons if the pins are not connected:

  • The symbol pins are not exactly on 2.5mm grid (did you check the coordinates in the symbol.lp file?)
  • The schematic wires were drawn first, and then the symbol was placed over the lines. This is not supported yet - lines can only be connected to symbol pins with the “Draw Wire” tool, not by dragging lines or symbols around.

There is a library/sym/d908a730-b796-4223-b455-d4134397bddb/symbol.lp file:

(librepcb_symbol d908a730-b796-4223-b455-d4134397bddb
 (name "Resistor")
 (description "")
 (keywords "")
 (author "Lant")
 (version "0.1")
 (created 2020-09-15T21:48:48Z)
 (deprecated false)
 (pin f32027a6-1210-4914-82ec-604c34a101f3 (name "1")
  (position -5.0 0.0) (rotation 0.0) (length 2.5)
 )
 (pin 9251f236-a05f-43e1-9ce5-8d7e43e2f3d3 (name "2")
  (position 5.0 0.0) (rotation 180.0) (length 2.5)
 )
 (polygon 8c513517-4035-46b2-a753-3358f453e297 (layer sym_outlines)
  (width 0.2) (fill false) (grab_area false)
  (vertex (position -3.0 -1.0) (angle 0.0))
  (vertex (position 3.0 -1.0) (angle 0.0))
  (vertex (position 3.0 1.0) (angle 0.0))
  (vertex (position -3.0 1.0) (angle 0.0))
  (vertex (position -3.0 -1.0) (angle 0.0))
 )
)

Whats about second reason - I can’t connect new wire to this exists resistor. Wire does not connecting to pin

Maybe there is a old beaded bug - “Off-the-grid pins cannot be connected”? It’s understood that f*king 5.08mm grid instead 5.00 as I use in symbol and schematic editors? And if pins does not aligned to 5.08mm grid, then they does not connecting?

This bug opened two years ago, and now it’s no progress, probably…

https://github.com/LibrePCB/LibrePCB/issues/371

Strange… are you using LibrePCB 0.1.5?

This bug is not the problem - LibrePCB does allow a grid of 2.50mm, everything should work properly as long as the symbol pins are located exactly on the schematic grid. It doesn’t matter if the grid is 2.54mm, 2.50mm or any other value. And in my quick test, it did work properly, as expected.

The bug is only related to symbol pins which are not located exactly on the grid, in this case no connections can be made.