discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Python for openSCAD

GS
Guenther Sohler
Tue, Nov 14, 2023 4:51 PM

Hi Sanjeev. Key problem is the illegal instruction line. Seems that the DMG
is not matching your architecture but I am not sure how macs architecture
Change should properly work.

On Tue, Nov 14, 2023, 17:32 Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

I have installed Rosetta2 , still it doesnt work and there is a long error
message
I have macbook air m1

On Tue, 14 Nov 2023 at 20:55, William F. Adams via Discuss <
discuss@lists.openscad.org> wrote:

On Tuesday, November 14, 2023 at 10:05:56 AM EST, Sanjeev Prabhakar via
Discuss discuss@lists.openscad.org wrote:

William has sent me visual steps to implement your software.
Will try tonight again and will let you know in case it doesn't work,

also will share if it works.

I did have one further thought here --- if you have an M1 (or 2 or 3) ARM
CPU, then if you haven't, see if installing "Rosetta" which is what they
are calling their Intel-ARM compatibility layer (because of course, no one
uses a Newton anymore).

William


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


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

Hi Sanjeev. Key problem is the illegal instruction line. Seems that the DMG is not matching your architecture but I am not sure how macs architecture Change should properly work. On Tue, Nov 14, 2023, 17:32 Sanjeev Prabhakar via Discuss < discuss@lists.openscad.org> wrote: > I have installed Rosetta2 , still it doesnt work and there is a long error > message > I have macbook air m1 > > On Tue, 14 Nov 2023 at 20:55, William F. Adams via Discuss < > discuss@lists.openscad.org> wrote: > >> On Tuesday, November 14, 2023 at 10:05:56 AM EST, Sanjeev Prabhakar via >> Discuss <discuss@lists.openscad.org> wrote: >> >> >William has sent me visual steps to implement your software. >> >Will try tonight again and will let you know in case it doesn't work, >> also will share if it works. >> >> I did have one further thought here --- if you have an M1 (or 2 or 3) ARM >> CPU, then if you haven't, see if installing "Rosetta" which is what they >> are calling their Intel-ARM compatibility layer (because of course, no one >> uses a Newton anymore). >> >> William >> >> >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
GH
gene heskett
Tue, Nov 14, 2023 4:53 PM

On 11/14/23 08:23, William F. Adams via Discuss wrote:

On Tuesday, November 14, 2023 at 07:10:01 AM EST, jon via Discuss
discuss@lists.openscad.org wrote:

If it can be don in OpenSCAD, why not show that also?  This is an
OpenSCAD list, not a Python list.

Perhaps OP hasn't programmed that yet?

I guess we could view implementing this in OpenSCAD as "an exercise left
for the reader"?

That said, there has been a lot of effort to integrate Python with
OpenSCAD in the past, and I for one think it's flat-out amazing what
Guenther has achieved, and I look forward to all that potential interest
creating a lot more things such as Sanjeev has shown in his nifty video,
and not just because it was an absolute sea change in my own project:

https://github.com/WillAdams/gcodepreview
https://github.com/WillAdams/gcodepreview

making it possible to write out G-code and DXF files so that OpenSCAD
can be fully integrated with other CAD/CAM tools.

Of potential interest there is that I worked up a technique where:

 - a Python file was added to a project via use
 - an OpenSCAD file then wrapped the Python commands in OpenSCAD code
via use
 - an OpenSCAD file then wrapped the OpenSCAD commands in OpenSCAD code
while using branching based on variables via include

This gave me the best of all possible worlds:

 - an OpenSCAD project which was simple/compatible enough for me to
make use of it via OpenSCAD Graph Editor
 - a Python back-end which could be used for "real" variables and to
write out files (a feature which I have been asking after for a long time)

and most importantly, a tool which gave me the same excitement I had
upon first using TeX on my NeXT Cube --- a tool which could do
anything and which had as its only limits computer processing
speed/storage (or my patience) and human ingenuity.

Most recent public update is at:

https://forum.makerforums.info/t/rewriting-gcodepreview-with-python/88617/4 https://forum.makerforums.info/t/rewriting-gcodepreview-with-python/88617/4

