I have technical drawing parameters drawn through the HTML5 canvas function, is there a way to quickly convert these parameters so that they can be exported to a DXF file?
I saw a similar issue but it doesn't seem to have resolved the issue in question.
#447
I hope someone has solved it and provided guidance.
A sample code:
<canvas id="canvas" width="1000" height="1000" style="border:1px solid #ccc"></canvas>
<script>
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
var scale = 3
var r_val1 = 30 * scale;
var r_val2 = 60 * scale;
var r_val3 = 30 * scale;
ctx.save();
var x1 = 200;
var y1 = 150;
var x4 = 200 + r_val1;
var y4 = 150
var x5 = 200;
var y5 = 150 + r_val2;
var a = Math.atan(r_val1 / r_val2);
var b = (Math.PI - a) / 2;
var c = r_val3 * (1 / Math.tan(b));
var x2 = 200 + r_val1 + c;
var y2 = 150;
var x3 = 200;
var y3 = 150 + r_val2 + c;
ctx.globalCompositeOperation = "source-over";
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(x2, y2);
ctx.arcTo(x4, y4, x5, y5, r_val3);
ctx.arcTo(x5, y5, x3, y3, r_val3);
ctx.lineTo(x3, y3);
ctx.stroke();
ctx.restore();
</script>
I have technical drawing parameters drawn through the HTML5 canvas function, is there a way to quickly convert these parameters so that they can be exported to a DXF file?
I saw a similar issue but it doesn't seem to have resolved the issue in question.
#447
I hope someone has solved it and provided guidance.
A sample code: