discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: gcodepreview 0.1 released --- now able to write out open DXF polylines

GS
Guenther Sohler
Sun, Oct 8, 2023 6:30 PM

Wow, you got a big library already!

It appears a little bit odd to code subroutines with "module" and even use
"echo"
inside modules not just for debugging purposes. but this the exact way, how
to trick OpenSCAD

Next step on your agenda is to turn the simulation mode into real mode . so
your python functions will actually drive your motors :)

On Sun, Oct 8, 2023 at 6:32 PM William F. Adams via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: "William F. Adams" willadams@aol.com
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc:
Bcc:
Date: Sun, 8 Oct 2023 16:32:14 +0000 (UTC)
Subject: [OpenSCAD] gcodepreview 0.1 released --- now able to write out
open DXF polylines
First formal, versioned release:

https://github.com/WillAdams/gcodepreview

It (of course) uses:

http://www.guenther-sohler.net/openscad/

and in addition to writing out G-code so as to cut files, it now has an
option to write out polylines --- which may be open/unclosed.

The sample/template file should be pretty-much self-explanatory (see
below) and I will hopefully manage to get some more interesting things
working presently.

William

//!OpenSCAD

use <gcodepreview.py>;
use <pygcodepreview.scad>;
include <gcodepreview.scad>;

$fa = 2;
$fs = 0.125;

/* [G-code] /
Gcode_filename = "gcode.nc";
/
[G-code] */
generategcode = true;

/* [DXF] /
DXF_filename = "gcode.dxf";
/
[DXF] */
generatedxf = true;

/* [CAM] /
feedrate = 850;
/
[CAM] /
plungerate = 425;
/
[CAM] /
toolradius = 1.5875;
/
[CAM] */
squaretoolno = 102;

/* [Feeds and Speeds] /
plunge = 100;
/
[Feeds and Speeds] /
feed = 400;
/
[Feeds and Speeds] /
speed = 16000;
/
[Feeds and Speeds] /
square_ratio = 1.0; // [0.25:2]
/
[Feeds and Speeds] /
small_V_ratio = 0.75; // [0.25:2]
/
[Feeds and Speeds] */
large_V_ratio = 0.875; // [0.25:2]

/* [Stock] /
stocklength = 219;
/
[Stock] /
stockwidth = 150;
/
[Stock] /
stockthickness = 8.35;
/
[Stock] /
zeroheight = "Top"; // [Top, Bottom]
/
[Stock] /
stockorigin = "Center"; // [Lower-Left, Center-Left, Top-Left, Center]
/
[Stock] */
retractheight = 9;

opengcodefile(Gcode_filename);
opendxffile(DXF_filename);

difference() {
setupstock(stocklength, stockwidth, stockthickness, zeroheight,
stockorigin);

movetosafez();

toolchange(squaretoolno,speed * square_ratio);

begintoolpath(0,0,0.25);
beginpolyline(0,0,0.25);

cutoneaxis_setfeed("Z",-1,plunge*square_ratio);

cutwithfeed(stocklength/2,stockwidth/2,-stockthickness,feed);
addpolyline(stocklength/2,stockwidth/2,-stockthickness);

endtoolpath();

}

closegcodefile();
closedxffile();

--
Sphinx of black quartz, judge my vow
https://designinto3d.com/

