I've been experimenting with direct G-code generation in OpenSCAD . The
problem is that I can only output the code by echoing to the console where
it gets mixed up with other logging. Is there a better way, when running a
script in command mode ?
I had the same issue when generating SVG directly - in both cases its
rather a perverted use of OpenSCAD except that I value the language itself
for this work, with first-class vectors, list comprehension etc and the
ability to generate a visualisation of an object at the same time as
outputting code.
Kit
Kit
In command line mode you can use -o to make an echo file which I think is
just the echos plus errors and warnings. I process the files with Python
and look for lines starting with 'ECHO: '. and strip the prefix.
On Tue, 21 Sept 2021 at 12:52, Chris Wallace kit.wallace@gmail.com wrote:
I've been experimenting with direct G-code generation in OpenSCAD . The
problem is that I can only output the code by echoing to the console where
it gets mixed up with other logging. Is there a better way, when running a
script in command mode ?
I had the same issue when generating SVG directly - in both cases its
rather a perverted use of OpenSCAD except that I value the language itself
for this work, with first-class vectors, list comprehension etc and the
ability to generate a visualisation of an object at the same time as
outputting code.
Kit
Kit
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Chris wrote:
I've been experimenting with direct G-code generation in OpenSCAD . >The problem is that I can only output the code by echoing to the console >where it gets mixed up with other logging. Is there a better way, when >running a script in command mode ?
I've tried this myself and raised it as an issue, and asked for support for it:
https://github.com/openscad/openscad/issues/2017
I'd really like to see a preference for always writing out everything written using Echo to a file w/ a user-defined file extension --- it would be useful for a lot of things.
That said, further issues are:
- objects get complex - performance bogs down - order of operations becomes a concern
I had the same issue when generating SVG directly - in both cases >its rather a perverted use of OpenSCAD except that I value the language >itself for this work, with first-class vectors, list comprehension etc and the >ability to generate a visualisation of an object at the same time as outputting code.
Same here, though I never went so far as to make an SVG --- when I've wanted a vector I've either used projection() to flatten things, if need be, doing it multiple times offset by a known distance which were then stacked on top of each other for the CAM step.
Usually when I need a vector I just make it directly using METAPOST:
https://tug.org/TUGboat/tb40-2/tb125adams-3d.pdf
William
Alternatively, I often use Python to write OpenSCAD files. Once I have the
output file open in OpenSCAD, subsequent runs of the Python program
automatically display the changed OpenSCAD preview.
On Tue, Sep 21, 2021 at 7:10 AM nop head nop.head@gmail.com wrote:
In command line mode you can use -o to make an echo file which I think is
just the echos plus errors and warnings. I process the files with Python
and look for lines starting with 'ECHO: '. and strip the prefix.
On Tue, 21 Sept 2021 at 12:52, Chris Wallace kit.wallace@gmail.com
wrote:
I've been experimenting with direct G-code generation in OpenSCAD . The
problem is that I can only output the code by echoing to the console where
it gets mixed up with other logging. Is there a better way, when running a
script in command mode ?
I had the same issue when generating SVG directly - in both cases its
rather a perverted use of OpenSCAD except that I value the language itself
for this work, with first-class vectors, list comprehension etc and the
ability to generate a visualisation of an object at the same time as
outputting code.
Kit
Kit
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
Leonard wrote:
Alternatively, I often use Python to write OpenSCAD files. Once I have the output file open in OpenSCAD, subsequent runs of the Python program automatically display the changed OpenSCAD preview.
Yeah, this is so common there's a section devoted to listing such projects at:
https://wiki.shapeoko.com/index.php/Programming#Python
and I've even gotten started on my own:
https://community.carbide3d.com/t/previewing-g-code-using-openscad/35153
It would be nice if we could avoid all this redundant effort --- all I want is an option and checkbox as a preference:
[ ] Write out only Echo text using file extension: _____ (no other log information, or redundant text such as "ECHO: " will be included)
I will gladly donate a CNC machine (Shapeoko 3 Standard size w/ Z-Plus axis) to the person who is willing to do this --- just let me know.
William
If you start each echo with, say a '?' after the ", then when you copy
the console into another text file, either manually or with a simple
program, you can parse it for 'ECHO: "?', and edit accordingly. As it
stands,, echo does not handle new lines, and other white space, but you
could use something like '/nl' or whatever, if needed. The '?' or other
special character will allow text that you want to print to be separated
from other echo's.
echo(str("point 1 = ",p1));
echo (str("? point 2 = ",p2));
echo (str("? distance point 1 to point 2 = ", norm(p2-p1)));
results in
ECHO: "point 1 = [36.65, 177.8, 0.5]"
ECHO: "? point 2 = [53.5, 177.98, 0.2]"
ECHO: "? distance point 1 to point 2 = 16.8536"
which filtering on ' ECHO: "?' becomes
point 2 = [53.5, 177.98, 0.2]
distance point 1 to point 2 = 16.8536
For more descriptive text, then either use the same principle but for
comments in the scad program, or open a word processor in another
window, (copying code into echo, causes misbehaviour.)
The open scad editor is good for editing code, but it is not the tool
that you want to use for writing documents.
Yes, but one still has to do that, for each file, for each time it's run, and set it up for each project. That's a lot of duplicated effort.
I don't want to use OpenSCAD as a word-processor --- I want to use it as a programmatic system for generating geometry and associated files:
- bill of material - assembly instructions - G-Code for cutting out parts - SVGs w/ curves as opposed to polylines
Lots of folks have had this need, and lots of folks have solved it in a number of ways (and I appreciate the right-click menu entries which make working w/ the Log easier), but it would help a lot of folks work much more comfortably and efficiently to have a way to write out text files which are directly usable and with the ability to control the file extension.
What would be involved in creating a Bounty for this?
How should it be worded?
Anyone able to estimate how much would be needed to attract the attention of a developer?
William