for folks who want to see half of a joint --- next up is a test cut,
then the horizontal versions.

I'm looking forward to what more talented folks will do with this, and
ask that folks who are only interested in "pure" OpenSCAD just exercise
a bit of forbearance (and the "delete message" function in their e-mail
reader, or some sort of filter?) so as to share this space with folks
who are interested in the possibilities of Python and OpenSCAD.

William

With a garage full of cnc machines for working metal and wood, I'll have
to plead guilty to wishing linuxcnc, which I've been using to drive my
machines for over 20 years now, had a more capable realtime backplot
function. Originally written for your basic 3 axis mill it has grown the
ability to control 9 synchronized axises these days, but the
visualization has not kept pace. So there is no way to visualize a screw
as it is being turned on a 4 axis machine. By switching off the cut that
does the work. the tooth shape can be somewhat visualized, which helps a
lot and makes gcode development to carve that screw possible, but to see
it being carved is not possible given its current graphics ability.  It
needs the ability to generate a model, then spin the model as its being
cut. Using the tkinter video tools, it would take far more power in the
graphics engine to do that that is present in the older off lease
computers we often use as the rest of linuxcnc can happily run at a 1khz
loop rate on something as puny powered as an rpi3b, although the 3b is
dragging its tongue on the floor. The 4b does it nicely, its been
running a late 1940's Sheldon 11x54 lathe for quite a few years here.
And even there, with only two axises to move, your only visualization on
screen is the video tach that tells you how fast the workpiece is
spinning, We have it in the DRO display overlaid in the backplot view,
but no way to rotate the view of the workpiece. it doesn't exist. only a
very simplified version of the tool exists in that video plot.

Do you have a link where we can see it working?

Thank you.

Take care & stay well.

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis
On 11/14/23 08:23, William F. Adams via Discuss wrote: > On Tuesday, November 14, 2023 at 07:10:01 AM EST, jon via Discuss > <discuss@lists.openscad.org> wrote: > > >If it can be don in OpenSCAD, why not show that also?  This is an > >OpenSCAD list, not a Python list. > > Perhaps OP hasn't programmed that yet? > > I guess we could view implementing this in OpenSCAD as "an exercise left > for the reader"? > > That said, there has been a _lot_ of effort to integrate Python with > OpenSCAD in the past, and I for one think it's flat-out _amazing_ what > Guenther has achieved, and I look forward to all that potential interest > creating a lot more things such as Sanjeev has shown in his nifty video, > and not just because it was an absolute sea change in my own project: > > https://github.com/WillAdams/gcodepreview > <https://github.com/WillAdams/gcodepreview> > > making it possible to write out G-code and DXF files so that OpenSCAD > can be fully integrated with other CAD/CAM tools. > > Of potential interest there is that I worked up a technique where: > >  - a Python file was added to a project via use >  - an OpenSCAD file then wrapped the Python commands in OpenSCAD code > via use >  - an OpenSCAD file then wrapped the OpenSCAD commands in OpenSCAD code > while using branching based on variables via include > > This gave me the best of all possible worlds: > >  - an OpenSCAD project which was simple/compatible enough for me to > make use of it via OpenSCAD Graph Editor >  - a Python back-end which could be used for "real" variables and to > write out files (a feature which I have been asking after for a _long_ time) > > and most importantly, a tool which gave me the same excitement I had > upon first using TeX on my NeXT Cube --- a tool which could do > _anything_ and which had as its only limits computer processing > speed/storage (or my patience) and human ingenuity. > > Most recent public update is at: > > https://forum.makerforums.info/t/rewriting-gcodepreview-with-python/88617/4 <https://forum.makerforums.info/t/rewriting-gcodepreview-with-python/88617/4> > > for folks who want to see half of a joint --- next up is a test cut, > then the horizontal versions. > > I'm looking forward to what more talented folks will do with this, and > ask that folks who are only interested in "pure" OpenSCAD just exercise > a bit of forbearance (and the "delete message" function in their e-mail > reader, or some sort of filter?) so as to share this space with folks > who are interested in the possibilities of Python and OpenSCAD. > > William > With a garage full of cnc machines for working metal and wood, I'll have to plead guilty to wishing linuxcnc, which I've been using to drive my machines for over 20 years now, had a more capable realtime backplot function. Originally written for your basic 3 axis mill it has grown the ability to control 9 synchronized axises these days, but the visualization has not kept pace. So there is no way to visualize a screw as it is being turned on a 4 axis machine. By switching off the cut that does the work. the tooth shape can be somewhat visualized, which helps a lot and makes gcode development to carve that screw possible, but to see it being carved is not possible given its current graphics ability. It needs the ability to generate a model, then spin the model as its being cut. Using the tkinter video tools, it would take far more power in the graphics engine to do that that is present in the older off lease computers we often use as the rest of linuxcnc can happily run at a 1khz loop rate on something as puny powered as an rpi3b, although the 3b is dragging its tongue on the floor. The 4b does it nicely, its been running a late 1940's Sheldon 11x54 lathe for quite a few years here. And even there, with only two axises to move, your only visualization on screen is the video tach that tells you how fast the workpiece is spinning, We have it in the DRO display overlaid in the backplot view, but no way to rotate the view of the workpiece. it doesn't exist. only a very simplified version of the tool exists in that video plot. Do you have a link where we can see it working? Thank you. Take care & stay well. Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
WF
William F. Adams
Tue, Nov 14, 2023 5:53 PM

