[Position][Added] quote_all option
- To quote all columns in the CSV output Closes #456
This commit is contained in:
parent
c5c1fc5c63
commit
7e6154d9e9
|
|
@ -62,6 +62,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `skip_not_run`: used to skip outputs not generated in default runs.
|
||||
- Compress:
|
||||
- `skip_not_run`: used to skip outputs not generated in default runs.
|
||||
- Position:
|
||||
- `quote_all`: forces quotes to all values in the CSV output. (See #456)
|
||||
|
||||
### Changed
|
||||
- Command line:
|
||||
|
|
|
|||
|
|
@ -4233,6 +4233,7 @@ Notes:
|
|||
For KiCad 6+ we replace this concept by the option to exclude from position file.
|
||||
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
A short-cut to use for simple cases where a variant is an overkill.
|
||||
- `quote_all`: [boolean=false] When generating the CSV quote all values, even numbers.
|
||||
- `right_digits`: [number=4] number of digits for mantissa part of coordinates (0 is auto).
|
||||
- `use_aux_axis_as_origin`: [boolean=true] Use the auxiliary axis as origin for coordinates (KiCad default).
|
||||
- `variant`: [string=''] Board variant to apply.
|
||||
|
|
|
|||
|
|
@ -2729,6 +2729,8 @@ outputs:
|
|||
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||
# A short-cut to use for simple cases where a variant is an overkill
|
||||
pre_transform: '_none'
|
||||
# [boolean=false] When generating the CSV quote all values, even numbers
|
||||
quote_all: false
|
||||
# [number=4] number of digits for mantissa part of coordinates (0 is auto)
|
||||
right_digits: 4
|
||||
# [boolean=true] Generate two separated files, one for the top and another for the bottom
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class PositionOptions(VariantOptions):
|
|||
""" Include virtual components. For special purposes, not pick & place.
|
||||
Note that virtual components is a KiCad 5 concept.
|
||||
For KiCad 6+ we replace this concept by the option to exclude from position file """
|
||||
self.quote_all = False
|
||||
""" When generating the CSV quote all values, even numbers """
|
||||
super().__init__()
|
||||
self._expand_id = 'position'
|
||||
|
||||
|
|
@ -234,6 +236,7 @@ class PositionOptions(VariantOptions):
|
|||
modules_side = []
|
||||
is_pure_smd, is_not_virtual = self.get_attr_tests()
|
||||
quote_char = '"' if self.format == 'CSV' else ''
|
||||
quote_char_extra = quote_char if self.quote_all else ''
|
||||
x_origin = 0.0
|
||||
y_origin = 0.0
|
||||
if self.use_aux_axis_as_origin:
|
||||
|
|
@ -285,13 +288,14 @@ class PositionOptions(VariantOptions):
|
|||
pos_x = (center_x - x_origin) * conv
|
||||
if self.bottom_negative_x and is_bottom:
|
||||
pos_x = -pos_x
|
||||
row.append(float_format.format(pos_x, rd=self.right_digits))
|
||||
row.append(quote_char_extra+float_format.format(pos_x, rd=self.right_digits)+quote_char_extra)
|
||||
elif k == 'PosY':
|
||||
row.append(float_format.format(-(center_y - y_origin) * conv, rd=self.right_digits))
|
||||
row.append(quote_char_extra+float_format.format(-(center_y - y_origin) * conv, rd=self.right_digits) +
|
||||
quote_char_extra)
|
||||
elif k == 'Rot':
|
||||
row.append(float_format.format(rotation, rd=self.right_digits))
|
||||
row.append(quote_char_extra+float_format.format(rotation, rd=self.right_digits)+quote_char_extra)
|
||||
elif k == 'Side':
|
||||
row.append("bottom" if is_bottom else "top")
|
||||
row.append(quote_char_extra+("bottom" if is_bottom else "top")+quote_char_extra)
|
||||
modules.append(row)
|
||||
modules_side.append(is_bottom)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue