summaryrefslogtreecommitdiff
path: root/src/openscad.cc
diff options
context:
space:
mode:
authorchrysn <chrysn@fsfe.org>2013-06-24 18:10:15 (GMT)
committerchrysn <chrysn@fsfe.org>2013-06-25 11:41:49 (GMT)
commit2006824c24fe5611fe6f2cbb5453f43b0066f0a9 (patch)
tree2fc12563fc58dcc7d32885f8d0d01d43ac476057 /src/openscad.cc
parent06fd345dfc1b613d807ac31a766bd50fc4812148 (diff)
drop moduledumptest, use `openscad -o ${NAME}.ast`
src/openscad.cc code was copy/pasted from .csg section; some refactoring might make things nicer, but i didn't dare change too much for lack of language knowledge
Diffstat (limited to 'src/openscad.cc')
-rw-r--r--src/openscad.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/openscad.cc b/src/openscad.cc
index 2619914..483d03e 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -313,6 +313,7 @@ int main(int argc, char **argv)
const char *dxf_output_file = NULL;
const char *csg_output_file = NULL;
const char *png_output_file = NULL;
+ const char *ast_output_file = NULL;
bool null_output = false;
QString suffix = QFileInfo(output_file).suffix().toLower();
@@ -321,6 +322,7 @@ int main(int argc, char **argv)
else if (suffix == "dxf") dxf_output_file = output_file;
else if (suffix == "csg") csg_output_file = output_file;
else if (suffix == "png") png_output_file = output_file;
+ else if (suffix == "ast") ast_output_file = output_file;
else if (strcmp(output_file, "null") == 0) null_output = true;
else {
fprintf(stderr, "Unknown suffix for output file %s\n", output_file);
@@ -383,6 +385,18 @@ int main(int argc, char **argv)
fstream.close();
}
}
+ else if (ast_output_file) {
+ fs::current_path(original_path);
+ std::ofstream fstream(ast_output_file);
+ if (!fstream.is_open()) {
+ PRINTB("Can't open file \"%s\" for export", ast_output_file);
+ }
+ else {
+ fs::current_path(fparent); // Force exported filenames to be relative to document path
+ fstream << root_module->dump("", "") << "\n";
+ fstream.close();
+ }
+ }
else {
#ifdef ENABLE_CGAL
if ((null_output || png_output_file) && !vm.count("render")) {
contact: Jan Huwald // Impressum