library-loader icon indicating copy to clipboard operation
library-loader copied to clipboard

Process KiCad output

Open stif opened this issue 6 years ago • 2 comments

It would be great if you could process the KiCad Output so it is more useful to KiCad Users:

  • Copy *.kicad_mod files into seperate folder
  • *.mod files are not needed for recent KiCad Versions as far as i know
  • concat all *.lib files together
  • concat all *.dcm files together

I wrote a small bash script for the necessary steps, but i dont know how to do it in rust:

#!/bin/bash

LIBRARY="LibraryLoader.lib"
DOCLIB="LibraryLoader.dcm"
FOOTPRINT_FOLDER="LibraryLoader.pretty"

#Add static Lines at beginning of Library and Doclib File
echo 'EESchema-LIBRARY Version 2.3' > ${LIBRARY}
echo '#encoding utf-8' >> ${LIBRARY}
echo 'EESchema-DOCLIB  Version 2.0' > ${DOCLIB}

echo Footprint Folder: ${FOOTPRINT_FOLDER}

if [ ! -d ${FOOTPRINT_FOLDER} ]; then
mkdir ${FOOTPRINT_FOLDER}
fi

for d in *; do
  if [ -d ${d} ]; then # test if it is a directory or file
  	if [ ${d} != ${FOOTPRINT_FOLDER} ]; then # skip Footprint Folder itself
      echo processing $d ...
      # copy footprint to footprint folder
      cp -av ${d}/*.kicad_mod ${FOOTPRINT_FOLDER} 
      # concat all chars between DEF and ENDDEF to Library file
      cat ${d}/*.lib | sed -e '1h;2,$H;$!d;g' -re 's/.*(DEF.*ENDDEF).*/\1/g' >> ${LIBRARY}
      # concat all chars between $CMP and ENDCMP to Doclib file
      cat ${d}/*.dcm | sed -e '1h;2,$H;$!d;g' -re 's/.*(\$CMP.*ENDCMP).*/\1/g' >> ${DOCLIB}
    fi
  fi
done

stif avatar Dec 16 '19 22:12 stif

Is this fixed by #93?

olback avatar Oct 18 '23 19:10 olback

I don't know, i cannot build it:

docker run --volume=$(pwd):/home/circleci/project olback/rust-gtk-linux cargo build --release
    Updating crates.io index
 Downloading crates ...
  Downloaded powerfmt v0.2.0
....
  Downloaded inout v0.1.3
error: package `gdk-pixbuf-sys v0.18.0` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.61.0

stif avatar Oct 19 '23 14:10 stif