[BoardView][Fixed] X axis mirroring issues

See whitequark/kicad-boardview#11
This commit is contained in:
Salvador E. Tropea 2024-03-05 08:00:13 -03:00
parent 2a0596e3fc
commit 5bbb18d2c0
6 changed files with 296 additions and 294 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(#578)
- Filters: _none filter not always honored (i.e. exclude in BoM) (#580)
- PCB Parity: components excluded from the board reported anyways (#585)
- BoardView: X axis mirroring issues (whitequark/kicad-boardview#11)
## [1.6.4] - 2024-02-02
### Added

View File

@ -31,11 +31,9 @@ def coord(nanometers):
return milliinches
def y_coord(obj, maxy, y):
if obj.IsFlipped():
return coord(y)
else:
return coord(maxy - y)
def y_coord(maxy, y, flipped):
# Adjust y-coordinate to start from the bottom of the board and account for flipped components
return coord(maxy - y) if not flipped else coord(y)
def pad_sort_key(pad):
@ -70,11 +68,11 @@ def convert(pcb, brd):
for point in outline_points:
brd.write("{x} {y}\n"
.format(x=coord(point.x),
y=coord(point.y)))
y=y_coord(outline_maxy, point.y, False)))
if outline.IsClosed():
brd.write("{x} {y}\n"
.format(x=coord(outline_points[0].x),
y=coord(outline_points[0].y)))
y=y_coord(outline_maxy, outline_points[0].y, False)))
brd.write("\n")
# Nets
@ -101,14 +99,15 @@ def convert(pcb, brd):
pin_at = 0
for module in modules:
module_bbox = module.GetBoundingBox()
flipped = module.IsFlipped()
brd.write("{ref} {x1} {y1} {x2} {y2} {pin} {side}\n"
.format(ref=module.GetReference(),
x1=coord(module_bbox.GetLeft()),
y1=y_coord(module, outline_maxy, module_bbox.GetTop()),
y1=y_coord(outline_maxy, module_bbox.GetTop(), flipped),
x2=coord(module_bbox.GetRight()),
y2=y_coord(module, outline_maxy, module_bbox.GetBottom()),
y2=y_coord(outline_maxy, module_bbox.GetBottom(), flipped),
pin=pin_at,
side=1 + module.IsFlipped()))
side=1 + flipped))
pin_at += module.GetPadCount()
brd.write("\n")
@ -122,11 +121,12 @@ def convert(pcb, brd):
brd.write("PINS: {count}\n".format(count=len(pads)))
for pad in pads:
pad_pos = pad.GetPosition()
flipped = pad.IsFlipped()
brd.write("{x} {y} {net} {side}\n"
.format(x=coord(pad_pos.x),
y=y_coord(pad, outline_maxy, pad_pos.y),
y=y_coord(outline_maxy, pad_pos.y, flipped),
net=pad.GetNetCode(),
side=1 + pad.IsFlipped()))
side=1 + flipped))
brd.write("\n")
# Nails
@ -141,12 +141,13 @@ def convert(pcb, brd):
brd.write("NAILS: {count}\n".format(count=len(testpoints)))
for module, pad in testpoints:
pad_pos = pad.GetPosition()
flipped = pad.IsFlipped()
brd.write("{probe} {x} {y} {net} {side}\n"
.format(probe=module.GetReference()[2:],
x=coord(pad_pos.x),
y=y_coord(pad, outline_maxy, pad_pos.y),
y=y_coord(outline_maxy, pad_pos.y, flipped),
net=pad.GetNetCode(),
side=1 + pad.IsFlipped()))
side=1 + flipped))
brd.write("\n")

View File

