js-dxf icon indicating copy to clipboard operation
js-dxf copied to clipboard

Example output fails to open in AutoCAD 2021

Open yowzadave opened this issue 2 years ago • 4 comments

Trying to open any file generated by this library in AutoCAD 2021 (for Mac) returns the following error:

Unknown group 74 for table on line 78.
Invalid or incomplete DXF input — drawing discarded.

This is true if I regenerate the file examples/demo.js.dxf.

yowzadave avatar Jul 20 '21 18:07 yowzadave

I'm having the same error even if using d.header('ACADVER', [[1, 'AC1009']])

janvorisek avatar Sep 21 '21 14:09 janvorisek

Use generateAutocadExtras() before toDxfString() to fix this problem

thisismhp avatar Oct 12 '21 08:10 thisismhp

Hi @thisismhp! We want to use this in ifc.js to allow users to export DXF files out of IFC files. We are successfully able to generate DXF files that can be read by several viewers (e.g. ODA dxf viewer), but unfortunately AutoCad won't load the output.

We've tried to use currentDrawing.generateAutocadExtras(); before const serialized = currentDrawing.toDxfString();, but even then AutoCAD it's unable to load it. We've tried with AutoCAD 2017 and 2020. You can find the generated file here. It's the same as the image below but without the projected lines. You can also find the implementation we were working with here. It lacks currentDrawing.generateAutocadExtras();, but we added that locally and still doesn't work.

Is there any code snippet that we can look that generates a drawing that AutoCAD can open?

Thanks in advance!

image

agviegas avatar Feb 15 '22 11:02 agviegas

Hi,

The generateAutocadExtras() is automatically called, you don't need to call it.

Try to find the entity causing the error, it is the line or polyline...

tarikjabiri avatar Feb 15 '22 15:02 tarikjabiri