From c5c19e0d9fcc26768bb0848a8f92eda551deaabc Mon Sep 17 00:00:00 2001 From: ruben-iteng <94007802+ruben-iteng@users.noreply.github.com> Date: Mon, 9 Sep 2024 22:27:51 +0200 Subject: [PATCH] Add: reverse order option --- src/faebryk/exporters/pcb/layout/extrude.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/faebryk/exporters/pcb/layout/extrude.py b/src/faebryk/exporters/pcb/layout/extrude.py index 2e7aba92..c0a224c4 100644 --- a/src/faebryk/exporters/pcb/layout/extrude.py +++ b/src/faebryk/exporters/pcb/layout/extrude.py @@ -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): """ @@ -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,