Adrian Maire
Adrian Maire

Reputation: 14865

How to represent/read a cube in dxf file?

Trying to open a dxf file format (actual project in C++), I could understand the basic structure of the file, but I can't manage to find how a cube is actually represented.

enter image description here

For a cube in CAD, I expect at least 9 values:

I expect X, Y, Z, A, B and C to be in the ENTITY section,

But Looking at example files, I see many settings, the preview image (taking a significant space in the file), layouts, etc.. But nothing that I can match to how the cube is actually build.


Question:

How to represent/read a cube in a dxf file?


More info

Here is the documentation about the file format:

http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3

I checked LibreCAD source-code, but it does not manage 3D models. Also, libdxfrw library is too generic (it just call the interface callback with the full Entity data).

https://github.com/LibreCAD/LibreCAD_3
https://github.com/LibreCAD/libdxfrw

Upvotes: 0

Views: 1078

Answers (1)

mozman
mozman

Reputation: 2249

This cube is embedded binary ACIS data (3DSOLID) and can not be interpreted without the libraries from Spatial Inc. For more information see my answer to another question: How I can parse nurbs surface from dxf file? Or do you know library(for js, if exists or any other language) for parsing it?

EDIT: Find binary data of ACIS entities

Starting with R2013/AC1027 Modeler Geometry of ACIS data is stored in the section ACDSDATA in a ACDSRECORD these records have no handle, instead they have an ID. The record of your 3DSOLID starts at line 22393 and has the ID 10:

0
ACDSRECORD
90
1
2
AcDbDs::ID
280
10
320
D2            <<< handle to 3DSOLID
2
ASM_Data
280
15
94
9259          <<< size in bytes
310
41534D2042696E61...   <<< binary data as multiple tags of group code 310

This is your 3DSOLD with handle D2 which starts at line 2187:

0
3DSOLID
5
D2      <<< handle of your 3DSOLID
330
1F
100
AcDbEntity
8
0
100
AcDbModelerGeometry
290
0
2
{00000000-0000-0000-0000-000000000000}
100
AcDb3dSolid
350
0

As you see there is no association from the 3DSOLID to the binary content as ACDSRECORD in the ACDSDATA section.

I have no knowledge of a table (DICTIONARY) that links this data together. The only way I know is to search all ACDSRECORD in the ACDSDATA section for links (group code 320) to ACIS objects.

FYI: In DXF versions prior to R2013 the ACIS data is stored in the entity itself as ascii text with a lousy xor "encryption". All my Knowledge about the DXF format is baked into my Python package: ezdxf.

Upvotes: 2

Related Questions