Hello,
An idea/feature request.
Normally I have a number of different 3d-models in same openscad sketch
defined as modules called in global area like:
part1();
//part2();
//part3();
module part1(){...}
module part2(){...}
module part2(){...}
When export to STL, uncomment part1, comment part2 and part3, press F6,
select export to STL from menu, enter file name, save. Then comment part1,
uncomment part2 etc. Quite toilsome updating export for design with many
parts.
This could be much nicer to export all parts in one batch by calling
something like:
export(file="export/part1.stl") part1();
export(file="export/part2.stl") part2();
export(file="export/part3.stl") part3();
thank's
--
View this message in context: http://forum.openscad.org/Programmatic-export-to-stl-from-OpenSCAD-sketch-tp17437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
This can be done already using a small external script.
part = 1;
module part1() {
cube(10);
}
module part2() {
sphere(10);
}
module part3() {
cylinder(r = 10, h = 5);
}
module export(part) {
if (part == 1) part1();
if (part == 2) part2();
if (part == 3) part3();
}
export(part);
openscad -D"part=1" -o part1.stl parts.scad
openscad -D"part=2" -o part2.stl parts.scad
openscad -D"part=3" -o part3.stl parts.scad
ciao,
Torsten.
Here is my proposal for how this would work:
https://github.com/openscad/openscad/issues/1608
For your example, the syntax would be:
part("part1") part1();
part("part2") part2();
part("part3") part3();
If you export this as STL, you'll get a file dialog where you specify the
output directory, then 3 STL files are created in that directory
(part1.stl, part2.stl, part3.stl).
If you export this as AMF, then all 3 parts are output as separate named
objects within a single AMF file.
On 26 May 2016 at 18:10, 1i7 benderamp@gmail.com wrote:
Hello,
An idea/feature request.
Normally I have a number of different 3d-models in same openscad sketch
defined as modules called in global area like:
part1();
//part2();
//part3();
module part1(){...}
module part2(){...}
module part2(){...}
When export to STL, uncomment part1, comment part2 and part3, press F6,
select export to STL from menu, enter file name, save. Then comment part1,
uncomment part2 etc. Quite toilsome updating export for design with many
parts.
This could be much nicer to export all parts in one batch by calling
something like:
export(file="export/part1.stl") part1();
export(file="export/part2.stl") part2();
export(file="export/part3.stl") part3();
thank's
--
View this message in context:
http://forum.openscad.org/Programmatic-export-to-stl-from-OpenSCAD-sketch-tp17437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Hi
Use operator "!" before the part you want to export.
--
View this message in context: http://forum.openscad.org/Programmatic-export-to-stl-from-OpenSCAD-sketch-tp17437p17441.html
Sent from the OpenSCAD mailing list archive at Nabble.com.