On Tuesday, November 14, 2023 at 11:53:45 AM EST, gene heskett via Discuss discuss@lists.openscad.org wrote:

With a garage full of cnc machines for working metal and wood, I'll have 
to plead guilty to wishing linuxcnc, which I've been using to drive my
machines for over 20 years now, had a more capable realtime backplot
function. Originally written for your basic 3 axis mill it has grown the
ability to control 9 synchronized axises these days, but the
visualization has not kept pace. So there is no way to visualize a screw
as it is being turned on a 4 axis machine. By switching off the cut that
does the work. the tooth shape can be somewhat visualized, which helps a
lot and makes gcode development to carve that screw possible, but to see
it being carved is not possible given its current graphics ability.  It
needs the ability to generate a model, then spin the model as its being
cut. Using the tkinter video tools, it would take far more power in the
graphics engine to do that that is present in the older off lease
computers we often use as the rest of linuxcnc can happily run at a 1khz
loop rate on something as puny powered as an rpi3b, although the 3b is
dragging its tongue on the floor. The 4b does it nicely, its been
running a late 1940's Sheldon 11x54 lathe for quite a few years here.
And even there, with only two axises to move, your only visualization on
screen is the video tach that tells you how fast the workpiece is
spinning, We have it in the DRO display overlaid in the backplot view,
but no way to rotate the view of the workpiece. it doesn't exist. only a
very simplified version of the tool exists in that video plot.

Do you have a link where we can see it working?

I think the name which I used may be somewhat confusing things.
First, have you tried CAMotics?
https://camotics.org/

Second, I've written a bit and shown things in more detail in a couple of posts at:
https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153

and
https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729

Basically, the idea for what I've been working on is that one models a toolpath in OpenSCAD and then uses OpenSCAD to get a 3D preview of how it will cut with a given tool --- eventually including tooling which is unsupported by my current CAD/CAM tool:
https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723

Because I couldn't find a CAD/CAM program which works how I think --- so the preview of the G-code is based on the OpenSCAD code, and then the G-code gets written out and verified with a 3rd party tool such as CutViewer (or the afore-mentioned CAMotics), though I have to admit that I've only done one file which was suited to actually be cut as G-code --- a fancy surfacing file, because I haven't yet set up the repetitive structures needed for multiple passes along the Z-axis --- once PythonSCAD made it possible to write out a DXF, I've been focusing on that, importing the DXFs into a CAM tool where toolpaths can be assigned and that complexity handled by better programmers in a tool which gets wider usage and has more testing.
That said, I believe it will be possible to have a mode where:
 - a .nc file is read in (I guess stored in an array or other data structure?) - the dimensions of the stock are either entered, or read from specially formulated comments, or inferred from geometry - the G-code commands are then modeled as cuts to show a 3D preview and subtracted from the stock --- maybe the toolpaths could also be shown
