Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feature/pcb_exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
iopapamanoglou committed Sep 11, 2024
2 parents 44ef7e6 + 627b654 commit a6ecf51
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pre-commit

on:
pull_request:
branches:
- '**'

jobs:
run-pre-commit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files

- name: Fail on diff after pre-commit is run
run: git diff --exit-code
2 changes: 1 addition & 1 deletion src/faebryk/core/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def setup_field(name, obj):
raise FieldConstructionError(
self,
name,
f"An exception occurred while constructing field \"{name}\"",
f'An exception occurred while constructing field "{name}"',
) from e

nonrt, rt = partition(lambda x: isinstance(x[1], rt_field), clsfields.items())
Expand Down
11 changes: 10 additions & 1 deletion src/faebryk/exporters/pcb/layout/extrude.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class LayoutExtrude(Layout):
(0, 0, 0, F.has_pcb_position.layer_type.NONE)
)
dynamic_rotation: bool = False
reverse_order: bool = False

def apply(self, *node: Node):
"""
Expand All @@ -40,7 +41,15 @@ def apply(self, *node: Node):

vector = self.vector if len(self.vector) == 3 else (*self.vector, 0)

for i, n in enumerate(node):
for i, n in enumerate(
sorted(
node,
key=lambda n: n.get_trait(F.has_designator).get_designator()
if n.has_trait(F.has_designator)
else n.get_full_name(),
reverse=self.reverse_order,
)
):
vec_i = (
vector[0] * i,
vector[1] * i,
Expand Down

0 comments on commit a6ecf51

Please sign in to comment.