View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001366 | File formats | Feature | public | 2014-01-26 21:28 | 2019-07-30 22:39 |
Reporter | cbernardo | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | PC | OS | Linux | OS Version | 3.12-1-amd64 |
Summary | 0001366: IDF import fails (multiple bugs in Idf.py) | ||||
Description | On importing IDF files (both *.emn and *.emp) the importer fails when it encounters a blank line. | ||||
Steps To Reproduce | From the FILE menu, select OPEN and select an *.emn file which has blank lines in it | ||||
Additional Information | An exception is thrown when the blank line is encountered: File ".../Mod/Idf/Idf.py", line 245, in process_emp if emprecords[0][0:4]==".END": File ".../Mod/Idf/Idf.py", line 92, in process_emn if emnrecords[0][0:4]==".END": There are multiple bugs here: 1. it is assumed there is a *records[0] 2. a minimum length of 4 is assumed for *records[0] 3. the IDFv3 specification states that IDF keywords are not case sensitive, but the script imposes upper case. | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
|
|
Ok, the IDF code is basically unmaintained. I do not have the systems and time to do much debbuging. If its making more trouble, I would rather remove it.. |
|
OK, I'll have a look at the Python script since this is important for people who want to use FreeCAD to design a housing for their electronics. This can take a few weeks. |
|
Thanks! |
|
idf_import.patch (1,548 bytes)
diff --git a/src/Mod/Idf/Idf.py b/src/Mod/Idf/Idf.py index c8c2ed0..c6fbae1 100644 --- a/src/Mod/Idf/Idf.py +++ b/src/Mod/Idf/Idf.py @@ -41,8 +41,8 @@ model_tab_filename = FreeCAD.getResourceDir()+ "Mod/Idf/lib/footprints_models.cs step_path=FreeCAD.getResourceDir()+ "Mod/Idf/lib/" -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 +ignore_hole_size=0.35 # size in MM to prevent huge number of drilled holes +EmpDisplayMode=1 # 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 @@ -89,7 +89,8 @@ def process_emn(doc,filename): section_counter=0 for emnline in emnlines: emnrecords=split_records(emnline) - if emnrecords[0][0:4]==".END": + if len( emnrecords )==0 : continue + if len( emnrecords[0] )>4 and emnrecords[0][0:4]==".END": passed_sections.append(current_section) current_section="" elif emnrecords[0][0]==".": @@ -242,7 +243,8 @@ def process_emp(doc,filename,placement,board_thickness): comps=[] for empline in emplines: emprecords=split_records(empline) - if emprecords[0][0:4]==".END": + if len( emprecords )==0 : continue + if len( emprecords[0] )>4 and emprecords[0][0:4]==".END": current_section="" passed_sections.append(current_section) if comp_PartNumber!="": |
|
I have attached a git patch (idf_import.patch) to the IDF import script. This fixes the issue with the blank lines in the IDF file causing problems. This makes it possible for people to view IDF files exported from KiCad. |
FreeCAD: master e1b5f913 2014-03-25 16:25:10 Committer: wmayer Details Diff |
Update Idf.py Fixes from bug 1366 http://www.freecadweb.org/tracker/view.php?id=1366 |
Affected Issues 0001366 |
|
mod - src/Mod/Idf/Idf.py | Diff File | ||
FreeCAD: master 8693bfab 2014-03-29 13:19:48 Details Diff |
+ remove plus sign |
Affected Issues 0001366 |
|
mod - src/Mod/Idf/Idf.py | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-01-26 21:28 | cbernardo | New Issue | |
2014-01-26 21:28 | cbernardo | File Added: test_idf.zip | |
2014-01-27 10:29 |
|
Note Added: 0004123 | |
2014-01-27 10:29 |
|
Status | new => acknowledged |
2014-01-30 00:44 | cbernardo | Note Added: 0004130 | |
2014-01-30 18:47 |
|
Note Added: 0004131 | |
2014-02-07 01:52 | cbernardo | File Added: idf_import.patch | |
2014-02-07 01:55 | cbernardo | Note Added: 0004160 | |
2014-03-29 12:51 | wmayer | Changeset attached | => FreeCAD Master master 8693bfab |
2014-03-29 12:52 | wmayer | Status | acknowledged => closed |
2014-03-29 12:52 | wmayer | Resolution | open => fixed |
2019-07-30 22:39 | Kunda1 | Changeset attached | => FreeCAD master e1b5f913 |