Get stuff back on grid

Since a lot of my schematics are funky due to this (oh and BTW @Rene_Poschl a similar post worked fine here), I’m wondering if there’s any way to get them back on a coarser grid?

I’m thinking something that would snap all components/wires to the closest grid line. Probably I can script it but would be nice if it already exists.

@maui you do realize that @halachal is asking about the schematic side right?

sorry I didn’t … I’m cleaning my reply

I am not aware of a feature like this in version 5. Also there sadly is no scripting API in eeschema for version 5.

Similar requests also were without resolution (recent example Eschema symbols off-grid, need to "snap all to grid") so i fear it is not easily fixable.

And yes this is a known problem and a solution is worked on (The true solution at least in my opinion is to have snap to objects instead of relying on grids plus maybe dynamic align tools similar to for example adobe indesign. The former for easily connecting wires to your pins and the later to still have nicely aligned symbols such that the schematic looks good overall even without the need for a grid.)

Are you sure? The fact that nobody openly complained about your wording is not an indication that they were ok with it. To be honest the response by wayne at least seems to indicate that he was at least slightly annoyed (it has a certain tone that i never encountered in any of his other responses).

1 Like

Alright then, here’s my quick attempt with Python and regex. Seems to work for me but I have about zero prior knowledge of .sch format so it quite likely could shred your files.

import sys
import re

fn = sys.argv[1]

    GRID = sys.argv[2]
    GRID = 25

def snap(s):
    n = int(
    if n > 100:
        n = round(n / GRID) * GRID
    return str(n)

s = open(fn, 'r').read()

s = re.sub('(?<=[ \t])([0-9]+)(?=[ \t\n])', snap, s)

open(fn, 'w').write(s)
1 Like

Backup your project first

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.