feat: modified default field keys **BREAKING**

This commit is contained in:
Benny Megidish
2024-12-05 11:06:50 +02:00
parent 9c4d801d8c
commit 762794e025
2 changed files with 44 additions and 30 deletions
+31 -19
View File
@@ -58,8 +58,8 @@ Add an 'LCSC Part #'* field with the LCSC component part number to the symbol's
_The fields will be query in the order denoted above._
#### Fallback Fields*:
| 'JLC Part' | 'LCSC Part' | 'LCSC' | 'JLC' | 'MPN' | 'Mpn' | 'mpn' |
| --- | --- | --- | --- | --- | --- | --- |
| 'LCSC' | 'JLC' | 'MPN' | 'Mpn' | 'mpn' |
| --- | --- | --- | --- | --- |
_The fields will be query in the order denoted above._
@@ -77,7 +77,7 @@ Select 'Exclude from position files' or 'Exclude from BOM' in the footprint's fa
---
### ③ Offset Component Rotation
The rotation of components in KiCad Footprints does not always match the orientation in the JLC library because KiCad and JLC PCB used different variation of the same standard. Most of the rotations may be corrected by the `rotations.cf` definitions. To the exception cases: add an 'JLCPCB Rotation Offset' field - with positive values indicating counter-clockwise orientation offset in degrees.
The rotation of components in KiCad Footprints does not always match the orientation in the JLC library because KiCad and JLC PCB used different variation of the same standard. Most of the rotations may be corrected by the `rotations.cf` definitions. To the exception cases: add an 'FT Rotation Offset'* field - with positive values indicating counter-clockwise orientation offset in degrees.
<img src="https://github.com/bennymeg/JLC-Plugin-for-KiCad/blob/master/assets/rotation-jlc.png?raw=true" height=164>
@@ -88,13 +88,13 @@ If the JLC preview shows a footprint like this, enter a rotation offset of -90 t
As the rotation offset is entered in the Schematic Editor, make sure to update your PCB with the changes made to the schematic before generating a new set of production files, otherwise your changes won't be reflected.
#### Primary Fields*:
| 'JLCPCB Rotation Offset' |
| 'FT Rotation Offset' |
| --- |
_The fields will be queried in the order denoted above._
#### Fallback Fields*:
| 'JlcRotOffset' | 'JLCRotOffset' |
| 'Rotation Offset' | 'RotOffset' |
| --- | --- |
_The fields will be queried in the order denoted above._
@@ -102,17 +102,17 @@ _The fields will be queried in the order denoted above._
---
### ④ Offset Component Position
The position of components in KiCad Footprints does not always match the orientation in the JLC library because KiCad and JLCPCB used different variation of the same standard. To the exception cases: add an 'JLCPCB Position Offset' field with an comma separated x,y position offset to correct it.
The position of components in KiCad Footprints does not always match the orientation in the JLC library because KiCad and JLCPCB used different variation of the same standard. To the exception cases: add an 'FT Position Offset'* field with an comma separated x,y position offset to correct it.
Use following table to quickly find out to which coordinate enter the correction based on JLC arrows clicks - depending on footprint rotation in KiCad PCB Editor status bar:
|KiCad footprint deg | x | y|
|----|----|----|
|0deg, Front | right arrow | up arrow |
|0deg, Back | left arrow | down arrow |
|180deg, Front | left arrow | down arrow |
|180deg, Back | right arrow | up arrow |
|90deg, Front or Back | up arrow | left arrow |
|-90deg, Front or Back | down arrow | right arrow |
|0 deg, Front | right arrow | up arrow |
|0 deg, Back | left arrow | down arrow |
|180 deg, Front | left arrow | down arrow |
|180 deg, Back | right arrow | up arrow |
|90 deg, Front or Back | up arrow | left arrow |
|-90 deg, Front or Back | down arrow | right arrow |
For custom angles it's best to place also a temporary straight symbol to perform alignment.
Single arrow press in JLC is 0.0635mm (= 1/400in) shift.
@@ -122,19 +122,29 @@ Single arrow press in JLC is 0.0635mm (= 1/400in) shift.
As the position offset is entered in the Schematic Editor, make sure to update your PCB with the changes made to the schematic before generating a new set of production files, otherwise your changes won't be reflected.
#### Primary Fields*:
| 'JLCPCB Position Offset' |
| 'FT Position Offset' |
| --- |
_The fields will be queried in the order denoted above._
#### Fallback Fields*:
| 'JlcPosOffset' | 'JLCPosOffset' |
| 'Position Offset' | 'PosOffset' |
| --- | --- |
_The fields will be queried in the order denoted above._
### ⑤ Override Component Origin
The Fabrication Toolkit reports the position of each component based on an automatically selected point of reference. This default behavior can be overridden by adding an **Origin** field to the component.
The Fabrication Toolkit reports the position of each component based on an automatically selected point of reference. This default behavior can be overridden by adding an 'FT Origin'* field to the component.
#### Primary Fields*:
| 'FT Origin' |
| --- |
_The fields will be queried in the order denoted above._
#### Fallback Fields*:
| 'Origin' |
| --- |
The **Origin** field supports the following values:
@@ -142,18 +152,20 @@ The **Origin** field supports the following values:
- `Center` - Uses the center of the bounding box formed by the footprint's pads.
### ⑥ Override Component Layer
Some footprints may have their components defined on the opposite layer to there actual footprints. In these instances you can override mount side by using this field.
Some footprints may have their components defined on the opposite layer to there actual footprints. In these instances you can override mount side by adding an 'FT Layer Override'* field to the component.
Values can be `top`, `bottom`, `t` or `b`.
The **Layer Override** field supports the following values:
- `top`, `t` - Override footprint layer to the top.
- `bottom`, `b` - Override footprint layer to the bottom.
#### Primary Fields*:
| 'JLCPCB Layer Override' |
| 'FT Layer Override' |
| --- |
_The fields will be queried in the order denoted above._
#### Fallback Fields*:
| 'JlcLayerOverride' | 'JLCLayerOverride' |
| 'Layer Override' | 'LayerOverride' |
| --- | --- |
_The fields will be queried in the order denoted above._
+13 -11
View File
@@ -160,7 +160,7 @@ class ProcessManager:
except AttributeError:
footprint_name = str(footprint.GetFPID().GetLibItemName())
layer = self._get_top_or_bottom_side_override_from_footprint(footprint)
layer = self._get_layer_override_from_footprint(footprint)
# mount_type = {
# 0: 'smt',
@@ -403,7 +403,7 @@ class ProcessManager:
def _get_mpn_from_footprint(self, footprint) -> str:
''''Get the MPN/LCSC stock code from standard symbol fields.'''
keys = ['LCSC Part #', 'JLCPCB Part #']
fallback_keys = ['LCSC Part', 'JLC Part', 'LCSC', 'JLC', 'MPN', 'Mpn', 'mpn']
fallback_keys = ['LCSC', 'JLC', 'MPN', 'Mpn', 'mpn']
if footprint_has_field(footprint, 'dnp'):
return 'DNP'
@@ -412,9 +412,10 @@ class ProcessManager:
if footprint_has_field(footprint, key):
return footprint_get_field(footprint, key)
def _get_top_or_bottom_side_override_from_footprint(self, footprint) -> str:
keys = ['JLCPCB Layer Override']
fallback_keys = ['JlcLayerOverride', 'JLCLayerOverride']
def _get_layer_override_from_footprint(self, footprint) -> str:
'''Get the layer override from standard symbol fields.'''
keys = ['FT Layer Override']
fallback_keys = ['Layer Override', 'LayerOverride']
layer = {
pcbnew.F_Cu: 'top',
@@ -434,9 +435,9 @@ class ProcessManager:
return layer
def _get_rotation_offset_from_footprint(self, footprint) -> float:
'''Get the rotation from standard symbol fields.'''
keys = ['JLCPCB Rotation Offset']
fallback_keys = ['JlcRotOffset', 'JLCRotOffset']
'''Get the rotation offset from standard symbol fields.'''
keys = ['FT Rotation Offset']
fallback_keys = ['Rotation Offset', 'RotOffset']
offset = ""
@@ -454,8 +455,9 @@ class ProcessManager:
raise RuntimeError("Rotation offset of {} is not a valid number".format(footprint.GetReference()))
def _get_position_offset_from_footprint(self, footprint) -> Tuple[float, float]:
keys = ['JLCPCB Position Offset']
fallback_keys = ['JlcPosOffset', 'JLCPosOffset']
'''Get the position offset from standard symbol fields.'''
keys = ['FT Position Offset']
fallback_keys = ['Position Offset', 'PosOffset']
offset = ""
@@ -474,7 +476,7 @@ class ProcessManager:
raise RuntimeError("Position offset of {} is not a valid pair of numbers".format(footprint.GetReference()))
def _get_origin_from_footprint(self, footprint) -> float:
'''Get the rotation from standard symbol fields.'''
'''Get the origin from standard symbol fields.'''
keys = ['FT Origin']
fallback_keys = ['Origin']