diff --git a/.hooks/main.py b/.hooks/kicad_cli_tools.py similarity index 91% rename from .hooks/main.py rename to .hooks/kicad_cli_tools.py index 37d0335..4de5a09 100644 --- a/.hooks/main.py +++ b/.hooks/kicad_cli_tools.py @@ -21,14 +21,10 @@ PCB_PDF_FILE_SUFFIX = "_pcb" SCHEMATIC_OUTPUT_PATH = "docs/" SCHEMATIC_FILE_SUFFIX = "_schematic" - - TEMP_DRC_REPORT_NAME = "_drc" TEMP_ERC_REPORT_NAME = "_erc" TEMP_BOM_REPORT_NAME = "_bom" - - class OutputReportType(Enum): JSON = 1 RPT = 2 @@ -82,13 +78,13 @@ class KicadProject: if format_type == OutputReportType.RPT: return txt.read() - def process_bom(self, return_csv : bool = False) -> None: + def process_bom(self, return_csv : bool = False) -> None | list[list[str]]: sch_file_path = self.project_path / f"{self.project_name}.kicad_sch" bom_output_path = Path(TEMP_FILE_PATH) / f"{self.project_name}{TEMP_DRC_REPORT_NAME}.csv" subprocess.call( f'{KICAD_CLI_PATH} sch export bom {sch_file_path} --output {bom_output_path}', shell=True, - ) + ) if (return_csv): with open(bom_output_path, "r") as csvfile: bom_csv = csv.reader(csvfile, delimiter=',', quotechar='"') @@ -115,11 +111,6 @@ class KicadProject: shell=True, ) - # look i dont know what you want to do - # but here you go - def create_3d_model(self) -> None: - ... - # i am not giving you the pdf to output if you want to do that yourself go ahead def create_schmatic_pdf(self) -> None: sch_file_path = self.project_path / f"{self.project_name}.kicad_sch" @@ -136,18 +127,6 @@ class KicadProject: f'{KICAD_CLI_PATH} pcb export pdf {pcb_file_path} --output {pcb_report_path} --layers {",".join(layers)}', shell=True, ) - - def export_pcb(self) -> None: - ... - - def download_datasheets(self) -> None: - ... - - -class Report: - - def export() -> str: - ... def main() -> None: @@ -158,14 +137,11 @@ def main() -> None: print(type(path.parent)) k = KicadProject(path) k.drc_check() - print(k.erc_check(return_report=True)) - print(k.process_bom(return_csv=True)) + k.erc_check() + k.process_bom() k.create_schmatic_pdf() k.create_pcb_pdf() k.get_image() - - - print("hello world");