Transferring my work from libdxf to libdxfrw has not been easy so far. Considering the functionality of parsing the input file remaining completely same, the functions to write DXF file had to be understood.
A simple line can be written to DXF file as:
line.basePoint.x = 10;
line.basePoint.y = 20;
line.secPoint.x = 30;
line.secPoint.y = 30;
The values here are passed statically. The above code is executed successfully in writeEntities() function. This function is called in write() function itself without any need to explicitly call it. However to pass the parsed attributes from an input file follows a little different approach.
line.basePoint.x = ab->at(j).toDouble();
line.basePoint.y = ab->at(j+1).toDouble();
line.secPoint.x = ab->at(j+2).toDouble();
line.secPoint.y = ab->at(j+3).toDouble();
The arguments of the parsed input are passed to addLine function. Initially, I was trying to call the addLine function in writeEntities function but some arguments had to be passed to the former doing which the parsed values were over-ridden. Doing it reverse made the parsed values to pass to the writeEntities function instead of each value equal to zero in the prior case.
Now I am able to obtain the parsed values outside the function addLine which was not the situation yesterday. Still I continue to confront a segmentation fault whose roots haven’t been determined yet. So far it seems like a deadlock!