File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,15 @@ def get_extra_field_data(self, file_name):
37
37
@staticmethod
38
38
def get_footprint_fields (f ):
39
39
# type: (pcbnew.FOOTPRINT) -> dict
40
+ props = {}
40
41
if hasattr (f , "GetProperties" ):
41
- return f .GetProperties ()
42
+ props = f .GetProperties ()
42
43
if hasattr (f , "GetFields" ):
43
- return f .GetFieldsShownText ()
44
- return {}
44
+ props = f .GetFieldsShownText ()
45
+ if "dnp" in props and props ["dnp" ] == "" :
46
+ del props ["dnp" ]
47
+ props ["kicad_dnp" ] = True
48
+ return props
45
49
46
50
def parse_extra_data_from_pcb (self ):
47
51
field_set = set ()
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def get_extra_field_data(self):
21
21
fields = None
22
22
datasheet = None
23
23
libsource = None
24
+ dnp = False
24
25
for f in c [1 :]:
25
26
if f [0 ] == 'ref' :
26
27
ref = f [1 ]
@@ -30,6 +31,9 @@ def get_extra_field_data(self):
30
31
datasheet = f [1 ]
31
32
if f [0 ] == 'libsource' :
32
33
libsource = f [1 :]
34
+ if f [0 ] == 'property' and isinstance (f [1 ], list ) and \
35
+ f [1 ][0 ] == 'name' and f [1 ][1 ] == 'dnp' :
36
+ dnp = True
33
37
if ref is None :
34
38
return None
35
39
ref_fields = comp_dict .setdefault (ref , {})
@@ -41,6 +45,9 @@ def get_extra_field_data(self):
41
45
if lib_field [0 ] == 'description' :
42
46
field_set .add ('Description' )
43
47
ref_fields ['Description' ] = lib_field [1 ]
48
+ if dnp :
49
+ field_set .add ('kicad_dnp' )
50
+ ref_fields ['kicad_dnp' ] = True
44
51
if fields is None :
45
52
continue
46
53
for f in fields :
Original file line number Diff line number Diff line change @@ -34,5 +34,9 @@ def get_extra_field_data(self):
34
34
name = f .attributes ['name' ].value
35
35
field_set .add (name )
36
36
ref_fields [name ] = self .get_text (f .childNodes )
37
+ for f in c .getElementsByTagName ('property' ):
38
+ if f .attributes ['name' ].value == 'dnp' :
39
+ field_set .add ('kicad_dnp' )
40
+ ref_fields ['kicad_dnp' ] = True
37
41
38
42
return list (field_set ), comp_dict
You can’t perform that action at this time.
0 commit comments