1

I am hoping that someone can help me here. I am using the yCad library to read a number of dxf files and output a composite model, to dxf format.

The initial process of reading the file is complete. However, when I save the file it is saved without the model.

Here is an example of the code used to save the dxf file

public static boolean SaveDxf(String outputPath, String fileName, Yxxf model)
{
    try
    {
        model.iohandler = new YutilIOHandler();
        model.ioname = new YutilIOHandlerName(fileName);
        model.ioname.dstfile = outputPath + "\\" + fileName + ".dxf";
        YdxfPutHandler handler = new YdxfPutHandler();
        handler.commandPutMainStart(model.iohandler, model);
        return true;
    }
    catch(Exception ex)
    {
        System.out.println("failed to save dxf file: " + ex.getMessage());
        return false;
    }
}

When the file is viewed from an editor an error is reported stating the model is empty.

The error occurs even when a dxf file is read and then saved with no manipulation.

Jon
  • 95
  • 8

1 Answers1

1

I have resolved this issue.

The resolution required a modification to the version of the YCad library that I was using due the following selection.

if (ent instanceof YxxfEntLine)
{
    YdxfPutEntLine.put(putbfr, (YxxfEntLine)ent);
}

NOTE: This may have been due to an out of date version of the library.

The method was modified to include all required types.

else if(ent instanceof YxxfEntPolyline)
{
    YdxfPutPolyline.put(putbfr, (YxxfEntPolyline)ent);
}

A number of new classes were added to the solution.

When I get time I will see if I can submit these modification to the source library, if they are required.

Jon
  • 95
  • 8
  • could you give us a short example how to create a dxf file with Ycad? Just a short snippet with creating a document, adding a line entitiy and save the file? I can't find any examples online and I think this would help alot of people dealing with DXF files in java. Thanks in advance! – GeoGecco Apr 26 '15 at 15:29
  • Do you maybe still have code with saving dxf files? Could you upload it somewhere online? – Error Apr 29 '15 at 13:17
  • Hi there, I will try to provide an example over the weekend. Unfortunately I am too busy with work to do so at the moment. – Jon Apr 30 '15 at 13:56