idf importing error
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: idf importing error
yes,
the problem in this file is on "board outline".
How I can fix this problem on idf.py script?
Where I can download GoW or busybox for windows 64bit?
I try to use the busbox on windows commandprompt but don't work:
this is the error:
C:\Users\xx>C:\Users\xx\Desktop\freecad\busybox64.exe cut -d " " -f 2-3 Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn | uniq -d
'uniq' is not recognized as an internal or external command,operable program or batch file.
the problem in this file is on "board outline".
How I can fix this problem on idf.py script?
Where I can download GoW or busybox for windows 64bit?
I try to use the busbox on windows commandprompt but don't work:
this is the error:
C:\Users\xx>C:\Users\xx\Desktop\freecad\busybox64.exe cut -d " " -f 2-3 Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn | uniq -d
'uniq' is not recognized as an internal or external command,operable program or batch file.
Re: idf importing error
IDF.py is (I guess) the Python script importing the IDF into FreeCAD. Basically you just have to open it into a text editor and use your Python knowledge (as well as your FreeCAD API knowledge) to improve the script and overpass the current limitation.
GoW is available here : https://github.com/bmatzelle/gow/releasesWhere I can download GoW or busybox for windows 64bit?
It's quite a big piece of software, and some commands don't have the standard Unix name to prevent collision with Windows' commands.
For simple needs (as here), I would recommend the (very) small and efficient busybox here : http://frippery.org/busybox/index.html
I advise to run it with
Code: Select all
C:\path\to\busybox.exe sh -l
Re: idf importing error
OK, was edited during my first answer. As you're in the Windows env, you have to prefix "uniq" with "busybox64.exe ".
Actually use "busybox64.exe uniq" instead of just "uniq".
EDIT : also better to enclose your filename with double quotes
BR
Re: idf importing error
Hi,
thanks a lot for your support.
If I understand:
1 - I use this command on windows "command prompt"
C:\Users\xxx\Desktop\freecad>busybox64.exe cut -d " " -f 2-3 "Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn" | busybox64.exe uniq -d
2-after running this appear:
0.0007 76.9997
This are the coordinate double.. ok .
3-I open the file "Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn"
.HEADER
BOARD_FILE 3.0 "Altium DXP" 2018-12-07.15:49:16 1
"Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1.00" MM
.END_HEADER
.BOARD_OUTLINE UNOWNED
0.4115
0 0.0004 0.0004 0.0000
0 0.0004 76.9998 0.0000
0 0.0007 76.9997 54.0180
0 0.0007 76.9997 0.0000
0 0.0007 76.9997 26.4500
0 68.9996 76.9996 0.0000
0 68.9996 0.0004 0.0000
0 0.0004 0.0004 0.0000
.END_BOARD_OUTLINE
4- and inside the file there are the coordinates 0.0007 76.9997 ... but is not exact the same because is:
0 0.0007 76.9997 54.0180
0 0.0007 76.9997 0.0000
0 0.0007 76.9997 26.4500
What line do I need to remove from file?
thanks a lot for your support.
If I understand:
1 - I use this command on windows "command prompt"
C:\Users\xxx\Desktop\freecad>busybox64.exe cut -d " " -f 2-3 "Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn" | busybox64.exe uniq -d
2-after running this appear:
0.0007 76.9997
This are the coordinate double.. ok .
3-I open the file "Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1 SOLO CONTORNO.emn"
.HEADER
BOARD_FILE 3.0 "Altium DXP" 2018-12-07.15:49:16 1
"Copy of NBP3 Altera MAX7000 MAX3000 PLCC Rev1.00" MM
.END_HEADER
.BOARD_OUTLINE UNOWNED
0.4115
0 0.0004 0.0004 0.0000
0 0.0004 76.9998 0.0000
0 0.0007 76.9997 54.0180
0 0.0007 76.9997 0.0000
0 0.0007 76.9997 26.4500
0 68.9996 76.9996 0.0000
0 68.9996 0.0004 0.0000
0 0.0004 0.0004 0.0000
.END_BOARD_OUTLINE
4- and inside the file there are the coordinates 0.0007 76.9997 ... but is not exact the same because is:
0 0.0007 76.9997 54.0180
0 0.0007 76.9997 0.0000
0 0.0007 76.9997 26.4500
What line do I need to remove from file?
Re: idf importing error
Actually that's not so simple as removing lines. But not too hard too.
Your board is just a rectangle on which the top side is an arc.
A very simple IDF sequence that do not uses duplicate points is just the 4 board edges, providing for the top side the included angle.
According your board dimensions (69x77), and if I guess the center of the arc is on the middle of the bottom side, the included angle is "2*atan(69/2/77) = 48,2697 deg". As the arc is CCW, IDF specified it shall be passed as a negative value.
Thus finally you can remove the all 3 lines with duplicates coordinates as it uses an extra point that we don't need.
After that the 3rd point shall provide the inc angle between 2nd and 3rd point, thus -48.2697.
At the end, the BOARD_OUTLINE section of your file shall be as is :
Code: Select all
.BOARD_OUTLINE
5.0000
0 0.0004 0.0004 0.0000
0 0.0004 76.9998 0.0000
0 68.9996 76.9996 -48.2697
0 68.9996 0.0004 0.0000
0 0.0004 0.0004 0.0000
.END_BOARD_OUTLINE
BR
Re: idf importing error
Ok, thanks.
And with this files in attachment I have this error (always from Altium IDF export),
The error is this
"Emp version: 2.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 72, in insert
process_emn(doc,filename)
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 131, in process_emn
process_emp(doc,filename,placement,board_thickness)
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 252, in process_emp
comps.append((comp_PartNumber,[Process_comp_outline(doc,comp_outline,comp_height),comp_GeometryName]))
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 319, in Process_comp_outline
out_shape.append(Part.LineSegment(prev_vertex,vertex))
<class 'Part.OCCError'>: Both points are equal"
I used always the same program with this commad line:
C:\Users\floriano\Desktop\freecad>busybox64.exe cut -d " " -f 2-3 "aaaa.emn" | busybox64.exe uniq -d
nothing coordinate duplicates appair.
And with this files in attachment I have this error (always from Altium IDF export),
The error is this
"Emp version: 2.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 72, in insert
process_emn(doc,filename)
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 131, in process_emn
process_emp(doc,filename,placement,board_thickness)
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 252, in process_emp
comps.append((comp_PartNumber,[Process_comp_outline(doc,comp_outline,comp_height),comp_GeometryName]))
File "C:\Users\floriano\Desktop\freecad\FreeCAD_0.18.14956_x64_dev_win - altium\Mod\Idf\Idf.py", line 319, in Process_comp_outline
out_shape.append(Part.LineSegment(prev_vertex,vertex))
<class 'Part.OCCError'>: Both points are equal"
I used always the same program with this commad line:
C:\Users\floriano\Desktop\freecad>busybox64.exe cut -d " " -f 2-3 "aaaa.emn" | busybox64.exe uniq -d
nothing coordinate duplicates appair.
- Attachments
-
- aaaa.zip
- (9.24 KiB) Downloaded 31 times
Re: idf importing error
Guess the problem is in the EMP file. Did you try to process it also ?
Seeing your files one after each other, it appears there is a high chance that your ECAD software is totally not compliant with IDF.
Oppositely to what I previously said, troubling point sequences are non-sense and should never lead to something correct (even in other software).
EDIT : Won !
To find the duplicates more easily, you can use this enhanced command line (will indicate the line number) :
Code: Select all
cut -d " " -f 2-3 aaaa.emp | nl | uniq -f 1 -d
Re: idf importing error
Now that you are getting familiar with busybox, you can also automatically remove duplicates with the following command (in example, create a new "bbbb.emp" file that is "aaaa.emp" w/o duplicates) :
Code: Select all
sed -E '$!N;/[01]\ (-?[0-9\.]+\ -?[0-9\.]+)\ -?[0-9\.]+\r?\n[01]\ \1/D;P;D' aaaa.emp > bbbb.emp
Re: idf importing error
Fantastic and thanks a lot for you support.
The problem is on idf.py that it does not manage this kind of problem/mistake..
I hope someone can update the idf.py file to manage this error and permit to continue to load the rest of the components without crashing
The problem is on idf.py that it does not manage this kind of problem/mistake..
I hope someone can update the idf.py file to manage this error and permit to continue to load the rest of the components without crashing
Re: idf importing error
I don't really think the problem is on idf.py...fiffo wrote: ↑Fri Dec 07, 2018 7:23 pm Fantastic and thanks a lot for you support.
The problem is on idf.py that it does not manage this kind of problem/mistake..
I hope someone can update the idf.py file to manage this error and permit to continue to load the rest of the components without crashing
First the error is actually raised by FreeCAD itself when the IDF script try to create a null-length line.
Then the problem cause actually comes from your file (hence from your ECAD software). I processed a lot of EMN/EMP files with FreeCAD and never had any problem.
IMHO, this last point is the best reason to keep the idf.py as it is. I prefer it to fail with an error rather than succeed doing something that is not what I'm expecting.
But if you really want it, I attach a modified script that will ignore the duplicate errors. Beware that it just brutally ignores the duplicates when they come, and thus it may lead to unexpected shapes when importing.
BR
- Attachments
-
- Idf.py
- (19.4 KiB) Downloaded 37 times