@ -1,74 +1,74 @@
0
BRDOUT: 69 5118 4724
4976 2796
4991 2798
5006 2802
5020 2807
5034 2813
5048 2821
5060 2831
5071 2841
5082 2852
5091 2865
5099 2878
5106 2892
5111 2907
5115 2922
5117 2937
5118 2952
5118 4566
5117 4582
5115 4597
5111 4612
5106 4627
5099 4641
5091 4654
5082 4666
5071 4678
5060 4688
5048 4697
5034 4705
5020 4712
5006 4717
4991 4721
4976 4723
4960 4724
2125 4724
2110 4723
2095 4721
2080 4717
2065 4712
2051 4705
2038 4697
2026 4688
2014 4678
2004 4666
1995 4654
1987 4641
1980 4627
1975 4612
1971 4597
1969 4582
1968 4566
1968 2952
1969 2937
1971 2922
1975 2907
1980 2892
1987 2878
1995 2865
2004 2852
2014 2841
2026 2831
2038 2821
2051 2813
2065 2807
2080 2802
2095 2798
2110 2796
2125 2795
4960 2795
4976 2796
4976 1928
4991 1926
5006 1922
5020 1917
5034 1910
5048 1902
5060 1893
5071 1883
5082 1871
5091 1859
5099 1845
5106 1831
5111 1817
5115 1802
5117 1787
5118 1771
5118 157
5117 142
5115 126
5111 111
5106 97
5099 83
5091 69
5082 57
5071 46
5060 35
5048 26
5034 18
5020 11
5006 6
4991 3
4976 0
4960 0
2125 0
2110 0
2095 3
2080 6
2065 11
2051 18
2038 26
2026 35
2014 46
2004 57
1995 69
1987 83
1980 97
1975 111
1971 126
1969 142
1968 157
1968 1771
1969 1787
1971 1802
1975 1817
1980 1831
1987 1845
1995 1859
2004 1871
2014 1883
2026 1893
2038 1902
2051 1910
2065 1917
2080 1922
2095 1926
2110 1928
2125 1929
4960 1929
4976 1928
NETS: 227
1 /SDA

View File

@ -1,74 +1,74 @@
0
BRDOUT: 69 5118 4724
4976 2796
4991 2798
5006 2802
5020 2807
5034 2813
5048 2821
5060 2831
5071 2841
5082 2852
5091 2865
5099 2878
5106 2892
5111 2907
5115 2922
5117 2937
5118 2952
5118 4566
5117 4582
5115 4597
5111 4612
5106 4627
5099 4641
5091 4654
5082 4666
5071 4678
5060 4688
5048 4697
5034 4705
5020 4712
5006 4717
4991 4721
4976 4723
4960 4724
2125 4724
2110 4723
2095 4721
2080 4717
2065 4712
2051 4705
2038 4697
2026 4688
2014 4678
2004 4666
1995 4654
1987 4641
1980 4627
1975 4612
1971 4597
1969 4582
1968 4566
1968 2952
1969 2937
1971 2922
1975 2907
1980 2892
1987 2878
1995 2865
2004 2852
2014 2841
2026 2831
2038 2821
2051 2813
2065 2807
2080 2802
2095 2798
2110 2796
2125 2795
4960 2795
4976 2796
4976 1928
4991 1926
5006 1922
5020 1917
5034 1910
5048 1902
5060 1893
5071 1883
5082 1871
5091 1859
5099 1845
5106 1831
5111 1817
5115 1802
5117 1787
5118 1771
5118 157
5117 142
5115 126
5111 111
5106 97
5099 83
5091 69
5082 57
5071 46
5060 35
5048 26
5034 18
5020 11
5006 6
4991 3
4976 0
4960 0
2125 0
2110 0
2095 3
2080 6
2065 11
2051 18
2038 26
2026 35
2014 46
2004 57
1995 69
1987 83
1980 97
1975 111
1971 126
1969 142
1968 157
1968 1771
1969 1787
1971 1802
1975 1817
1980 1831
1987 1845
1995 1859
2004 1871
2014 1883
2026 1893
2038 1902
2051 1910
2065 1917
2080 1922
2095 1926
2110 1928
2125 1929
4960 1929
4976 1928
NETS: 227
1 /SDA

View File

