-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi @realthunder
I am trying to parse the hierarchy of Kicad schematics, which is not a direct task. Then I am using your parser to tackle this issue.
I can get data from sheet instances... but sometimes the parser returns things that are not SexpParser objects. Is this correct?. This happens in the extra .kicad_sch files, but not with the main .kicad_sch
<class 'submodules.kicad_parser.sexp_parser.sexp_parser.SexpParser'>
<class 'submodules.kicad_parser.sexp_parser.sexp_parser.SexpParser'>
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
<class 'str'>
Then I am using this try...expect to solve that. But I would like to check with you if this is the correct behavior of kicad_parser.
# (sheet (at 114.3 86.36) (size 36.83 20.32) (fields_autoplaced)
# (stroke (width 0.1524) (type solid) (color 0 0 0 0))
# (fill (color 0 0 0 0.0000))
# (uuid 005b247a-5ac7-4cdf-ac41-9dda744d73ba)
# (property "Sheet name" "Page_2_Instance_2" (id 0) (at 114.3 85.6484 0)
# (effects (font (size 1.27 1.27)) (justify left bottom))
# )
# (property "Sheet file" "sch/page_2.kicad_sch" (id 1) (at 114.3 107.2646 0)
# (effects (font (size 1.27 1.27)) (justify left top))
# )
# )
sch = KicadPCB.load(sch_file_path)
sheet_name = 0
sheet_file = 1
for i, k in enumerate(sch.sheet):
try:
print(i, k['uuid'], k['property'][0][1], k['property'][1][1])
except:
# sometimes it returns strings..
passMy current result to show UUID, Sheet Instance Name, and Sheet Instance File is something like this.
0 0999d842-9bc9-4370-bae4-7c28aeba0392 "A" "sch/a.kicad_sch"
1 6483d8c3-df4d-40b4-b616-c993cba432d4 "A1" "sch/a.kicad_sch"
Metadata
Metadata
Assignees
Labels
No labels