Open mirh1 opened 1 year ago
I don't maintain dxf-parser
, but I was curious about this issue because I am looking at dxf-parser closely.
When I test, I am not getting extrusionDirectionX: -0
.
import DxfParser from 'dxf-parser';
import * as fs from 'fs/promises';
const content = await fs.readFile('/path/to/example.dxf', {encoding: 'utf8'});
const parser = new DxfParser();
const dxf = parser.parse(content);
console.log(JSON.stringify(dxf));
The 2 arcs I see are:
{
"type": "ARC",
"handle": "26",
"ownerHandle": "1C",
"inPaperSpace": false,
"layer": "Cutting",
"colorIndex": 7,
"color": 16777215,
"lineType": "Continuous",
"lineweight": 0,
"lineTypeScale": 1,
"visible": true,
"center": {
"x": 33.9061329504177,
"y": -33.9061329504178,
"z": 0
},
"radius": 1.5,
"extrusionDirectionX": 0,
"extrusionDirectionY": 0,
"extrusionDirectionZ": 1,
"startAngle": 1.5707963267948966,
"endAngle": 3.141592653589793,
"angleLength": 1.5707963267948966
},
{
"type": "ARC",
"handle": "28",
"ownerHandle": "1C",
"inPaperSpace": false,
"layer": "Cutting",
"colorIndex": 1,
"color": 16711680,
"lineType": "Continuous",
"lineweight": 0,
"lineTypeScale": 1,
"visible": true,
"center": {
"x": -30.9061329504177,
"y": -35.9061329504178,
"z": 0
},
"radius": 1.5,
"extrusionDirectionX": 0,
"extrusionDirectionY": 0,
"extrusionDirectionZ": -1,
"startAngle": 3.141592653589793,
"endAngle": 4.71238898038469,
"angleLength": 1.5707963267948966
},
Notice, the handle
values are different too. Are you sure you are using the same DXF? And was the parsed DXF json changed after parsing?
Hi, thank you for taking a look at my issue! Yes, it is the same DXF (I renamed it, so the name in the screenshot differs). As you have tried the example by yourself, could you please tell me if the ARC entity was shown in correct position and looked like the second screenshot?
Edit: I just tried to open the DXF with three-dxf samples: Although the JSON looks different, the bug reminds the same. Please notice that the second ARC's x value (-35,90 here) has a positive sign in the alternative viewer I tried and that shows the ARC on correct position (see screenshots above).
{ "type": "ARC", "handle": "26", "ownerHandle": "1C", "inPaperSpace": false, "layer": "Cutting", "colorIndex": 7, "color": 16777215, "lineType": "Continuous", "lineweight": 0, "lineTypeScale": 1, "visible": true, "center": { "x": 33.9061329504177, "y": -33.9061329504178, "z": 0 }, "radius": 1.5, "startAngle": 1.5707963267948966, "endAngle": 3.141592653589793, "angleLength": 1.5707963267948966 },
...
{ "type": "ARC", "handle": "28", "ownerHandle": "1C", "inPaperSpace": false, "layer": "Cutting", "colorIndex": 1, "color": 16711680, "lineType": "Continuous", "lineweight": 0, "lineTypeScale": 1, "visible": true, "center": { "x": -30.9061329504177, "y": -35.9061329504178, "z": 0 }, "radius": 1.5, "startAngle": 3.141592653589793, "endAngle": 4.71238898038469, "angleLength": 1.5707963267948966 },
Sorry - I don't use three-dxf
. So maybe that's where the bug is? I was just looking at the parser's results.
Hi,
I am not sure if this might rather be a three-dxf or dxf-parser issue but hoping this is the right place for my question:
We have an issue with showing some dxf files in dxf-viewer. Here we got a simplified example where you can see that in some cases an entity of Type ARC is not shown in its right position:
While other viewers that I used show the file correctly:
By debugging the parsing process until reaching parseEntity(scanner, curr) in arc.js we noticed that the extrusion vector of the specific ARC entity (Group 210-230) is like (0, 0, -1) and also the x value of the arc.center has a reversed sign.
For reproducing the problem see this example dxf below: example.zip