While opening a dxf file, i find the message
Syntax error or premature end of file on line 943.
Invalid or incomplete DXF input -- drawing discarded.
I have a approx. 10000 dxf files. Is it possible to know which files are invalid without opening them?
>> Is it possible to know which files are invalid without opening them?
As long as you don't have any DXF evaluating engine ==> no
>> Syntax error or premature end of file on line 943
Show us the file or at least the lines from the DXF from 900 to 1000 (with marking which line is the 943rd). But the complete DXF would be better as we then also see the header information.
If we know the source of the problem and you want to scan the other files just for this specific problem it might be possible by opening the file and scanning through it for that situation.
- alfred -
Thanks for your quick response.
I am not interested to fix the invalid dxf files. I just want to make list of dxf files which are invalid. All dxf files might be invalid due to different reasons.
In this particular dxf file, the 943rd line was blank. When i removed this blank line, this dxf was fixed.
Is the assumption the error is always a blank line in the DXF? No other fault exists?
Are you looking for an AutoCAD solution (reason you are posting here), something you run inside AutoCAD to go through a list of DXF files and tag ones with blank lines?
>> read lines, and note the ones with a blank line
Be careful with empty attributes (or equivalent text-objects)
- alfred -
>>You could make a program, in any language, to open and read lines, and note the ones with a blank line.
The dxfs might be invalid due to different reasons. Also as Alfred pointed out blank line may not be always source of the error.
>>Are you looking for an AutoCAD solution (reason you are posting here), something you run inside AutoCAD to go through a list of DXF files and tag ones with blank lines?
Actually I am writing a lisp program to dxfin (or insert) the dxfs in a master drawing at specified coordinates. Ones the dxf is inserted, the lisp will do some other editing on it before inserting the next dxf file. The problem is when the lisp starts to process an invalid dxf, it stops without inserting the subsequent dxf files.
If it is possible to know the dxf files which are invalid, then i can remove them from the folder before runing the lisp.
Otherwise is it possible to write something in the lisp so that the lisp will run skipping the invalid dxf file?
Now the *error* function comes to my mind. Can I re-run the lisp inside the *error* function? I will have to test this possibility.
maybe you can try solve the problem with vl-catch-all-...
(if (vl-catch-all-error-p (setq res (vl-catch-all-apply (function your_dxf_insert_function) (list your_parametr1 ...)))) ;;BAD result you can add some actions here nil ;;OK result you can add some actions here res ) ;_ if
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.