summaryrefslogtreecommitdiff
path: root/src/openscad.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-03-03 18:20:18 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-03-03 18:20:18 (GMT)
commitf190b9605c11d9b49102046f578a18de2f8d84b1 (patch)
treed407b71a412a64a862a5c554ceb21123a3e6b65c /src/openscad.cc
parent9f5c6133bf55713ada6133d7beffbeddd86ffecf (diff)
add imgsize cmdline parameter for png output
Diffstat (limited to 'src/openscad.cc')
-rw-r--r--src/openscad.cc34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/openscad.cc b/src/openscad.cc
index 2a04cc7..f8c53df 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -36,6 +36,7 @@
#include "printutils.h"
#include "handle_dep.h"
#include "parsersettings.h"
+#include "rendersettings.h"
#include <string>
#include <vector>
@@ -74,10 +75,13 @@ namespace fs = boost::filesystem;
static void help(const char *progname)
{
int tab = int(strlen(progname))+8;
- fprintf(stderr, "Usage: %s [ -o output_file [ -d deps_file ] ]\\\n"
- "%*s[ -m make_command ] [ -D var=val [..] ] [ --render ] \\\n"
- "%*s[ --viewport=x,y,z,xrot,yrot,zrot,dist ] filename\n",
- progname, tab, "", tab, "");
+ fprintf(stderr,"Usage: %s [ -o output_file [ -d deps_file ] ]\\\n"
+ "%*s[ -m make_command ] [ -D var=val [..] ] [ --render ] \\\n"
+ "%*s[ --gimbalcam=x,y,z,xrot,yrot,zrot,dist ] \\\n"
+ "%*s[ --vectorcam=eyex,eyey,eyez,centerx,centery,centerz] \\\n"
+ "%*s[ --imgsize=width,height ] \\\n"
+ " filename\n",
+ progname, tab, "", tab, "", tab, "", tab, "");
exit(1);
}
@@ -131,6 +135,23 @@ Camera determine_camera( po::variables_map vm )
return camera;
}
+std::pair<int,int> get_imgsize( po::variables_map vm )
+{
+ int w = RenderSettings::inst()->img_width;
+ int h = RenderSettings::inst()->img_height;
+ if (vm.count("imgsize")) {
+ vector<string> strs;
+ split(strs, vm["imgsize"].as<string>(), is_any_of(","));
+ if ( strs.size() != 2 ) {
+ fprintf(stderr,"Need 2 numbers for imgsize\n");
+ } else {
+ w = lexical_cast<int>( strs[0] );
+ h = lexical_cast<int>( strs[0] );
+ }
+ }
+ return std::pair<int,int>(w,h);
+}
+
int main(int argc, char **argv)
{
int rc = 0;
@@ -174,6 +195,8 @@ int main(int argc, char **argv)
("version,v", "print the version")
("render", "if exporting a png image, do a full CGAL render")
("gimbalcam", po::value<string>(), "=x,y,z,xrot,yrot,zrot,dist for exporting png")
+ ("vectorcam", po::value<string>(), "=eyex,y,z,centerx,y,z for exporting png")
+ ("imgsize", po::value<string>(), "=width,height for exporting png")
("o,o", po::value<string>(), "out-file")
("s,s", po::value<string>(), "stl-file")
("x,x", po::value<string>(), "dxf-file")
@@ -249,6 +272,9 @@ int main(int argc, char **argv)
currentdir = boosty::stringy(fs::current_path());
Camera camera = determine_camera( vm );
+ std::pair<int,int> imgsize = get_imgsize( vm );
+ camera.pixel_width = imgsize.first;
+ camera.pixel_height = imgsize.second;
QDir exdir(QApplication::instance()->applicationDirPath());
#ifdef Q_WS_MAC
contact: Jan Huwald // Impressum