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

Arc not shown in progeCAD

Open vanowm opened this issue 2 years ago • 1 comments

in progeCAD the arc has 0 to every parameter, so it's not shown.

Looking at http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-7a35.htm it seem the arc supposed be as a subclass of an AcDbCircle And indeed when I changed arc class to:

class Arc extends DatabaseObject
{
    /**
     * @param {number} x1 - Center x
     * @param {number} y1 - Center y
     * @param {number} r - radius
     * @param {number} startAngle - degree 
     * @param {number} endAngle - degree 
     */
    constructor(x1, y1, r, startAngle, endAngle)
    {
        super(["AcDbEntity", "AcDbCircle"])
        this.x1 = x1;
        this.y1 = y1;
        this.r = r;
        this.startAngle = startAngle;
        this.endAngle = endAngle;
    }

    toDxfString()
    {
        //https://www.autodesk.com/techpubs/autocad/acadr14/dxf/line_al_u05_c.htm
        let s = `0\nARC\n`;
        s += super.toDxfString();
        s += `10\n${this.x1}\n20\n${this.y1}\n30\n0\n40\n${this.r}\n`;
        s += "100\nAcDbArc\n";
        s += `8\n${this.layer.name}\n`;
        s += `50\n${this.startAngle}\n51\n${this.endAngle}\n`;
        return s;
    }
}

progeCAD shows it properly

vanowm avatar Oct 23 '21 19:10 vanowm

Great, please create PR.

ognjen-petrovic avatar Oct 24 '21 15:10 ognjen-petrovic