but that's going to need for me to become a much better Python programmer (which I'm working at, but is slow going).
That said, there is at least one Python project which does this (reads in a G-code file and shows how it will cut using OpenSCAD): 
https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py

which probably could be leveraged in some way.
William

On Tuesday, November 14, 2023 at 11:53:45 AM EST, gene heskett via Discuss <discuss@lists.openscad.org> wrote: >With a garage full of cnc machines for working metal and wood, I'll have  >to plead guilty to wishing linuxcnc, which I've been using to drive my >machines for over 20 years now, had a more capable realtime backplot >function. Originally written for your basic 3 axis mill it has grown the >ability to control 9 synchronized axises these days, but the >visualization has not kept pace. So there is no way to visualize a screw >as it is being turned on a 4 axis machine. By switching off the cut that >does the work. the tooth shape can be somewhat visualized, which helps a >lot and makes gcode development to carve that screw possible, but to see >it being carved is not possible given its current graphics ability.  It >needs the ability to generate a model, then spin the model as its being >cut. Using the tkinter video tools, it would take far more power in the >graphics engine to do that that is present in the older off lease >computers we often use as the rest of linuxcnc can happily run at a 1khz >loop rate on something as puny powered as an rpi3b, although the 3b is >dragging its tongue on the floor. The 4b does it nicely, its been >running a late 1940's Sheldon 11x54 lathe for quite a few years here. >And even there, with only two axises to move, your only visualization on >screen is the video tach that tells you how fast the workpiece is >spinning, We have it in the DRO display overlaid in the backplot view, >but no way to rotate the view of the workpiece. it doesn't exist. only a >very simplified version of the tool exists in that video plot. > >Do you have a link where we can see it working? I think the name which I used may be somewhat confusing things. First, have you tried CAMotics? https://camotics.org/ Second, I've written a bit and shown things in more detail in a couple of posts at: https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153 and https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729 Basically, the idea for what I've been working on is that one models a toolpath in OpenSCAD and then uses OpenSCAD to get a 3D preview of how it will cut with a given tool --- eventually including tooling which is unsupported by my current CAD/CAM tool: https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723 Because I couldn't find a CAD/CAM program which works how I think --- so the preview of the G-code is based on the OpenSCAD code, and then the G-code gets written out and verified with a 3rd party tool such as CutViewer (or the afore-mentioned CAMotics), though I have to admit that I've only done one file which was suited to actually be cut as G-code --- a fancy surfacing file, because I haven't yet set up the repetitive structures needed for multiple passes along the Z-axis --- once PythonSCAD made it possible to write out a DXF, I've been focusing on that, importing the DXFs into a CAM tool where toolpaths can be assigned and that complexity handled by better programmers in a tool which gets wider usage and has more testing. That said, I believe it will be possible to have a mode where:  - a .nc file is read in (I guess stored in an array or other data structure?) - the dimensions of the stock are either entered, or read from specially formulated comments, or inferred from geometry - the G-code commands are then modeled as cuts to show a 3D preview and subtracted from the stock --- maybe the toolpaths could also be shown but that's going to need for me to become a much better Python programmer (which I'm working at, but is slow going). That said, there is at least one Python project which does this (reads in a G-code file and shows how it will cut using OpenSCAD):  https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py which probably could be leveraged in some way. William
GH
gene heskett
Tue, Nov 14, 2023 6:56 PM

On 11/14/23 12:53, William F. Adams via Discuss wrote:

On Tuesday, November 14, 2023 at 11:53:45 AM EST, gene heskett via
Discuss discuss@lists.openscad.org wrote:

