From 384b5fe23923f9dd18010e648458498b3bf5d0f2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 20 Jan 2012 00:10:01 +0000 Subject: [PATCH] + patch for ldf module (Milos Koutny) git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5418 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d --- src/Mod/Idf/Idf.py | 32 +++++++++--------- src/Mod/Idf/Init.py | 4 +-- src/Mod/Idf/lib/footprints_models.csv | 48 +++++++++++++-------------- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/Mod/Idf/Idf.py b/src/Mod/Idf/Idf.py index efbac6027..668aa6eae 100644 --- a/src/Mod/Idf/Idf.py +++ b/src/Mod/Idf/Idf.py @@ -1,5 +1,5 @@ #*************************************************************************** -#* (c) Milos Koutny (milos.koutny@gmail.com) 2010 * +#* (c) Milos Koutny (milos.koutny@gmail.com) 2012 * #* * #* This file is part of the FreeCAD CAx development system. * #* * @@ -22,36 +22,38 @@ #* Milos Koutny 2010 * #***************************************************************************/ -import FreeCAD, Part, os, FreeCADGui, draftGui +import FreeCAD, Part, os, FreeCADGui, __builtin__ from FreeCAD import Base from math import * ########################################################## -# Script version dated 17-May-2010 # +# Script version dated 19-Jan-2012 # ########################################################## #Configuration parameters below - use standard slashes / # ########################################################## -#model_tab_filename="c:/libraries/3d_libraries/brno_cis/brno_footprints_models.csv" +## path to table file (simple comma separated values) + model_tab_filename = FreeCAD.getResourceDir()+ "Mod/Idf/lib/footprints_models.csv" -#step_path="c:/libraries/3d_libraries/brno_cis/step/" + +## path to directory containing step models + step_path=FreeCAD.getResourceDir()+ "Mod/Idf/lib/" -#model_tab_filename="c:/Libraries/3d_libraries/tandberg/footprints_models.csv" -#step_path="c:/Libraries/3d_libraries/tandberg/step/" + ignore_hole_size=1 # size in MM to prevent huge number of drilled holes EmpDisplayMode=2 # 0='Flat Lines', 1='Shaded', 2='Wireframe', 3='Points'; recommended 2 or 0 IDF_sort=0 # 0-sort per refdes [1 - part number (not preffered)/refdes] 2-sort per footprint/refdes IDF_diag=1 # 0/1=disabled/enabled output (footprint.lst/missing_models.lst) -IDF_diag_path="C:/temp" # path for output of footprint.lst and missing_models.lst +IDF_diag_path="/tmp" # path for output of footprint.lst and missing_models.lst ######################################################################################## # End config section do not touch code below # ######################################################################################## -pythonopen = open # to distinguish python built-in open function from the one declared here +pythonopen = __builtin__.open # to distinguish python built-in open function from the one declared here def open(filename): """called when freecad opens an Emn file""" @@ -176,11 +178,11 @@ def Process_board_outline(doc,board_outline,drills,board_thickness): outline=outline.cut(Part.Face(out_shape)) doc_outline=doc.addObject("Part::Feature","Board_outline") doc_outline.Shape=outline - FreeCADGui.Selection.addSelection(doc_outline) - FreeCADGui.runCommand("Draft_Upgrade") - outline=FreeCAD.ActiveDocument.getObject("Union").Shape - FreeCAD.ActiveDocument.removeObject("Union") - doc_outline=doc.addObject("Part::Feature","Board_outline") + #FreeCADGui.Selection.addSelection(doc_outline) + #FreeCADGui.runCommand("Draft_Upgrade") + #outline=FreeCAD.ActiveDocument.getObject("Union").Shape + #FreeCAD.ActiveDocument.removeObject("Union") + #doc_outline=doc.addObject("Part::Feature","Board_outline") doc_outline.Shape=outline.extrude(Base.Vector(0,0,-board_thickness)) grp=doc.addObject("App::DocumentObjectGroup", "Board_Geoms") grp.addObject(doc_outline) @@ -342,7 +344,7 @@ def place_steps(doc,placement,board_thickness): FreeCAD.Console.PrintMessage("Step models to be loaded for footprints: "+str(validkeys)+"\n") grp=doc.addObject("App::DocumentObjectGroup", "Step Models") for validkey in validkeys: - step_dict.append((validkey,Part.read(step_path+"/"+model_dict[validkey]))) + step_dict.append((validkey,Part.read(step_path+model_dict[validkey]))) FreeCAD.Console.PrintMessage("Reading step file "+str(model_dict[validkey])+" for footprint "+str(validkey)+"\n") step_dict=dict(step_dict) for place_item in placement: diff --git a/src/Mod/Idf/Init.py b/src/Mod/Idf/Init.py index 00cb75566..0dcfb4053 100644 --- a/src/Mod/Idf/Init.py +++ b/src/Mod/Idf/Init.py @@ -31,6 +31,6 @@ -# two options for IDF added by Milos Koutny (12-Feb-2010) +# an option for IDF added by Milos Koutny (12-Feb-2010) FreeCAD.addImportType("IDF emn file File Type (*.emn)","Idf") -#FreeCAD.addImportType("IDF emp File Type (*.emp)","Import_Emp") + diff --git a/src/Mod/Idf/lib/footprints_models.csv b/src/Mod/Idf/lib/footprints_models.csv index 6a69ef848..ac49ec372 100644 --- a/src/Mod/Idf/lib/footprints_models.csv +++ b/src/Mod/Idf/lib/footprints_models.csv @@ -1,28 +1,28 @@ "FOOTPRINT" "STEP FILE" -"SOT23-R" "SOT23.STP" -"SMD_C_0805-R" "0805_SMD.STP" -"SMD_C_1210-R" "1210_SMD.STP" -"SMD_R_1206-R" "1206_SMD.STP" -"SMD_C_0603-R" "0603_SMD.STP" -"SMD_R_0603-R" "0603_SMD.STP" -"MINISMDC-1812-R" "1812_SMD.STP" -"SMD_C_2225-R" "2225_SMD.STP" -"SMD_R_2512-R" "2512_SMD.STP" -"1812PS" "1812_SMD.STP" -"TSSOP8_065M-R" "TSS0P_8.STP" -"MSOP10E_LT" "MSOP_10.STP" -"TCMT11XX" "TCMT1107_4.STP" -"SMB-TB" "SMB_DO_214AA.STP" -"SOT404-GDS-R" "SOT404.STP" -"SOT428-A1-A2C-R" "SOT428_DPAK.STP" -"SOT96-1-R" "SOT_96.STP" -"SOT323-BEC-R" "SOT_323_3.STP" -"SOD523-R" "SOD_523.STP" -"SMC" "SMC_DO_214AB.STP" -"SOD523-R" "SOD_523.STP" -"TSM-104-01-L-DV" "TSM_104_01_L_DV_A.STP" -"TSM-103-01-L-DV-A" "TSM_103_01_L_DV_A.STP" -"SOD323-R" "SOD_323.STP" +"SOT23-R" "SOT23.stp" +"SMD_C_0805-R" "0805_SMD.stp" +"SMD_C_1210-R" "1210_SMD.stp" +"SMD_R_1206-R" "1206_SMD.stp" +"SMD_C_0603-R" "0603_SMD.stp" +"SMD_R_0603-R" "0603_SMD.stp" +"MINISMDC-1812-R" "1812_SMD.stp" +"SMD_C_2225-R" "2225_SMD.stp" +"SMD_R_2512-R" "2512_SMD.stp" +"1812PS" "1812_SMD.stp" +"TSSOP8_065M-R" "TSS0P_8.stp" +"MSOP10E_LT" "MSOP_10.stp" +"TCMT11XX" "TCMT1107_4.stp" +"SMB-TB" "SMB_DO_214AA.stp" +"SOT404-GDS-R" "SOT404.stp" +"SOT428-A1-A2C-R" "SOT428_DPAK.stp" +"SOT96-1-R" "SOT_96.stp" +"SOT323-BEC-R" "SOT_323_3.stp" +"SOD523-R" "SOD_523.stp" +"SMC" "SMC_DO_214AB.stp" +"SOD523-R" "SOD_523.stp" +"TSM-104-01-L-DV" "TSM_104_01_L_DV_A.stp" +"TSM-103-01-L-DV-A" "TSM_103_01_L_DV_A.stp" +"SOD323-R" "SOD_323.stp" "VC0603-R" "VC0603_SMD.stp" "RLF12545" "RLF_12545.stp" "CAPAE830X1050" "CAP_50SGV_8_10.stp"