Closed kriffe closed 1 year ago
I have a lot of example code to solve all this, based on some of my other projects with dxf exporters. But since the suggested changes might have a big impact on this repository I want to make sure that this is something that is desirable before I contribute with that source code.
The biggest issue is the version jump to 2013 (might need jump to major 2.X for repo) and the huge increase in size for small dxf files (unless someone is more successful than me in minimizing all that default data..)
@ognjen-petrovic What are your thoughts?
@kriffe I like your idea about version 2. Yes, the size of generated file is going to increase but that is the price of progress. Version 1 will remain available.
Switch to TypeScript in version 2?
@ognjen-petrovic That is a good idea. Lots of benefits from typescript. Maybe we get it working with header first and then convert before release (not good to do 2 things at the same time..)
Maybe we get it working with header first and then convert before release (not good to do 2 things at the same time..)
Sure, I agree.
First draft of how it could be done https://github.com/kriffe/js-dxf/tree/Minimal-Header
First draft of how it could be done https://github.com/kriffe/js-dxf/tree/Minimal-Header
Great! Thanks. I took a look...I have not worked for a while at DXFs and must again catch grasp on sections, blocks.. :) I made some small changes/additions, will create a PR shortly.
@ognjen-petrovic : The way the standard is created is horrible.. I think a lot of the information is redundant, but since some viewers (specifically AutoCAD) are very strict its very time consuming to reduce to the absolute minimal.
I have now a working version for the Hello World example. Still some work with testing other entities and cleaning up, but worked out pretty much as I hoped.
@ognjen-petrovic I simplifyed the header some more and created a draft PR to your side also. Not sure which branch is best to work from.
@kriffe - I can test in Fusion360, QCAD, and Illustrator. Fusion360 is by Autodesk, and it may or may not use the same DXF interpreter that AutoCAD does.
@calebc01 Here is file: test_hello_world.zip
In LibreCAD it looks like:
DraftSight says:
Onshape:
Catia V5:
On import into Fusion 360, I get an error: "Failed to insert this DXF file." Fusion 360 does not provide any additional information, unfortunately.
Illustrator also errors out, "The file "test_hello_world.dxf is in an unknown format and cannot be opened."
QCAD appears to work, but QCAD historically does the best it can and ignores errors:
@calebc01 Could you make another test with a file containing just a basic line (see attached)?
If this works we can narrow the issue down to some Entity, the setting of Unit or Layer. If this does not work its something more general with the header.
@ognjen-petrovic Seems like the line style was not preserved for the others. Perhaps we need to add the following to the Defalt Tables under generateLtypeTable() (https://github.com/ognjen-petrovic/js-dxf/blob/v2-master/src/DefaultTables.js#L212)
0
LTYPE
72
65
70
64
2
DASHED
3
_ _ _
73
2
40
10
49
5
49
-5
0
LTYPE
72
65
70
64
2
DOTTED
3
. . .
73
2
40
5
49
0
49
-5
0
LTYPE
72
65
70
64
2
DASHDOT
3
_ . _
73
4
40
1.5
49
0.5
49
-0.5
49
0
49
-0.5
@calebc01 Could you make another test with a file containing just a basic line (see attached)?
If this works we can narrow the issue down to some Entity, the setting of Unit or Layer. If this does not work its something more general with the header.
@kriffe - the single line imports into Fusion 360 without any issues. It does not work in Illustrator, however.
@ognjen-petrovic Seems like the line style was not preserved for the others. Perhaps we need to add the following to the Defalt Tables under generateLtypeTable() (https://github.com/ognjen-petrovic/js-dxf/blob/v2-master/src/DefaultTables.js#L212)
Yes I see, I'm going to add other types...
To be able to use generated accurate DXF-files in more than LibreCAD there is a need to include a minimal version of the DXF header (not so small thou..) that specifies both version and default data needed.
This will have the following effects (positive and negative):
If this is desirable for the js-dxf repo the following changes is most likely needed (based on previous implementation I have done in other projects)
Testing