---------- Forwarded message ----------
From: "William F. Adams via Discuss" discuss@lists.openscad.org
To: OpenSCAD General Discussion discuss@lists.openscad.org
Cc: "William F. Adams" willadams@aol.com
Bcc:
Date: Sun, 8 Oct 2023 16:32:14 +0000 (UTC)
Subject: [OpenSCAD] gcodepreview 0.1 released --- now able to write out
open DXF polylines


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Wow, you got a big library already! It appears a little bit odd to code subroutines with "module" and even use "echo" inside modules not just for debugging purposes. but this the exact way, how to trick OpenSCAD Next step on your agenda is to turn the simulation mode into real mode . so your python functions will actually drive your motors :) On Sun, Oct 8, 2023 at 6:32 PM William F. Adams via Discuss < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: "William F. Adams" <willadams@aol.com> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: > Bcc: > Date: Sun, 8 Oct 2023 16:32:14 +0000 (UTC) > Subject: [OpenSCAD] gcodepreview 0.1 released --- now able to write out > open DXF polylines > First formal, versioned release: > > https://github.com/WillAdams/gcodepreview > > It (of course) uses: > > http://www.guenther-sohler.net/openscad/ > > and in addition to writing out G-code so as to cut files, it now has an > option to write out polylines --- which may be open/unclosed. > > The sample/template file should be pretty-much self-explanatory (see > below) and I will hopefully manage to get some more interesting things > working presently. > > William > > //!OpenSCAD > > use <gcodepreview.py>; > use <pygcodepreview.scad>; > include <gcodepreview.scad>; > > $fa = 2; > $fs = 0.125; > > /* [G-code] */ > Gcode_filename = "gcode.nc"; > /* [G-code] */ > generategcode = true; > > /* [DXF] */ > DXF_filename = "gcode.dxf"; > /* [DXF] */ > generatedxf = true; > > /* [CAM] */ > feedrate = 850; > /* [CAM] */ > plungerate = 425; > /* [CAM] */ > toolradius = 1.5875; > /* [CAM] */ > squaretoolno = 102; > > /* [Feeds and Speeds] */ > plunge = 100; > /* [Feeds and Speeds] */ > feed = 400; > /* [Feeds and Speeds] */ > speed = 16000; > /* [Feeds and Speeds] */ > square_ratio = 1.0; // [0.25:2] > /* [Feeds and Speeds] */ > small_V_ratio = 0.75; // [0.25:2] > /* [Feeds and Speeds] */ > large_V_ratio = 0.875; // [0.25:2] > > /* [Stock] */ > stocklength = 219; > /* [Stock] */ > stockwidth = 150; > /* [Stock] */ > stockthickness = 8.35; > /* [Stock] */ > zeroheight = "Top"; // [Top, Bottom] > /* [Stock] */ > stockorigin = "Center"; // [Lower-Left, Center-Left, Top-Left, Center] > /* [Stock] */ > retractheight = 9; > > opengcodefile(Gcode_filename); > opendxffile(DXF_filename); > > difference() { > setupstock(stocklength, stockwidth, stockthickness, zeroheight, > stockorigin); > > movetosafez(); > > toolchange(squaretoolno,speed * square_ratio); > > begintoolpath(0,0,0.25); > beginpolyline(0,0,0.25); > > cutoneaxis_setfeed("Z",-1,plunge*square_ratio); > > cutwithfeed(stocklength/2,stockwidth/2,-stockthickness,feed); > addpolyline(stocklength/2,stockwidth/2,-stockthickness); > > endtoolpath(); > > } > > closegcodefile(); > closedxffile(); > > > -- > Sphinx of black quartz, judge my vow > https://designinto3d.com/ > > > > > > > ---------- Forwarded message ---------- > From: "William F. Adams via Discuss" <discuss@lists.openscad.org> > To: OpenSCAD General Discussion <discuss@lists.openscad.org> > Cc: "William F. Adams" <willadams@aol.com> > Bcc: > Date: Sun, 8 Oct 2023 16:32:14 +0000 (UTC) > Subject: [OpenSCAD] gcodepreview 0.1 released --- now able to write out > open DXF polylines > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
WF
William F. Adams
Sun, Oct 8, 2023 9:01 PM

On Sunday, October 8, 2023 at 02:30:44 PM EDT, Guenther Sohler guenther.sohler@gmail.com wrote:

Wow, you got a big library already!

Mostly it was a copy-paste from the previous version --- the expansion of lines mostly came from not being able to use writeln directly, so had to make discrete versions for each number of arguments.

It appears a little bit odd to code subroutines with "module" and even use "echo">inside modules not just for debugging purposes. but this the exact way, how to trick OpenSCAD

Used to need to use echo --- that's not necessary anymore since Python will write out files --- the echo statements were for debugging, but I decided it was nice to have the reminder of the filenames.

Next step on your agenda is to turn the simulation mode into real mode . so your python functions will actually drive your motors :)

Already working for soft materials:

I just need to work up modules/loops which will allow multiple passes --- I'll be doing that as I code a joinery module --- will probably take a brief detour and do a Knapp joint (cove and pin) --- I've done them before, so it shouldn't take too long:
https://community.carbide3d.com/t/knapp-joint-with-cnc/19723/18

then I'll get back to more interesting things and finishing and making a second Jefferson Lap Desk replica --- I think that will make a nice project to submit to Hack-a-day if you don't find something more interesting.
William

On Sunday, October 8, 2023 at 02:30:44 PM EDT, Guenther Sohler <guenther.sohler@gmail.com> wrote: >Wow, you got a big library already! Mostly it was a copy-paste from the previous version --- the expansion of lines mostly came from not being able to use writeln directly, so had to make discrete versions for each number of arguments. >It appears a little bit odd to code subroutines with "module" and even use "echo">inside modules not just for debugging purposes. but this the exact way, how to trick OpenSCAD Used to need to use echo --- that's not necessary anymore since Python will write out files --- the echo statements were for debugging, but I decided it was nice to have the reminder of the filenames. >Next step on your agenda is to turn the simulation mode into real mode . so your python functions will actually drive your motors :) Already working for soft materials: I just need to work up modules/loops which will allow multiple passes --- I'll be doing that as I code a joinery module --- will probably take a brief detour and do a Knapp joint (cove and pin) --- I've done them before, so it shouldn't take too long: https://community.carbide3d.com/t/knapp-joint-with-cnc/19723/18 then I'll get back to more interesting things and finishing and making a second Jefferson Lap Desk replica --- I think that will make a nice project to submit to Hack-a-day if you don't find something more interesting. William