Created
August 15, 2016 15:42
-
-
Save pointhi/30a5845a820d2637de857e38582f7919 to your computer and use it in GitHub Desktop.
cleanup footprints after runing the "Bitmap to Component Converter" of KiCad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit | |
# of the public at large and to the detriment of our heirs and | |
# successors. We intend this dedication to be an overt act of | |
# relinquishment in perpetuity of all present and future rights to this | |
# software under copyright law. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# For more information, please refer to <http://unlicense.org/> | |
# This script was made by Thomas Pointhuber in 2016 | |
# | |
# use it after "Bitmap to Component Converter" to get a more KLC complicant footprint | |
# I would suggest to resave the files after running this script, to formate the file in | |
# a clean way (especially the fp_poly parts of such a logo) | |
DESCRIPTION="Open Source Hardware Logo" | |
KEYWORDS="Logo OSHW" | |
ATTRIBUTE="virtual" # Logos have to be declared as virtual | |
for FILE in "$@" | |
do | |
NAME=${FILE%".kicad_mod"} | |
echo "Cleanup: $FILE" | |
perl -0777 -i -pe "s/\(module LOGO \(layer F\.Cu\)\n *\(at 0 0\)/\(module $NAME \(layer F\.Cu\)\n \(descr \"$DESCRIPTION\"\)\n \(tags \"$KEYWORDS\"\)\n \(attr $ATTRIBUTE\)/igs" $FILE | |
perl -0777 -i -pe "s/ *\(fp_text reference \"G\*\*\*\"/ \(fp_text reference \"REF\*\*\*\"/igs" $FILE | |
perl -0777 -i -pe "s/ *\(fp_text value \"LOGO\" \(at 0.75 0\) \(layer F.SilkS\)/ \(fp_text value $NAME (at 0.75 0) (layer F.Fab)/igs" $FILE | |
perl -0777 -i -pe "s/\(effects \(font \(thickness 0.3\)\)\)/\(effects \(font \(size 1 1\) \(thickness 0.15\)\)\)/igs" $FILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment