1
0
Fork 0

Scripts: Grab correct KICAD7_3DMODEL_DIR now

- Todo: Use default.nix or flake.nix to setup the path
This commit is contained in:
linuswck 2023-11-29 15:01:30 +08:00
parent 13720b3ccc
commit 74524b70e4
1 changed files with 6 additions and 3 deletions

View File

@ -21,9 +21,12 @@ def setup_env(prefix, sch, out_dir, dir_kicad_plugins, dir_3d_models):
# NIXOS installs KiCAD Built-in 3D models in a separated folder # NIXOS installs KiCAD Built-in 3D models in a separated folder
if dir_3d_models is None: if dir_3d_models is None:
model_3d_path = os.path.join("/nix/store", os.popen("ls /nix/store | grep kicad-packages3d | head -1").read().replace("\n", ""), "share/kicad/3dmodels") temp = os.popen("ls /nix/store | grep kicad-packages3d").read().split()
for model_3d_path in temp:
if model_3d_path.find(".drv") == -1:
# Setup the KICAD7_3DMODEL_DIR for step file to be generated with kicad-cli" # Setup the KICAD7_3DMODEL_DIR for step file to be generated with kicad-cli"
os.environ['KICAD7_3DMODEL_DIR'] = model_3d_path os.environ['KICAD7_3DMODEL_DIR'] = os.path.join("/nix/store", model_3d_path, "share/kicad/3dmodels")
break
# Generate the prefix from the title and revision fields in title block of the schematics top # Generate the prefix from the title and revision fields in title block of the schematics top
if prefix is None: if prefix is None: