Skip to content

Commit

Permalink
Fix multi-line symbol names (#19)
Browse files Browse the repository at this point in the history
symbols exported by easyeda2kicad have multi-line footprint lines that look like this:

(property
  "Footprint"
  "part:SOIC-14_L8.7-W3.9-P1.27-LS6.0-BL"
  (id 2)
  (at 0 -15.24 0)
  (effects (font (size 1.27 1.27) ) hide)
)

This commit relaxes the regex to support multi-line matches

Signed-off-by: Eric Wheeler <[email protected]>
Co-authored-by: Eric Wheeler <[email protected]>
  • Loading branch information
KJ7LNW and Eric Wheeler authored Jul 11, 2024
1 parent 96735a5 commit 792ec67
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/KiCadImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,16 @@ def extract_symbol_section(input_text):
return symbol_section, start_index, end_index

def extract_footprint_name(string):
pattern = r'\(property "Footprint" "(.*?)"'
match = re.search(pattern, string)
pattern = r'\(property\s+"Footprint"\s+"(.*?)"'
match = re.search(pattern, string, re.MULTILINE)
if match:
original_name = match.group(1)
name = self.cleanName(original_name)
modified_string = re.sub(
pattern,
f'(property "Footprint" "{remote_type.name}:{name}"',
string,
flags=re.MULTILINE
)
return name, modified_string
else:
Expand Down

0 comments on commit 792ec67

Please sign in to comment.