Open weikenxq opened 1 year ago
@weikenxq You could try dwg2dxf
on the my file, but there are errors still. We need to fix step by step.
@weikenxq You could try
dwg2dxf
on the my file, but there are errors still. We need to fix step by step.
@michal-josef-spacek Thanks for reply. I try dwg2dxf on the regen file, I can get the converted result and the result looks ok. But this is just one sample, there are lots of files having the same problem with dwg2dxf. Is it possible to deal with this errors when use dwg2dxf?
@weikenxq I am looking to preR13 things periodically. I am going roundtripping via JSON and DXF. And I see issues.
Exactly those two warnings are the problem:' The table addresses are wrong.
Warning: @0x6834 => start 0x7b5d Warning: @0x7e61 => start 0x8508
Maybe check against the natural address for the sentinel, when the table.address fails.
The file has a non-standard structure. But ODA converter converts without problems.
File without error qq.zip
In original file:
offset num description [bits.endian.size]
--------------------------------------------
000006bf 3088 DWG_SENTINEL_R11_ENTITIES_BEGIN [..16]
00006804 3089 DWG_SENTINEL_R11_ENTITIES_END [..16]
00006814 3090 DWG_SENTINEL_R11_BLOCK_BEGIN [..16]
00006824 3091 DWG_SENTINEL_R11_BLOCK_END [..16]
00007b5d 3092 DWG_SENTINEL_R11_LAYER_BEGIN [..16]
00007c8c 3093 DWG_SENTINEL_R11_LAYER_END [..16]
00007c9c 3094 DWG_SENTINEL_R11_STYLE_BEGIN [..16]
00007d72 3095 DWG_SENTINEL_R11_STYLE_END [..16]
00007d82 3096 DWG_SENTINEL_R11_LTYPE_BEGIN [..16]
00007e51 3097 DWG_SENTINEL_R11_LTYPE_END [..16]
00007f10 1038 padding used in hashing algorithms (0x80 0 ... 0) [..64]
00008518 3103 DWG_SENTINEL_R11_VPORT_END [..16]
0000854d 3105 DWG_SENTINEL_R11_APPID_END [..16]
00008582 3106 DWG_SENTINEL_R11_DIMSTYLE_BEGIN [..16]
00008592 3107 DWG_SENTINEL_R11_DIMSTYLE_END [..16]
000085a2 3108 DWG_SENTINEL_R11_VX_BEGIN [..16]
000085b2 3109 DWG_SENTINEL_R11_VX_END [..16]
000085c2 3110 DWG_SENTINEL_R11_BLOCK_ENTITIES_BEGIN [..16]
000085d2 3111 DWG_SENTINEL_R11_BLOCK_ENTITIES_END [..16]
000085e2 3112 DWG_SENTINEL_R11_EXTRA_ENTITIES_BEGIN [..16]
000085f2 3113 DWG_SENTINEL_R11_EXTRA_ENTITIES_END [..16]
00008602 3114 DWG_SENTINEL_R11_AUXHEADER_BEGIN [..16]
0000869c 3115 DWG_SENTINEL_R11_AUXHEADER_END [..16]
In regenerated file by R11:
offset num description [bits.endian.size]
--------------------------------------------
000006bf 3088 DWG_SENTINEL_R11_ENTITIES_BEGIN [..16]
00006804 3089 DWG_SENTINEL_R11_ENTITIES_END [..16]
00006814 3090 DWG_SENTINEL_R11_BLOCK_BEGIN [..16]
00006824 3091 DWG_SENTINEL_R11_BLOCK_END [..16]
00006834 3092 DWG_SENTINEL_R11_LAYER_BEGIN [..16]
00006896 3093 DWG_SENTINEL_R11_LAYER_END [..16]
000068a6 3094 DWG_SENTINEL_R11_STYLE_BEGIN [..16]
0000697c 3095 DWG_SENTINEL_R11_STYLE_END [..16]
0000698c 3096 DWG_SENTINEL_R11_LTYPE_BEGIN [..16]
00006a5b 3097 DWG_SENTINEL_R11_LTYPE_END [..16]
00006a6b 3098 DWG_SENTINEL_R11_VIEW_BEGIN [..16]
00006a7b 3099 DWG_SENTINEL_R11_VIEW_END [..16]
00006a8b 3100 DWG_SENTINEL_R11_UCS_BEGIN [..16]
00006a9b 3101 DWG_SENTINEL_R11_UCS_END [..16]
00006aab 3102 DWG_SENTINEL_R11_VPORT_BEGIN [..16]
00006cb5 3103 DWG_SENTINEL_R11_VPORT_END [..16]
00006cc5 3104 DWG_SENTINEL_R11_APPID_BEGIN [..16]
00006cfa 3105 DWG_SENTINEL_R11_APPID_END [..16]
00006d0a 3106 DWG_SENTINEL_R11_DIMSTYLE_BEGIN [..16]
00006d1a 3107 DWG_SENTINEL_R11_DIMSTYLE_END [..16]
00006d2a 3108 DWG_SENTINEL_R11_VX_BEGIN [..16]
00006d3a 3109 DWG_SENTINEL_R11_VX_END [..16]
00006d4a 3110 DWG_SENTINEL_R11_BLOCK_ENTITIES_BEGIN [..16]
00006d5a 3111 DWG_SENTINEL_R11_BLOCK_ENTITIES_END [..16]
00006d6a 3112 DWG_SENTINEL_R11_EXTRA_ENTITIES_BEGIN [..16]
00006d7a 3113 DWG_SENTINEL_R11_EXTRA_ENTITIES_END [..16]
00006d8a 3114 DWG_SENTINEL_R11_AUXHEADER_BEGIN [..16]
00006e24 3115 DWG_SENTINEL_R11_AUXHEADER_END [..16]
(original file) This mean, there are missing sections which we need to deduce (VIEW, UCS, VPORT and APPID).
And tables:
ptr table VIEW [6]: (0x8518-0x8518)
VIEW.size: 153 [RS]
VIEW.number: 0 [RS]
VIEW.flags_r11: 0x0 [RS]
VIEW.address: 34072 [RL]
ptr table UCS [7]: (0x8518-0x8518)
UCS.size: 109 [RS]
UCS.number: 0 [RS]
UCS.flags_r11: 0x0 [RS]
UCS.address: 34072 [RL]
ptr table VPORT [8]: (0x8518-0x8518)
VPORT.size: 253 [RS]
VPORT.number: 0 [RS]
VPORT.flags_r11: 0x0 [RS]
VPORT.address: 34072 [RL]
ptr table APPID [9]: (0x8528-0x854d)
APPID.size: 37 [RS]
APPID.number: 1 [RS]
APPID.flags_r11: 0x0 [RS]
APPID.address: 34088 [RL]
are bad.
@weikenxq 1) This previous two comments are about what I am talking. There are serious issues in DWG file structure. We could deduce and somehow fix. 2) Second thing is real dwg2dxf conversion, which has own issues but in DXF values (precision, order in DXF, some differences between autocad release dxf output and other issues)
@weikenxq
- This previous two comments are about what I am talking. There are serious issues in DWG file structure. We could deduce and somehow fix.
- Second thing is real dwg2dxf conversion, which has own issues but in DXF values (precision, order in DXF, some differences between autocad release dxf output and other issues)
@michal-josef-spacek Thanks. When should I expect this to be fixed of this library?
I'm just busy with with oda compat and DXF roundtrips. michal hopefully
ad 1) ok, I will prepare a patch that could detect bad section and skip it.
We don't need to skip bad sections, as we can search for them by the sentinel's
Hello,
I'm trying to convert dwg to dxf using dwg2dxf, there are some errors and the dxf file is not generated.
Are there any way to solve the errors?
Thank you.
environment
macOS big sur 11.5.2 , Apple clang version 12.0.5 (clang-1205.0.22.9),GNU Make 3.81, libredwg latest commit
compile with
./autogen.sh && ./configure --disable-bindings && make && sudo make install
some information
programs/dwg2dxf -o ~/Downloads/6151acdedf1bc01e5a5847868d8bdbbee139b29c.dwg.dxf ~/Downloads/6151acdedf1bc01e5a5847868d8bdbbee139b29c.dwg -y Reading DWG file /Downloads/6151acdedf1bc01e5a5847868d8bdbbee139b29c.dwg Warning: @0x6834 => start 0x7b5d Warning: @0x7e61 => start 0x8508 ERROR: DWG_SENTINEL_R11_VIEW_BEGIN not found at 34056 ERROR: Failed to decode file: /Downloads/6151acdedf1bc01e5a5847868d8bdbbee139b29c.dwg 0x100
origin dwg file open with AutoCAD:
attachment
6151acdedf1bc01e5a5847868d8bdbbee139b29c.dwg.zip