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

Commit

Permalink
Add: reverse order option
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben-iteng committed Sep 9, 2024
1 parent 5644350 commit c5c19e0
Showing 1 changed file with 10 additions and 1 deletion.
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 c5c19e0

Please sign in to comment.