With a garage full of cnc machines for working metal and wood, I'll have
to plead guilty to wishing linuxcnc, which I've been using to drive my
machines for over 20 years now, had a more capable realtime backplot
function. Originally written for your basic 3 axis mill it has grown the
ability to control 9 synchronized axises these days, but the
visualization has not kept pace. So there is no way to visualize a screw
as it is being turned on a 4 axis machine. By switching off the cut that
does the work. the tooth shape can be somewhat visualized, which helps a
lot and makes gcode development to carve that screw possible, but to see
it being carved is not possible given its current graphics ability.  It
needs the ability to generate a model, then spin the model as its being
cut. Using the tkinter video tools, it would take far more power in the
graphics engine to do that that is present in the older off lease
computers we often use as the rest of linuxcnc can happily run at a 1khz
loop rate on something as puny powered as an rpi3b, although the 3b is
dragging its tongue on the floor. The 4b does it nicely, its been
running a late 1940's Sheldon 11x54 lathe for quite a few years here.
And even there, with only two axises to move, your only visualization on
screen is the video tach that tells you how fast the workpiece is
spinning, We have it in the DRO display overlaid in the backplot view,
but no way to rotate the view of the workpiece. it doesn't exist. only a
very simplified version of the tool exists in that video plot.

Do you have a link where we can see it working?

I think the name which I used may be somewhat confusing things.

First, have you tried CAMotics?

No, and likely won't. Its 3 axis only. All my machines are two=lathes,
or 4 (milling machines) with an extra setup commonly called A (for X
axis spin) or B (for Y axis spin)  The spindle is not considered an
axis. Linuxcnc can do literally anything any of the commercial offerings
can do, probably faster, it is just up to the user to make it do it.
Its a toolbox I write my own gcode to use. The only helper in that
regard is a bit of python code by one of our users that calculates
circles or pieces thereof. Linuxcnc checxks arcs for accuracy, to small
fractions of a micron, and rejects them if not accurate enough.

I rebuilt a 6040 gantry mill for a 4th axis, and I wrote the gcode that
carved the woodworkers vise screws in the pix attached. Its hard maple,
a buttress 2 start thread, the rest printed. And probably 3x stronger
than anything you can buy on fleabay for $250.  But it needs a better
backplot visualizer than it has. Unfortunately I seem to ask 3d printers
to do what they should do but won't.  So ATM I am fighting with a
houseful of printers that are refusing to reliably print what I designed
in OpenSCAD.

https://camotics.org/ https://camotics.org/

Second, I've written a bit and shown things in more detail in a couple
of posts at:

https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153
https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153

and

https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729 https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729

Basically, the idea for what I've been working on is that one models a
toolpath in OpenSCAD and then uses OpenSCAD to get a 3D preview of how
it will cut with a given tool --- eventually including tooling which is
unsupported by my current CAD/CAM tool:

https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723 https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723

Because I couldn't find a CAD/CAM program which works how I think --- so
the preview of the G-code is based on the OpenSCAD code, and then the
G-code gets written out and verified with a 3rd party tool such as
CutViewer (or the afore-mentioned CAMotics), though I have to admit that
I've only done one file which was suited to actually be cut as G-code
--- a fancy surfacing file, because I haven't yet set up the repetitive
structures needed for multiple passes along the Z-axis --- once
PythonSCAD made it possible to write out a DXF, I've been focusing on
that, importing the DXFs into a CAM tool where toolpaths can be assigned
and that complexity handled by better programmers in a tool which gets
wider usage and has more testing.

That said, I believe it will be possible to have a mode where:

 - a .nc file is read in (I guess stored in an array or other data
structure?)
 - the dimensions of the stock are either entered, or read from
specially formulated comments, or inferred from geometry
 - the G-code commands are then modeled as cuts to show a 3D preview
and subtracted from the stock --- maybe the toolpaths could also be shown

