KiCad / kicad-library-utils

Some scripts for helping with library development
GNU General Public License v3.0
128 stars 95 forks source link

schlib.py - Components don't remove successfully #315

Open rs-development opened 4 years ago

rs-development commented 4 years ago

I tried to create an empty library from a existing one be removing all components. I did this in a loop:

for c in lib_new.components: 
     print(lib_new.removeComponent(c.name))

But i had to run the loop multiple times to remove all components, untill no components are in the list and getComponentCount equals zero.

If the library is saved with new_lib.save() the components are still there.

Any idea whats going wrong?

rs-development commented 4 years ago

It seems to be, that the new_lib.header has to be cleared. But then the first 2 file lines are missing after saving:

EESchema-LIBRARY Version 2.4
#encoding utf-8

Those 2 lines are not generated if the header is cleared and the library is than saved. Shouldn't the schlib.py handle those things internally?