diff --git a/README.md b/README.md index be19699..b5e4907 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,12 @@ This command will save: - the footprint in `~/libs/my_lib.pretty/` folder for footprint libraries. The folder will be created if it doesn't exist. - the 3d models in `~/libs/my_lib.3dshapes/` folder for 3d models. The folder will be created if it doesn't exist. +When you want to share your lib over different computers, it is a good idea to store the 3d model's path in the footprint file with a KiCAD path variable. + +```bash +easyeda2kicad --full --lcsc_id=C2040 --output ~/libs/my_lib --3D-path-var EASYEDALIB_3D +``` + You can use the option `--overwrite` to update a component symbol/footprint that is already in a Kicad library (generated by easyeda2kicad) ```bash diff --git a/easyeda2kicad/__main__.py b/easyeda2kicad/__main__.py index 7cca178..2d224aa 100644 --- a/easyeda2kicad/__main__.py +++ b/easyeda2kicad/__main__.py @@ -72,6 +72,14 @@ def get_parser() -> argparse.ArgumentParser: type=str, ) + parser.add_argument( + "--3D-path-var", + required=False, + metavar="EASYEDALIB_3DPATH", + help="subsitute the 3d-models's path in the footprint by this value", + type=str, + ) + parser.add_argument( "--overwrite", required=False, @@ -322,6 +330,8 @@ def main(argv: List[str] = sys.argv[1:]) -> int: model_3d_path = "${EASYEDA2KICAD}/easyeda2kicad.3dshapes" if arguments["project_relative"]: model_3d_path = "${KIPRJMOD}" + model_3d_path + if arguments["3D_path_var"]: + model_3d_path = f'$\u007b{arguments["3D_path_var"]}\u007d' ki_footprint.export( footprint_full_path=f"{footprint_path}/{footprint_filename}",