but that's going to need for me to become a much better Python
programmer (which I'm working at, but is slow going).

That said, there is at least one Python project which does this (reads
in a G-code file and shows how it will cut using OpenSCAD):

https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py

which probably could be leveraged in some way.

William


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

Cheers, Gene Heskett.

"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.

  • Louis D. Brandeis
On 11/14/23 12:53, William F. Adams via Discuss wrote: > On Tuesday, November 14, 2023 at 11:53:45 AM EST, gene heskett via > Discuss <discuss@lists.openscad.org> wrote: > > >With a garage full of cnc machines for working metal and wood, I'll have > >to plead guilty to wishing linuxcnc, which I've been using to drive my > >machines for over 20 years now, had a more capable realtime backplot > >function. Originally written for your basic 3 axis mill it has grown the > >ability to control 9 synchronized axises these days, but the > >visualization has not kept pace. So there is no way to visualize a screw > >as it is being turned on a 4 axis machine. By switching off the cut that > >does the work. the tooth shape can be somewhat visualized, which helps a > >lot and makes gcode development to carve that screw possible, but to see > >it being carved is not possible given its current graphics ability.  It > >needs the ability to generate a model, then spin the model as its being > >cut. Using the tkinter video tools, it would take far more power in the > >graphics engine to do that that is present in the older off lease > >computers we often use as the rest of linuxcnc can happily run at a 1khz > >loop rate on something as puny powered as an rpi3b, although the 3b is > >dragging its tongue on the floor. The 4b does it nicely, its been > >running a late 1940's Sheldon 11x54 lathe for quite a few years here. > >And even there, with only two axises to move, your only visualization on > >screen is the video tach that tells you how fast the workpiece is > >spinning, We have it in the DRO display overlaid in the backplot view, > >but no way to rotate the view of the workpiece. it doesn't exist. only a > >very simplified version of the tool exists in that video plot. > > > >Do you have a link where we can see it working? > > I think the name which I used may be somewhat confusing things. > > First, have you tried CAMotics? No, and likely won't. Its 3 axis only. All my machines are two=lathes, or 4 (milling machines) with an extra setup commonly called A (for X axis spin) or B (for Y axis spin) The spindle is not considered an axis. Linuxcnc can do literally anything any of the commercial offerings can do, probably faster, it is just up to the user to make it do it. Its a toolbox I write my own gcode to use. The only helper in that regard is a bit of python code by one of our users that calculates circles or pieces thereof. Linuxcnc checxks arcs for accuracy, to small fractions of a micron, and rejects them if not accurate enough. I rebuilt a 6040 gantry mill for a 4th axis, and I wrote the gcode that carved the woodworkers vise screws in the pix attached. Its hard maple, a buttress 2 start thread, the rest printed. And probably 3x stronger than anything you can buy on fleabay for $250. But it needs a better backplot visualizer than it has. Unfortunately I seem to ask 3d printers to do what they should do but won't. So ATM I am fighting with a houseful of printers that are refusing to reliably print what I designed in OpenSCAD. > https://camotics.org/ <https://camotics.org/> > > Second, I've written a bit and shown things in more detail in a couple > of posts at: > > https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153 > <https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153> > > and > > https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729 <https://forum.makerforums.info/t/g-code-preview-using-openscad-rapcad/85729> > > Basically, the idea for what I've been working on is that one models a > toolpath in OpenSCAD and then uses OpenSCAD to get a 3D preview of how > it will cut with a given tool --- eventually including tooling which is > unsupported by my current CAD/CAM tool: > > https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723 <https://community.carbide3d.com/t/using-unsupported-tooling-in-carbide-create-roundover-cove-radius-bits/43723> > > Because I couldn't find a CAD/CAM program which works how I think --- so > the preview of the G-code is based on the OpenSCAD code, and then the > G-code gets written out and verified with a 3rd party tool such as > CutViewer (or the afore-mentioned CAMotics), though I have to admit that > I've only done one file which was suited to actually be cut as G-code > --- a fancy surfacing file, because I haven't yet set up the repetitive > structures needed for multiple passes along the Z-axis --- once > PythonSCAD made it possible to write out a DXF, I've been focusing on > that, importing the DXFs into a CAM tool where toolpaths can be assigned > and that complexity handled by better programmers in a tool which gets > wider usage and has more testing. > > That said, I believe it will be possible to have a mode where: > >  - a .nc file is read in (I guess stored in an array or other data > structure?) >  - the dimensions of the stock are either entered, or read from > specially formulated comments, or inferred from geometry >  - the G-code commands are then modeled as cuts to show a 3D preview > and subtracted from the stock --- maybe the toolpaths could also be shown > > but that's going to need for me to become a much better Python > programmer (which I'm working at, but is slow going). > > That said, there is at least one Python project which does this (reads > in a G-code file and shows how it will cut using OpenSCAD): > > https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py <https://github.com/arpruss/miscellaneous-scad/blob/master/scripts/gcode2scad.py> > > which probably could be leveraged in some way. > > William > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org Cheers, Gene Heskett. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author, 1940) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis
WF
William F. Adams
Tue, Nov 14, 2023 8:41 PM

On Tuesday, November 14, 2023 at 01:57:11 PM EST, gene heskett via Discuss discuss@lists.openscad.org wrote:

(re: trying CAMotics)

No, and likely won't. Its 3 axis only. All my machines are two=lathes,
or 4 (milling machines) with an extra setup commonly called A (for X
axis spin) or B (for Y axis spin)  The spindle is not considered an
axis. Linuxcnc can do literally anything any of the commercial offerings
can do, probably faster, it is just up to the user to make it do it.
Its a toolbox I write my own gcode to use. The only helper in that
regard is a bit of python code by one of our users that calculates
circles or pieces thereof. Linuxcnc checxks arcs for accuracy, to small
fractions of a micron, and rejects them if not accurate enough.

I rebuilt a 6040 gantry mill for a 4th axis, and I wrote the gcode that
carved the woodworkers vise screws in the pix attached. Its hard maple,
a buttress 2 start thread, the rest printed. And probably 3x stronger
than anything you can buy on fleabay for $250.  

Nice!

But it needs a better
backplot visualizer than it has. 

The only other tool I can think of is Grbgru --- if you're willing to run Windows:
https://www.grblgru.com/

It has lathe support, but not sure how good it is.

Unfortunately I seem to ask 3d printers
to do what they should do but won't.  So ATM I am fighting with a
houseful of printers that are refusing to reliably print what I designed
in OpenSCAD.

Have you considered:
http://fullcontrolgcode.com/

There's a Python version:
https://github.com/FullControlXYZ/fullcontrol

which I think takes us fully off-topic --- probably best to take this to a direct e-mail if need be --- I cc:d myself if anyone has any further questions of me which are off-topic.
William

On Tuesday, November 14, 2023 at 01:57:11 PM EST, gene heskett via Discuss <discuss@lists.openscad.org> wrote: (re: trying CAMotics) >No, and likely won't. Its 3 axis only. All my machines are two=lathes, >or 4 (milling machines) with an extra setup commonly called A (for X >axis spin) or B (for Y axis spin)  The spindle is not considered an >axis. Linuxcnc can do literally anything any of the commercial offerings >can do, probably faster, it is just up to the user to make it do it. >Its a toolbox I write my own gcode to use. The only helper in that >regard is a bit of python code by one of our users that calculates >circles or pieces thereof. Linuxcnc checxks arcs for accuracy, to small >fractions of a micron, and rejects them if not accurate enough. >I rebuilt a 6040 gantry mill for a 4th axis, and I wrote the gcode that >carved the woodworkers vise screws in the pix attached. Its hard maple, >a buttress 2 start thread, the rest printed. And probably 3x stronger >than anything you can buy on fleabay for $250.   Nice! >But it needs a better >backplot visualizer than it has.  The only other tool I can think of is Grbgru --- if you're willing to run Windows: https://www.grblgru.com/ It has lathe support, but not sure how good it is. >Unfortunately I seem to ask 3d printers >to do what they should do but won't.  So ATM I am fighting with a >houseful of printers that are refusing to reliably print what I designed >in OpenSCAD. Have you considered: http://fullcontrolgcode.com/ There's a Python version: https://github.com/FullControlXYZ/fullcontrol which I think takes us fully off-topic --- probably best to take this to a direct e-mail if need be --- I cc:d myself if anyone has any further questions of me which are off-topic. William