@ -1,74 +1,74 @@
0
BRDOUT: 69 5118 4724
4976 2796
4991 2798
5006 2802
5020 2807
5034 2813
5048 2821
5060 2831
5071 2841
5082 2852
5091 2865
5099 2878
5106 2892
5111 2907
5115 2922
5117 2937
5118 2952
5118 4566
5117 4582
5115 4597
5111 4612
5106 4627
5099 4641
5091 4654
5082 4666
5071 4678
5060 4688
5048 4697
5034 4705
5020 4712
5006 4717
4991 4721
4976 4723
4960 4724
2125 4724
2110 4723
2095 4721
2080 4717
2065 4712
2051 4705
2038 4697
2026 4688
2014 4678
2004 4666
1995 4654
1987 4641
1980 4627
1975 4612
1971 4597
1969 4582
1968 4566
1968 2952
1969 2937
1971 2922
1975 2907
1980 2892
1987 2878
1995 2865
2004 2852
2014 2841
2026 2831
2038 2821
2051 2813
2065 2807
2080 2802
2095 2798
2110 2796
2125 2795
4960 2795
4976 2796
4976 1928
4991 1926
5006 1922
5020 1917
5034 1910
5048 1902
5060 1893
5071 1883
5082 1871
5091 1859
5099 1845
5106 1831
5111 1817
5115 1802
5117 1787
5118 1771
5118 157
5117 142
5115 126
5111 111
5106 97
5099 83
5091 69
5082 57
5071 46
5060 35
5048 26
5034 18
5020 11
5006 6
4991 3
4976 0
4960 0
2125 0
2110 0
2095 3
2080 6
2065 11
2051 18
2038 26
2026 35
2014 46
2004 57
1995 69
1987 83
1980 97
1975 111
1971 126
1969 142
1968 157
1968 1771
1969 1787
1971 1802
1975 1817
1980 1831
1987 1845
1995 1859
2004 1871
2014 1883
2026 1893
2038 1902
2051 1910
2065 1917
2080 1922
2095 1926
2110 1928
2125 1929
4960 1929
4976 1928
NETS: 227
1 /SDA

View File

@ -1,78 +1,78 @@
0
BRDOUT: 73 5118 4724
4968 2795
4983 2796
4998 2799
5013 2804
5028 2810
5041 2817
5054 2826
5066 2836
5077 2846
5087 2858
5095 2871
5103 2885
5108 2899
5113 2914
5116 2929
5118 2945
5118 2952
5118 4566
5118 4574
5116 4590
5113 4605
5108 4620
5103 4634
5095 4647
5087 4660
5077 4672
5066 4683
5054 4693
5041 4702
5028 4709
5013 4715
4998 4719
4983 4722
4968 4724
4960 4724
2125 4724
2118 4724
2102 4722
2087 4719
2072 4715
2058 4709
2044 4702
2032 4693
2020 4683
2009 4672
1999 4660
1990 4647
1983 4634
1977 4620
1973 4605
1970 4590
1968 4574
1968 4566
1968 2952
1968 2945
1970 2929
1973 2914
1977 2899
1983 2885
1990 2871
1999 2858
2009 2846
2020 2836
2032 2826
2044 2817
2058 2810
2072 2804
2087 2799
2102 2796
2118 2795
2125 2795
4960 2795
4968 2795
4968 1929
4983 1927
4998 1924
5013 1920
5028 1914
5041 1906
5054 1898
5066 1888
5077 1877
5087 1865
5095 1852
5103 1839
5108 1824
5113 1809
5116 1794
5118 1779
5118 1771
5118 157
5118 149
5116 134
5113 119
5108 104
5103 90
5095 76
5087 63
5077 51
5066 40
5054 30
5041 22
5028 15
5013 9
4998 4
4983 1
4968 0
4960 0
2125 0
2118 0
2102 1
2087 4
2072 9
2058 15
2044 22
2032 30
2020 40
2009 51
1999 63
1990 76
1983 90
1977 104
1973 119
1970 134
1968 149
1968 157
1968 1771
1968 1779
1970 1794
1973 1809
1977 1824
1983 1839
1990 1852
1999 1865
2009 1877
2020 1888
2032 1898
2044 1906
2058 1914
2072 1920
2087 1924
2102 1927
2118 1929
2125 1929
4960 1929
4968 1929
NETS: 227
1 /SDA