LibreCAD DXF File Structure

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

LibreCAD DXF File Structure

Avneet
Hello
The basic organization of dxf file is :
1. Header section
2. Classes section
3. Table section
4. Entities section
5. Objects section
6. Thumbnailimage section
7. EOF

I read librecad's dxf  ASCII file, it is not folllowing this structure
because it missed classes section.
Why it is not including this section??
Is it not need to include??
Avneet Kaur
Blog : www.avneetkhasla.wordpress.com
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
Avneet wrote
...it missed classes section.
Why it is not including this section??
Is it not need to include??
 In short: No.

More long:

DXF R12 do not have CLASSES, OBJECTS AND Thumbnailimage

The first version wiht CLASSES & OBJECTS is R13 and Thumbnailimage exist since v2000

And you forgot the BLOCK section between TABLES and ENTITIES.

Thumbnailimage section from dxf doc:
"This section exists only if a preview image has been saved with the DXF file."

And CLASSES section:
"holds the information for application-defined classes" (proxy graphics p.e.)

The only mandatory section is ENTITIES like the attached and valid dxf v2007:
minimal.dxf
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Avneet Kaur
Librecad currently supporting DXF 2000 not 2007.

Can you please tell me about the various versions of DXF?
Is 2007 is different from 2000 ?
Is R12 is a new version than R13?


Check my file, in this i have attached entity section that is not containing 330 group code by default.
It includes layer also by default.

//min_line.dxf
0
SECTION
  2
ENTITIES
  0
LINE
  5
43
100
AcDbEntity
100
AcDbLine
  8
0
 62
256
370
-1
  6
ByLayer
 10
120.0
 20
47.25
 30
0.0
 11
34.0
 21
78.25
 31
0.0
  0
ENDSEC
 0
EOF
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

hsrai
Avneet Kaur wrote
Is 2007 is different from 2000 ?
Is R12 is a new version than R13?
R13 is newer than R12 but both are older than 2000.

Check:

http://www.autodesk.in/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853

http://en.wikipedia.org/wiki/AutoCAD_DXF

--
H.S.Rai
--
H.S.Rai
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
Hi Avneet Kaur,

LibreCAD 1.x.x uses the old dxflib, only writes R12 & 2000 and do not support polyline contour

LibreCAD 2.x.x uses the new libdxfrw and writes in R12, 2000, 2004 & 2007.

You can found libdxfrw source code in:
https://github.com/LibreCAD/LibreCAD/tree/master/libraries/libdxfrw

Or if you want to work with it outside LC get it from:
http://sourceforge.net/projects/libdxfrw/
Is the same source code with standard ./comfigure & make & make install

Versions are documented in lines #45 to #54:
https://github.com/LibreCAD/LibreCAD/blob/master/libraries/libdxfrw/src/drw_base.h

Since you use ubuntu you can update your installation to daily builds
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
I forgot...

330 group code are "Soft-pointer ID/handle to owner BLOCK_RECORD object" if  are a "normal" entity then value of code 5 of *Model_Space BLOCK_RECORD. In a partial or minimal dxf not needed.

About your "min_line.dxf":
group codes 8, 62, 370 & 6 are "group codes for entities" and must be between "AcDbEntity" and "AcDbLine"

Layer value (8) can be any valid string, all programs that reads dxf create it if not exist

linetype & color (62 & 6) if are BYLAYER not needed like 30 & 31 (z values) defaults to 0
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

zamtmn
In reply to this post by Rallaz
>>The only mandatory section is ENTITIES like the attached and valid dxf v2007: minimal.dxf
It's the wrong file. Without the header section version of the file should automatically be DXF12. The file should be no strings specific to the new formats.
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
You are right,  in my example the code 330 should not be, and both code 100 not needed but works with them
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

zamtmn
AutoCAD does not load this file.
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
If you delete lines #9 & #10 (code 330, value 2) are opened at least with autocad 2010
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Avneet Kaur
In reply to this post by zamtmn
I want a DXF2000 file not a DXF12.
If we include only entity section, then it will run on all CAD software or not.
By default LibreCAD is not adding the classes section to DXF file, then why it is adding the Objects section??
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
Avneet Kaur wrote
I want a DXF2000 file not a DXF12.
DXFr12 is the most simple and supported around the world, but do not support lwpolylines, ellipse and other "modern" features

Avneet Kaur wrote
If we include only entity section, then it will run on all CAD software or not.
Yes, but I can't talk in the name of developers of ALL CAD software

Avneet Kaur wrote
By default LibreCAD is not adding the classes section to DXF file, then why it is adding the Objects section??
classes section is not added because LibreCAD do not use any "special" feature requiring this section.
See attached file, this contains only CLASSES section and APPID table, this file is generated by AutoCAD Map 3D 2012. None of these data are needed by LibreCAD or other CAD not using these features.

Objects section is added by LC because IMAGE entity are supported and IMAGE require a IMAGEDEF object like INSERT require a BLOCK/BLOCK_RECORD pair
Reply | Threaded
Open this post in threaded view
|

Re: LibreCAD DXF File Structure

Rallaz
the attached file of previous message:
classesexample.dxfpart