fix https://github.com/rusefi/alphax-8chan/issues/35 tle9201 not rendered on ibom [now not selectable by mouse cursor for some reason]

This commit is contained in:
andreika-git 2023-02-13 16:26:18 +02:00
parent 2b6dc870dd
commit fc8ab15823
1 changed files with 8 additions and 4 deletions

View File

@ -183,7 +183,7 @@ def updateBbox(bbox, padXY, padWH):
def readFootprint(fpname, footprintsPath, des):
if not fpname:
return None
pat_module = re.compile(r'\((module|footprint)\s+\"?([\w\-\.\:]+)\"?\s+\(layer\s+\"?([FB])')
pat_module = re.compile(r'\s*\((module|footprint)\s+\"?([\w\-\.\:]+)\"?\s+(\(version[^\)]*\))?\s*(\(generator[^\)]*\))?\s*\(layer\s+\"?([FB])')
pat_pad = re.compile(r'^\s*\(pad\s+\"?([0-9A-Z]+)\"?\s+(\w+)\s+(\w+)\s+\(at\s+([+\-0-9e\.]+)\s+([+\-0-9e\.]+)\s*([+\-0-9\.]+)?\)\s+\(size\s+([+\-0-9\.]+)\s+([+\-0-9\.]+)\)(\s*\(drill\s+([+\-0-9\.]+)\))?\s+\(layer[s]?\s+\"?([^\)]+)\)(\s*\(roundrect_rratio\s+([+\-0-9\.]+)\))?')
fpFileName = footprintsPath + "/" + fpname + ".kicad_mod"
@ -195,10 +195,14 @@ def readFootprint(fpname, footprintsPath, des):
json = {"drawings": [], "pads": []}
bbox = [[ 9999.0, 9999.0 ], [ -9999.0, -9999.0 ]]
with open(fpFileName, 'rt') as f:
# module definition can be multiline
allFile = f.read()
f.seek(0)
module = pat_module.match(allFile)
if module:
json["layer"] = module.group(5)
# pad definitions are single-line
for line in f:
module = pat_module.match(line)
if module:
json["layer"] = module.group(3)
pad = pat_pad.match(line)
if pad:
padIdx = pad.group(1)