Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for NPTH slots #1071

Merged
merged 6 commits into from
Dec 17, 2022
Merged

Add support for NPTH slots #1071

merged 6 commits into from
Dec 17, 2022

Conversation

ubruhin
Copy link
Member

@ubruhin ubruhin commented Dec 10, 2022

Summary

Replaces #510. But instead of specifying slots with just a width and height property (as originally intended by a DrillSize class), I decided to make slots even more flexible. Since the Excellon file format supports creating arbitrary slots by movement commands (G00..G03), let's reflect that flexibility in LibrePCB as well.

File Format

So far, a hole object was stored this way:

(hole 4ab2be01-222a-4f59-b239-e1de803ba96d (diameter 3.0) (position 2.54 2.54))

Now a hole is specified by vertices (exactly the same way as for polygons):

(hole 4ab2be01-222a-4f59-b239-e1de803ba96d (diameter 3.0)
 (vertex (position 2.54 2.54) (angle 0.0))
)

Holes with only one vertex are circular. Holes with multiple vertices are slots. They can even be curved (angle != 0):

(hole 4ab2be01-222a-4f59-b239-e1de803ba96d (diameter 1.6)
 (vertex (position 20.691974 1.641974) (angle 90.0))
 (vertex (position 22.0 3.438026) (angle 0.0))
 (vertex (position 23.0 5.0) (angle -90.0))
 (vertex (position 24.0 8.0) (angle 0.0))
)

User Interface

The hole properties dialog allows to specify holes either as circular drills, simple linear slots, or arbitrary slots:

librepcb-npth-slots

The editors do not yet contain a tool to draw slots. Currently you can just add circular holes and and then convert them to slots by modifying their properties. A slot tool could be added later without needing any file format change.

Excellon Export

By default, slotted holes are exported with commands G00..G03 in the Excellon drill file. This seems to be the recommended way (KiCad doesn't recommend G85 and the XNC Specs from Ucamco doesn't even mention G85; see also #510 (comment)).

However, there might be manufacturers which require slots exported as G85 slot commands. Even Gerbv does only render G85 correctly, but not G00..G03 which is quite a shame. Therefore I made it configurable which command to use:

image

Since G85 cannot draw arcs, it can be used only for boards which do not contain curved slots. If there are curved slots, an error occurs during the export.

DRC

The support of curved slots unfortunately varies between different PCB manufacturers. Multi-segment slots maybe too, I'm not sure. And whether G85 shall be used or not, also depends on the manufacturer. To avoid surprises during production, I added a new DRC rule which allows to warn if slots of a particular style are used in a board:

image

Fixes #505.

@ubruhin ubruhin added enhancement file format Issues affecting the file format export Issues related to any data export tool-board-editor tool-library-editor labels Dec 10, 2022
@ubruhin ubruhin added this to the 0.2.0 milestone Dec 10, 2022
@ubruhin ubruhin self-assigned this Dec 10, 2022
@ubruhin ubruhin force-pushed the slotted-drills branch 2 times, most recently from c79ba81 to bc38eac Compare December 10, 2022 15:27
@dbrgn
Copy link
Member

dbrgn commented Dec 10, 2022

Awesome, very thought-out PR! I like all the design decisions.

@dbrgn dbrgn mentioned this pull request Dec 10, 2022
@ubruhin
Copy link
Member Author

ubruhin commented Dec 11, 2022

Added one more thing: Since manufacturers usually cannot create slots as small as drills, I have now changed the design rule parameter "Minimum NPTH Drill Diameter" to check only circular drills, and added a new rule "Minimum NPTH Slot Width" which checks only slots. Now one can configure different minimums for drills and slots, as specified by the PCB manufacturers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement export Issues related to any data export file format Issues affecting the file format tool-board-editor tool-library-editor
Development

Successfully merging this pull request may close these issues.

Add support for slotted NPTH
2 participants