Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
17b1c04f
Commit
17b1c04f
authored
Jul 28, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add script which converts footprint libraries from one format to another
parent
234c4a38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
lib_convert.py
scripts/lib_convert.py
+51
-0
No files found.
scripts/lib_convert.py
0 → 100755
View file @
17b1c04f
#!/usr/bin/python
# Convert a footprint library from one format to another, e.g. legacy to pretty.
# 1) Build target _pcbnew after enabling scripting in cmake.
# $ make _pcbnew
# 2) Changed dir to pcbnew
# $ cd pcbnew
# $ pwd
# build/pcbnew
# 3) Entered following command line, script takes to arguments: oldLibPath & newLibPath
# $ PYTHONPATH=. <path_to>/lib_convert.py /usr/local/share/kicad/modules/smd_dil.mod /tmp/smd_dil.pretty
# 4) inspect one footprint found in new librarypath /tmp/smd_dil
# $ less /tmp/smd_dil/msoic-10.kicad_mod
from
__future__
import
print_function
from
pcbnew
import
*
import
sys
if
len
(
sys
.
argv
)
<
3
:
print
(
"usage: script srcLibraryPath dstLibraryPath"
)
sys
.
exit
(
1
)
src_libpath
=
sys
.
argv
[
1
]
dst_libpath
=
sys
.
argv
[
2
]
src_type
=
IO_MGR
.
GuessPluginTypeFromLibPath
(
src_libpath
);
dst_type
=
IO_MGR
.
GuessPluginTypeFromLibPath
(
dst_libpath
);
src_plugin
=
IO_MGR
.
PluginFind
(
src_type
)
dst_plugin
=
IO_MGR
.
PluginFind
(
dst_type
)
try
:
dst_plugin
.
FootprintLibDelete
(
dst_libpath
)
except
:
None
# ignore, new may not exist if first run
dst_plugin
.
FootprintLibCreate
(
dst_libpath
)
list_of_parts
=
src_plugin
.
FootprintEnumerate
(
src_libpath
)
for
part_id
in
list_of_parts
:
module
=
src_plugin
.
FootprintLoad
(
src_libpath
,
part_id
)
dst_plugin
.
FootprintSave
(
dst_libpath
,
module
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment