Hallo
I try to open STL file generate by freecad (or other). i have this error message :
STLImporter: STL binary/ascii detection failed
I try to open all STL exemple provided in pycam
I didn't try to open majority STL file made by freecad. (STL file generate seems work, i try to open with other software)
no other error message
I link file attachment
Tchus
STL file
Hi Tchus,
I downloaded your file and opened it with PyCAM (v.0.5.1 and current trunk). It worked, as expected. Its dimensions are 513,5mm x 52mm x 7mm. The first characters of the file are "MESH-MESH-MESH-...".
I am confused now. Do you have an idea, why it does not open correctly on your side?
cheers,
Lars
Hi Lars
No idea. I test whith my personnal PC (windows 7) standalone and no standalone 5.1 version
I try with 2 other computer (win7 and winXP) with standalone 0.5.1. All windows version are in French.
Nobody else have this error message with my file ???? realy strange
I think my stl file is ok because if y delete one "MESH" on the first line, file not working.
dimensions are ok (513,5mm x 52mm x 7mm)
cordially
Flo
issue a log message with debug information
Hi Tchus,
I can't imagine, what could cause this problem - but we will surely find the reason ...
Could you apply the attached patch to the file pycam/src/pycam/Importers/STLImporter.py (installed somewhere below c:\python2.5\lib\site-packages\)?
Afterwards a log message should appear (see "windows -> log") after loading the STL file. The log message starts with "STL import info". Please post the content of this message.
Thanks!
cheers,
Lars
Hi Sumpfralle. Thanks for your request
I install patch with copy/cut (add just add the + line) (I don't find how to install patch with command line or routine)
I have this log message :
19:39 INFO Psyco enabled
19:39 INFO Enabled 2 parallel local processes
19:39 INFO Font directory: C:\Python25\share\pycam\fonts
19:39 WARNING STL import info: 302857 / 538976266 / 0 / 23
19:40 INFO Imported STL model: 839 vertices, 0 edges, 1444 triangles
19:40 WARNING STL import info: 4079 / 2554 / -1 / -1
19:40 ERROR STLImporter: STL binary/ascii detection failed
Cheers
Flo
Hi Flo,
regarding the patch: in a unix-style environment you would use "patch <FILENAME". This is probably more difficult under Windows - but your approach was perfectly fine, of course.
Your debug output shows that PyCAM was reading only a part of your file (exactly 4079 bytes) in the log.
Could you repeat the procedure and check if the number is the same?
I did some research regarding incomplete reads of the module that is used here (urllib2) and I found two descriptions of potential problems (incomplete reads):
http://patrakov.blogspot.com/2011/03/case-of-non-raised-exception.html
http://stackoverflow.com/questions/1824069/urllib2-not-retrieving-entire-http-response
Is the file locally stored on your computer or in a remote location?
thanks,
Lars
I have the same message if y open same file (on different disk)
22:37 INFO Psyco enabled
22:37 INFO Enabled 2 parallel local processes
22:37 INFO Font directory: C:\Python25\share\pycam\fonts
22:37 WARNING STL import info: 302857 / 538976266 / 0 / 23
22:37 INFO Imported STL model: 839 vertices, 0 edges, 1444 triangles
22:39 WARNING STL import info: 4079 / 2554 / -1 / -1 # on my c:, same disk to pycam
22:39 ERROR STLImporter: STL binary/ascii detection failed
22:39 WARNING STL import info: 4079 / 2554 / -1 / -1 # on my usb key
22:39 ERROR STLImporter: STL binary/ascii detection failed
thanks
I maybe find origin of probleme
My STL isn't ASCII file, it is a BIN file (not sure)
I try to open my file with this software http://5axes.free.fr/devel_stl.htm
This softawre can open STL file BIN & ASCII.
and my file doesn't work when i tried to open in ASCII format.
I'm going to mail Freecad for more information... (too late this night)
but, if you can open on linux, why not me on windows ?? ( i think i going to install linux lol)
Good night...
Cheers, Flo
Hi Flo,
yes - you are right - this is a binary file.
Sadly we still don't really know exactly, why PyCAM fails to open this file correctly. But at least the urllib issue sounds like a plausible explanation.
Anyway: I attached your STL in ascii format - just in case you need it.
Thanks for sharing your progress!
Lars
STL file in ascii format (works)
Hello,
I have found the same problem: a FreeCAD file does not open in PyCAM.
Same error: detection of ASCII/binary failed.
I have made some attempts and found that it is necessary to explicitly select ASCII when saving the file from FreeCAD, then the file will open in PyCAM.
Cheers,
Valerio.
Is this project dead?
I fixed the STLImporter locally and I'd like to put it in source tree and get a standalone build. Who to contact?
Hi, any news/feedback on this? I'm having the same problem, pycam-0.5.1.1_standalone Windows XP, autocad 2000 STLs not working. Curiously, if I just open it in Heeks and save it, Pycam will open it without any problems.
@Alfredo: which error message do you receive?
Hi Lars, congrats on Pycam! I love it!
The error I get is the same as reported by the original post on this thread: "STLImporter: STL binary/ascii detection failed" with autoCAD generated STLs.
I also tried saving the STL as binary from autoCAD and Pycam opens it but only shows a box :(
Only solution: Open STL in heeksCNC and save again, then Pycam opens it no problem. I attached a sample file I'm working on right now
Thanks and have a nice day (or night?)
Lars, seems my computer was in a bad mood earlier, I tried generating the STL files again from autoCAD 2000:
If I use the Export option on the file menu Pycam won't open it
I found the STLOUT command and it asks "Create a binary STL file? [Yes/No] <Y>:"
If I choose Yes, Pycam won't open it, if I choose No, Pycam opens it with no problem! :)
I attach the three different files, but I'm glad I found a way around it, hope it helps anyone having the same problem
Hi Alfredo,
pycam's binary/ascii detection is quite picky regarding the correct length of the file. I assume that autocad's binary export adds one or two superfluous bytes - which breaks the import.
I am glad that you found a way to work around that problem.
FWIW - I ran into the same issue while porting pycam to python 3.3. [FreeCAD stl exports generate binary stl files]. The 3.3 version includes a fix for this. In short, what the 3.3 stl importer does is it initially opens the file as a binary file. It exams the header, and if its found to be an ASCII type stl, it will then reopen that file applying utf-8 decoding.
A free work around solution is to export FreeCAD files as step files, and then import them with 123 Design. From there [123 Design] export your model as a stl file. This works because the 123 export is an ASCII type file... Interestingly enough, the facet count on the 123 export was higher than what I got from the direct binary FreeCAD export.