[Solved] HPGL Arcs as Line Segments (stupid machine!)

Discussions around the CAM Add-On of QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Indicate the post processor used.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
rabtrfld
Newbie Member
Posts: 8
Joined: Tue Oct 13, 2020 2:06 pm

[Solved] HPGL Arcs as Line Segments (stupid machine!)

Post by rabtrfld » Thu Nov 05, 2020 6:10 pm

Getting Seriously Tired of our stupid MSDOS laser!

Seems it can't interpolate arcs (AA, AR)!
So I guess I'll write a custom script... doesn't look too hard. Something in HPGL.integer.prototype.writeMove() etc.

But, is there another way to tell it to use line segments instead of arcs?

You know, parsing DXF's isn't that hard, wrote my own viewer in 1 hour using Visual Basic. Should have just added an HPGL exporter. Would be done by now.

Anyway, we still like QCAD, use it for EDM at work and GRBL engraver at home, no problem with G-code.

(Maybe can just export the DXF without arcs from Inventor if possible)

Don't use smileys much, but seriously, :x :x :x :x :x !!
Last edited by rabtrfld on Mon Nov 09, 2020 4:24 pm, edited 1 time in total.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: HPGL Arcs as Line Segments (stupid machine!)

Post by andrew » Thu Nov 05, 2020 9:03 pm

Here's some boilerplate code that can be used for interpolating arcs with line segments in a legacy post processor:

Code: Select all

include("HPGL.js");

function MyHPGL(documentInterface, newDocumentInterface) {
    HPGL.call(this, documentInterface, newDocumentInterface);

    this.decimals = 0;
}

MyHPGL.prototype = new HPGL();

MyHPGL.prototype.writeCircularMove = function(x, y, center, radius, startAngle, endAngle, isLarge, isReversed) {
    // interpolate arc with line segments:
    var shape = new RArc(center, radius, startAngle, endAngle, isReversed);
    // segment length: 0.1:
    var pl = shape.approximateWithLines(0.1);
    var plSegments = pl.getExploded();
    for (var k=0; k<plSegments.length; k++) {
        var plSegment = plSegments[k];
        this.writeLinearMove(plSegment.getEndPoint().x, plSegment.getEndPoint().y);
    }
};

rabtrfld
Newbie Member
Posts: 8
Joined: Tue Oct 13, 2020 2:06 pm

Re: [Solved] HPGL Arcs as Line Segments (stupid machine!)

Post by rabtrfld » Mon Nov 09, 2020 4:26 pm

Thank you VERY much for the code! I marked the topic Solved.

rabtrfld
Newbie Member
Posts: 8
Joined: Tue Oct 13, 2020 2:06 pm

Re: [Solved] HPGL Arcs as Line Segments (stupid machine!)

Post by rabtrfld » Mon Nov 09, 2020 8:14 pm

PS: Even though I already marked this "solved," I wanted to report back that it actually worked all the way through the awful MSDOS program and resulted in legible engraving from our old NdYAG laser. Thanks again. This is one of those cases where the company would not invest so I had to buy QCAD/CAM out of pocket or let my project fail. More expensive software was beyond my reach, but QCAD is reasonably priced and I already feel I'm getting my money's worth. Good work QCAD!

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: [Solved] HPGL Arcs as Line Segments (stupid machine!)

Post by andrew » Mon Nov 09, 2020 8:21 pm

Excellent, many thanks for your kind feedback! Good to hear you got it working :D

Post Reply

Return to “QCAD/CAM”