cart: empty [ Login ]

Exported DXF Zero layer is set as current layer

1 
FizixMan
2/28/2008 8:01 PM
A weird issue is cropping up for me now. Our system reads in an existing DXF, adds a few layers and adds some entities to those layers, and re-saves the DXF. As far as we can tell, we don't think we're changing any properties of the original DXF, just adding stuff to it. However, when we open the original DXF in AutoCad 2007, the default current layer is set to 'defpoints'. After running through our application and opening it, the default current layer is blank (mousing over it however shows tooltips matching the Zero layer!). Furthermore, if we try to open the layer manager window, the program throws an exception. If we select a new current layer from the drop-down-list first (so say, switching it back to the 'defpoints' layer), the layer manager opens fine. I just did a quick test, simply reading it and saving it causes this issue to surface. I've emailed the drawings to your wout[at]woutware[dot]com account since I couldn't fit them as attachments here. This is the code used to do my test:
C# Code:
DxfModel data = DxfReader.ReadDxf(@'C:\npd1_original.dxf'); DxfWriter.WriteDxf(@'C:\npd2_bugged.dxf', data, false);
This also happens if we export in binary instead of ASCII. We're only using AutoCAD 2007, so I don't know if it happens for older/newer versions. Thanks for your help! EDIT: seems to be a problem with our mail server, I'll try emailing you the drawings later today.
FizixMan
2/28/2008 8:40 PM
Here, use these links to download them: http://www.genexissystems.com/npd1_original.rar http://www.genexissystems.com/npd2_bugged.rar
Wout
3/2/2008 4:00 PM
Hi, You're right, the $CLAYER header variable wasn't written. In the coming CadLib release the header variable reading/writing is improved so it also preserves data that is not in the CadLib class model. Plus I've also added DxfHeader.CurrentLayer so you have now access to it. Download the beta version here (still working on the new TABLE entity support): http://www.woutware.com/bin/CadLib2.0.21.beta.msi Wout
1