Skip to content

Commit

Permalink
v1.0.3: parse symbol property in KiCad 7 schematic
Browse files Browse the repository at this point in the history
  • Loading branch information
trung_ho committed May 25, 2023
1 parent be44f22 commit c4bc5cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pcm/metadata_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"versions": [
{
"version": "1.0.2",
"version": "1.0.3",
"status": "stable",
"kicad_version": "6.00"
}
Expand Down
12 changes: 8 additions & 4 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ def to_string(_list):


def parse_property_line(line: str):
# KiCad 6.0
# ' (property "Datasheet" "~" (id 3) (at 44.45 63.5 0)'
# --> name: "Datasheet", value: "~", id: '3'
property_line_regex = re.compile(r'^\s{4}\(property "(.*)" "(.*)" \(id (\d+)\)')
# --> name: "Datasheet", value: "~"

# KiCad 7.0
# ' (property "Reference" "R2" (at 90.17 80.645 0)'
# --> name: "Reference", value: "R2"
property_line_regex = re.compile(r'^\s{4}\(property "(.*)" "(.*)"')
if not property_line_regex.search(line):
return
_name, _value, _property_id = property_line_regex.findall(line)[0]
_name, _value = property_line_regex.findall(line)[0]
return {
'name': _name,
'value': _value,
# 'property_id': _property_id # it almost has no use
}


Expand Down

0 comments on commit c4bc5cc

Please sign in to comment.