cart: empty [ Login ]

Error Writing DXF (even version 12, 13, 14)

1 
FizixMan
3/1/2007 11:07 PM
The company I work for is developing some software that will read DXF's, append some new entities, and export the new DXF. (we're using the trial right now -- very impressed -- and will be purchasing the license soon) I'm having an issue now with exporting the DXF. Some save fine, others crash out. Even when directly loading then saving the DXF without making changes to it. I've converted the files to several versions, in fact, all that I have available. (anything from 2.5 up to 2007, including 12, 13, 14 as specified in the documentation) Tried exporting in both binary and ascii, no dice. In C#:
C# Code:
CadData data = DxfReader.ReadDxf(filepath); DxfWriter.WriteDxf(@'C:\files\wtf.dxf', data, false);
That crashes with the error:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.   at CadLib.IO.DxfWriter.♣►☺☼♦☺↓↓(Entity )   at CadLib.IO.DxfWriter.♦☻↨◄♣♫☼♫(PolylineBase )   at CadLib.IO.DxfWriter.♥▬♫?☻☼↨▬↓(Entity )   at CadLib.IO.DxfWriter.♥☼↕♠↨☻♣?↓(Block )   at CadLib.IO.DxfWriter.☻☼☼↨‼?↕♣()   at CadLib.IO.DxfWriter.Write(Boolean validate)   at CadLib.IO.DxfWriter.WriteDxf(String filename, CadData data, Boolean binary)
Is it possible you could point me in the right direction for a solution? Perhaps the conversion program (tried using both AutoCad 2007 a third party converter) is messing it up? Or is it from objects in the DXF that aren't supported? I can manipulate and access the entities in the DXF; it's loading alright. It is just when I go to save it with DxfWriter.WriteDxf that it crashes. Any help would be greatly appreciated, thank you. -Chris
Wout
3/1/2007 11:15 PM
It's not completely unimaginable that there's a bug in CadLib. Can you e-mail me 2 or 3 DXF files that give you those problems? I'll solve the problem as soon as possible. Oh, I had a closer look at your description, and now I realize you're using version 1.1! That version doesn't support read/modify/write scenarios, version 2.0 does. Version 1.1 is frozen basically, it's in maintenance mode, so you'll have to migrate to .NET 2.0 if you want to do this kind of scenario. Thanks, Wout
FizixMan
3/2/2007 2:41 PM
That's odd... I thought I was using 2.0. I'll double check. I'm at home right now about to leave for work, so I'll send a DXF check the version when I get into the office. Thanks for the speedy reply! =] EDIT: Yup, using 1.1. I'll download 2 and give that a shot. EDITx2: Working great now! Thanks. =] Is writing version 2007 (AC1021) fully supported? In the help file it says up to 15 in one spot, and up to 18 in another. It seems to read/write that version DXF ok so far.
Wout
3/2/2007 4:54 PM
Oh, could be that I haven't updated the documentation everywhere consistently. CadLib writes indeed up to and including version 18 (AC1018), in the DXF revision 21 (AutoCAD 2007) spec it's using that version ID, so I'm not aware of a AC1021 existing just yet. Just shoot me a message when you find a documentation inconsistency and I'll fix it! Thanks! Wout
1