Page 1 of 1

How to just "modify" a DXF file?

Posted: Mon Nov 19, 2012 2:31 am
by jankungamba
Hi guys,

I'm currently doing a project that involves reading a DXF file and drawing its contents using openGL. The reading part is almost done since dxflib does all the parsing for me however the writing part seems that it will take more time though I need clarification on this.

Basically, one feature of the program is to read a DXF file and draw the contents on a plane as if the DXF file is set as a texture to the plane. After that the user can add cameras to the plane including each of their viewing frustum (this is one of the features of the program and the cameras and their viewing frustum are rendered as simple boxes and cones respectively) and then later export to DXF. When I export it back to DXF I just want to add the cameras and their frustums (as rectangle and triangles) into the DXF file and keep the rest of the file the same. After reading the writing tutorial from the site (http://www.ribbonsoft.com/doc/dxflib/2. ... iting.html), it seems that I have to set all the data i.e. headers, tables, layers as if I'm doing it from an empty DXF file.

So if I just want to "modify" an existing DXF file, I would have to do it in the following order:

1.) Read its contents via DL_Dxf::in and parse EVERY information (basically implementing all its virtual functions so I can copy every data)
2.) Create a new DXF file using DL_Dxf::out and get a DL_WriterA object.
3.) Write all data starting from the header until the entities section which I have parsed in step 1

It really seems tedious if all you want is just to "modify" an existing DXF file. Is this the only way to do it?
I would appreciate it if someone can enlighten me on this.

Thank you very much.

Re: How to just "modify" a DXF file?

Posted: Mon Nov 19, 2012 2:36 am
by jankungamba
Guys I'm really sorry. This is actually intended for the dxfilb "How Do I" section. I realize I post it in the wrong section. I'm really sorry. How do I move this thread to another section? Thank you.

Re: How to just "modify" a DXF file?

Posted: Mon Nov 19, 2012 10:05 am
by andrew
jankungamba wrote:it seems that I have to set all the data i.e. headers, tables, layers as if I'm doing it from an empty DXF file.
Yes, this is currently the only way to write DXF files. dxflib does not have any meas to store data for later use. This is out of the scope of the project.

Re: How to just "modify" a DXF file?

Posted: Tue Nov 20, 2012 5:11 am
by jankungamba
Okay I see. Thanks for the reply :)