mirror of https://github.com/vitalif/openscad
commit
694382bba9
40
README.md
40
README.md
|
@ -1,4 +1,5 @@
|
|||
# What is OpenSCAD?
|
||||
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=openscad&url=http://openscad.org&title=OpenSCAD&language=&tags=github&category=software)
|
||||
|
||||
OpenSCAD is a software for creating solid 3D CAD objects. It is free software
|
||||
and available for Linux/UNIX, MS Windows and Mac OS X.
|
||||
|
@ -78,10 +79,10 @@ To build OpenSCAD, you need some libraries and tools. The version
|
|||
numbers in brackets specify the versions which have been used for
|
||||
development. Other versions may or may not work as well.
|
||||
|
||||
If you're using Ubuntu, you can install these libraries from
|
||||
aptitude. If you're using Mac, there is a build script that compiles
|
||||
the libraries from source. Follow the instructions for the platform
|
||||
you're compiling on below.
|
||||
If you're using a newer version of Ubuntu, you can install these
|
||||
libraries from aptitude. If you're using Mac, or an older Linux, there
|
||||
are build scripts that download and compile the libraries from source.
|
||||
Follow the instructions for the platform you're compiling on below.
|
||||
|
||||
* [Qt4 (4.4 - 4.7)](http://www.qt.nokia.com/)
|
||||
* [CGAL (3.6 - 3.9)](http://www.cgal.org/)
|
||||
|
@ -116,15 +117,34 @@ compilation process.
|
|||
|
||||
After that, follow the Compilation instructions below.
|
||||
|
||||
### Building for Ubuntu
|
||||
### Building for newer Ubunutu
|
||||
|
||||
If you have done this and want to contribute, fork the repo and
|
||||
contribute docs on how to build for windows!
|
||||
sudo apt-get install libqt4-dev libqt4-opengl-dev libxmu-dev cmake \
|
||||
libglew1.5-dev bison flex libeigen2-dev git-core libboost-all-dev \
|
||||
libXi-dev libcgal-dev libglut3-dev libopencsg-dev libopencsg1
|
||||
|
||||
Check your library versions against the list above. After that, follow
|
||||
the Compilation instructions below.
|
||||
|
||||
### Building for older Linux or without root access
|
||||
|
||||
First, make sure that you have compiler tools (build-essential on ubuntu).
|
||||
Then after you've cloned this git repository, run the script that sets up the
|
||||
environment variables.
|
||||
|
||||
source ./scripts/setenv-linbuild.sh
|
||||
|
||||
Then run the script to download & compile all the prerequisite libraries above:
|
||||
|
||||
./scripts/linux-build-dependencies.sh
|
||||
|
||||
After that, follow the Compilation instructions below.
|
||||
|
||||
### Building for Windows
|
||||
|
||||
If you have done this and want to contribute, fork the repo and
|
||||
contribute docs on how to build for windows!
|
||||
OpenSCAD for Windows is usually cross-compiled from Linux. If you wish to
|
||||
attempt an MSVC build, please see this site:
|
||||
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_on_Windows
|
||||
|
||||
### Compilation
|
||||
|
||||
|
@ -137,3 +157,5 @@ Then run make. Finally you might run 'make install' as root or simply copy the
|
|||
If you had problems compiling from source, raise a new issue in the
|
||||
[issue tracker on the github page](https://github.com/openscad/openscad/issues).
|
||||
|
||||
The four subsections of this site can also be helpful:
|
||||
http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Building_OpenSCAD_from_Sources
|
||||
|
|
|
@ -7,15 +7,12 @@
|
|||
# Usage: linux-build-dependencies.sh
|
||||
#
|
||||
# Prerequisites:
|
||||
# - curl
|
||||
# -- you can uncomment 'build_curl' at the bottom
|
||||
# -- and add $BASEDIR/bin to your PATH, i.e. in .bash_profile
|
||||
# - wget or curl
|
||||
# - Qt4
|
||||
# - cmake 2.8
|
||||
# -- you can uncomment 'build_cmake' at the bottom
|
||||
# - cmake 2.8 ( force build_cmake at bottom if yours is too old )
|
||||
#
|
||||
|
||||
BASEDIR=$HOME
|
||||
BASEDIR=$HOME/openscad_deps
|
||||
OPENSCADDIR=$PWD
|
||||
SRCDIR=$BASEDIR/src
|
||||
DEPLOYDIR=$BASEDIR
|
||||
|
@ -87,12 +84,10 @@ build_mpfr()
|
|||
cd $BASEDIR/src
|
||||
rm -rf mpfr-$version
|
||||
if [ ! -f mpfr-$version.tar.bz2 ]; then
|
||||
curl -O http://www.mpfr.org/mpfr-current/mpfr-$version.tar.bz2
|
||||
curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2
|
||||
fi
|
||||
tar xjf mpfr-$version.tar.bz2
|
||||
cd mpfr-$version
|
||||
curl -O http://www.mpfr.org/mpfr-current/allpatches
|
||||
patch -N -Z -p1 < allpatches
|
||||
mkdir build
|
||||
cd build
|
||||
../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR
|
||||
|
@ -150,6 +145,10 @@ build_glew()
|
|||
tar xzf glew-$version.tgz
|
||||
cd glew-$version
|
||||
mkdir -p $DEPLOYDIR/lib/pkgconfig
|
||||
|
||||
# uncomment this kludge for Fedora 64bit
|
||||
# sed -i s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux
|
||||
|
||||
GLEW_DEST=$DEPLOYDIR make -j$NUMCPU
|
||||
GLEW_DEST=$DEPLOYDIR make install
|
||||
}
|
||||
|
@ -166,6 +165,10 @@ build_opencsg()
|
|||
tar xzf OpenCSG-$version.tar.gz
|
||||
cd OpenCSG-$version
|
||||
sed -i s/example// opencsg.pro # examples might be broken without GLUT
|
||||
|
||||
# uncomment this kludge for Fedora 64bit
|
||||
# sed -i s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile
|
||||
|
||||
qmake-qt4
|
||||
make
|
||||
install -v lib/* $DEPLOYDIR/lib
|
||||
|
@ -208,20 +211,29 @@ echo "Using srcdir:" $SRCDIR
|
|||
echo "Number of CPUs for parallel builds:" $NUMCPU
|
||||
mkdir -p $SRCDIR $DEPLOYDIR
|
||||
|
||||
#build_curl 7.26.0
|
||||
export PATH=$BASEDIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_LIBRARY_PATH
|
||||
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64:$LD_RUN_PATH
|
||||
echo "PATH modified temporarily"
|
||||
echo "LD_LIBRARY_PATH modified temporarily"
|
||||
echo "LD_RUN_PATH modified temporarily"
|
||||
|
||||
if [ ! "`command -v curl`" ]; then
|
||||
build_curl 7.26.0
|
||||
fi
|
||||
|
||||
# NB! For cmake, also update the actual download URL in the function
|
||||
#build_cmake 2.8.8
|
||||
if [ ! "`command -v cmake`" ]; then
|
||||
build_cmake 2.8.8
|
||||
fi
|
||||
|
||||
build_eigen 2.0.17
|
||||
build_gmp 5.0.5
|
||||
build_mpfr 3.1.0
|
||||
build_mpfr 3.1.1
|
||||
build_boost 1.47.0
|
||||
# NB! For CGAL, also update the actual download URL in the function
|
||||
build_cgal 4.0
|
||||
build_glew 1.7.0
|
||||
build_opencsg 1.3.2
|
||||
|
||||
echo "Now do this:"
|
||||
echo "export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64"
|
||||
echo "GLEWDIR=$DEPLOYDIR OPENSCAD_LIBRARIES=$DEPLOYDIR qmake-qt4"
|
||||
echo "make -j$NUMCPU"
|
||||
|
||||
echo "OpenSCAD dependencies built in " $BASEDIR
|
||||
|
|
|
@ -186,6 +186,6 @@ case $OS in
|
|||
strip openscad-$VERSION/lib/openscad/*
|
||||
cp scripts/installer-linux.sh openscad-$VERSION/install.sh
|
||||
chmod 755 -R openscad-$VERSION/
|
||||
tar cz openscad-$VERSION > openscad-$VERSION.x86-64.tar.gz
|
||||
tar cz openscad-$VERSION > openscad-$VERSION.x86-$ARCH.tar.gz
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# setup env variables for building OpenSCAD against custom built
|
||||
# dependency libraries from linux-build-dependencies.sh
|
||||
|
||||
# run this file with 'source setenv-linbuild.sh'
|
||||
|
||||
# BASEDIR and DEPLOYDIR must be the same as in linux-build-dependencies.sh
|
||||
BASEDIR=$HOME/openscad_deps
|
||||
DEPLOYDIR=$BASEDIR
|
||||
|
||||
export PATH=$BASEDIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
|
||||
export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64
|
||||
export OPENSCAD_LIBRARIES=$DEPLOYDIR
|
||||
export GLEWDIR=$DEPLOYDIR
|
||||
|
||||
echo BASEDIR: $BASEDIR
|
||||
echo DEPLOYDIR: $DEPLOYDIR
|
||||
echo PATH modified
|
||||
echo LD_LIBRARY_PATH modified
|
||||
echo LD_RUN_PATH modified
|
||||
echo OPENSCAD_LIBRARIES modified
|
||||
echo GLEWDIR modified
|
||||
|
|
@ -11,6 +11,8 @@ fi
|
|||
|
||||
if [[ $OSTYPE =~ "darwin" ]]; then
|
||||
OS=MACOSX
|
||||
elif [[ $OSTYPE == "linux-gnu" ]]; then
|
||||
OS=LINUX
|
||||
fi
|
||||
|
||||
indexfile=../openscad.github.com/index.html
|
||||
|
@ -21,6 +23,10 @@ if [ -f $indexfile ]; then
|
|||
file2=$2
|
||||
sed -i .backup -e "s/^\(.*win-snapshot-zip.*\)\(OpenSCAD-.*\.zip\)\(.*\)\(OpenSCAD-.*zip\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile
|
||||
sed -i .backup -e "s/^\(.*win-snapshot-exe.*\)\(OpenSCAD-.*-Installer\.exe\)\(.*\)\(OpenSCAD-.*-Installer.exe\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile
|
||||
elif [ $OS == LINUX ]; then
|
||||
file2=$2
|
||||
sed -i .backup -e "s/^\(.*linux-snapshot-32.*\)\(openscad-.*-32\.tar\.gz\)\(.*\)\(openscad-.*-32\.tar\.gz\)\(.*$\)/\\1$file1\\3$file1\\5/" $indexfile
|
||||
sed -i .backup -e "s/^\(.*linux-snapshot-64.*\)\(openscad-.*-64\.tar\.gz\)\(.*\)\(openscad-.*-64\.tar\.gz\)\(.*$\)/\\1$file2\\3$file2\\5/" $indexfile
|
||||
fi
|
||||
echo "Web page updated. Remember to commit and push openscad.github.com"
|
||||
else
|
||||
|
|
|
@ -5,25 +5,29 @@
|
|||
/*!
|
||||
NB! for e.g. empty intersections, this can normalize a tree to nothing and return NULL.
|
||||
*/
|
||||
shared_ptr<CSGTerm> CSGTermNormalizer::normalize(const shared_ptr<CSGTerm> &root,
|
||||
size_t limit)
|
||||
shared_ptr<CSGTerm> CSGTermNormalizer::normalize(const shared_ptr<CSGTerm> &root)
|
||||
{
|
||||
shared_ptr<CSGTerm> temp = root;
|
||||
while (1) {
|
||||
this->rootnode = temp;
|
||||
this->nodecount = 0;
|
||||
shared_ptr<CSGTerm> n = normalizePass(temp);
|
||||
if (!n) return n; // If normalized to nothing
|
||||
if (temp == n) break;
|
||||
temp = n;
|
||||
|
||||
unsigned int num = count(temp);
|
||||
#ifdef DEBUG
|
||||
PRINTB("Normalize count: %d\n", num);
|
||||
#endif
|
||||
if (num > limit) {
|
||||
PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", limit);
|
||||
return root;
|
||||
if (this->nodecount > this->limit) {
|
||||
PRINTB("WARNING: Normalized tree is growing past %d elements. Aborting normalization.\n", this->limit);
|
||||
// Clean up any partially evaluated terms
|
||||
shared_ptr<CSGTerm> newroot = root, tmproot;
|
||||
while (newroot != tmproot) {
|
||||
tmproot = newroot;
|
||||
newroot = collapse_null_terms(tmproot);
|
||||
}
|
||||
return newroot;
|
||||
}
|
||||
}
|
||||
this->rootnode.reset();
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
@ -42,7 +46,11 @@ shared_ptr<CSGTerm> CSGTermNormalizer::normalizePass(shared_ptr<CSGTerm> term)
|
|||
}
|
||||
|
||||
do {
|
||||
while (term && normalize_tail(term)) { }
|
||||
while (term && match_and_replace(term)) { }
|
||||
this->nodecount++;
|
||||
if (nodecount > this->limit) {
|
||||
return shared_ptr<CSGTerm>();
|
||||
}
|
||||
if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term;
|
||||
if (term->left) term->left = normalizePass(term->left);
|
||||
} while (term->type != CSGTerm::TYPE_UNION &&
|
||||
|
@ -51,6 +59,11 @@ shared_ptr<CSGTerm> CSGTermNormalizer::normalizePass(shared_ptr<CSGTerm> term)
|
|||
term->right = normalizePass(term->right);
|
||||
|
||||
// FIXME: Do we need to take into account any transformation of item here?
|
||||
return collapse_null_terms(term);
|
||||
}
|
||||
|
||||
shared_ptr<CSGTerm> CSGTermNormalizer::collapse_null_terms(const shared_ptr<CSGTerm> &term)
|
||||
{
|
||||
if (!term->right) {
|
||||
if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_DIFFERENCE) return term->left;
|
||||
else return term->right;
|
||||
|
@ -59,13 +72,14 @@ shared_ptr<CSGTerm> CSGTermNormalizer::normalizePass(shared_ptr<CSGTerm> term)
|
|||
if (term->type == CSGTerm::TYPE_UNION) return term->right;
|
||||
else return term->left;
|
||||
}
|
||||
|
||||
return term;
|
||||
}
|
||||
|
||||
bool CSGTermNormalizer::normalize_tail(shared_ptr<CSGTerm> &term)
|
||||
bool CSGTermNormalizer::match_and_replace(shared_ptr<CSGTerm> &term)
|
||||
{
|
||||
if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_PRIMITIVE) return false;
|
||||
if (term->type == CSGTerm::TYPE_UNION || term->type == CSGTerm::TYPE_PRIMITIVE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Part A: The 'x . (y . z)' expressions
|
||||
|
||||
|
@ -149,8 +163,9 @@ bool CSGTermNormalizer::normalize_tail(shared_ptr<CSGTerm> &term)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Counts all non-leaf nodes
|
||||
unsigned int CSGTermNormalizer::count(const shared_ptr<CSGTerm> &term) const
|
||||
{
|
||||
if (!term) return 0;
|
||||
return term->type == CSGTerm::TYPE_PRIMITIVE ? 1 : 0 + count(term->left) + count(term->right);
|
||||
return term->type == CSGTerm::TYPE_PRIMITIVE ? 0 : 1 + count(term->left) + count(term->right);
|
||||
}
|
||||
|
|
|
@ -6,15 +6,20 @@
|
|||
class CSGTermNormalizer
|
||||
{
|
||||
public:
|
||||
CSGTermNormalizer() {}
|
||||
CSGTermNormalizer(size_t limit) : limit(limit) {}
|
||||
~CSGTermNormalizer() {}
|
||||
|
||||
shared_ptr<class CSGTerm> normalize(const shared_ptr<CSGTerm> &term, size_t limit);
|
||||
shared_ptr<class CSGTerm> normalize(const shared_ptr<CSGTerm> &term);
|
||||
|
||||
private:
|
||||
shared_ptr<CSGTerm> normalizePass(shared_ptr<CSGTerm> term) ;
|
||||
bool normalize_tail(shared_ptr<CSGTerm> &term);
|
||||
bool match_and_replace(shared_ptr<CSGTerm> &term);
|
||||
shared_ptr<CSGTerm> collapse_null_terms(const shared_ptr<CSGTerm> &term);
|
||||
unsigned int count(const shared_ptr<CSGTerm> &term) const;
|
||||
|
||||
size_t limit;
|
||||
size_t nodecount;
|
||||
shared_ptr<class CSGTerm> rootnode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -118,7 +118,7 @@ use[ \t\r\n>]*"<" { BEGIN(cond_use); }
|
|||
else {
|
||||
usepath = sourcepath() / filename;
|
||||
if (!fs::exists(usepath)) {
|
||||
usepath = boosty::absolute(fs::path(get_librarydir()) / filename);
|
||||
usepath = locate_file(filename);
|
||||
}
|
||||
}
|
||||
/* Only accept regular files which exists */
|
||||
|
@ -214,7 +214,7 @@ void includefile()
|
|||
|
||||
fs::path finfo = dirinfo / filename;
|
||||
if (!exists(finfo)) {
|
||||
finfo = fs::path(get_librarydir()) / filepath / filename;
|
||||
finfo = locate_file((fs::path(filepath) / filename).string());
|
||||
}
|
||||
|
||||
filepath.clear();
|
||||
|
|
|
@ -721,9 +721,9 @@ void MainWindow::compileCSG(bool procevents)
|
|||
if (procevents)
|
||||
QApplication::processEvents();
|
||||
|
||||
CSGTermNormalizer normalizer;
|
||||
size_t normalizelimit = 2 * Preferences::inst()->getValue("advanced/openCSGLimit").toUInt();
|
||||
this->root_norm_term = normalizer.normalize(this->root_raw_term, normalizelimit);
|
||||
CSGTermNormalizer normalizer(normalizelimit);
|
||||
this->root_norm_term = normalizer.normalize(this->root_raw_term);
|
||||
if (this->root_norm_term) {
|
||||
this->root_chain = new CSGChain();
|
||||
this->root_chain->import(this->root_norm_term);
|
||||
|
@ -743,7 +743,7 @@ void MainWindow::compileCSG(bool procevents)
|
|||
|
||||
highlights_chain = new CSGChain();
|
||||
for (unsigned int i = 0; i < highlight_terms.size(); i++) {
|
||||
highlight_terms[i] = normalizer.normalize(highlight_terms[i], normalizelimit);
|
||||
highlight_terms[i] = normalizer.normalize(highlight_terms[i]);
|
||||
highlights_chain->import(highlight_terms[i]);
|
||||
}
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ void MainWindow::compileCSG(bool procevents)
|
|||
|
||||
background_chain = new CSGChain();
|
||||
for (unsigned int i = 0; i < background_terms.size(); i++) {
|
||||
background_terms[i] = normalizer.normalize(background_terms[i], normalizelimit);
|
||||
background_terms[i] = normalizer.normalize(background_terms[i]);
|
||||
background_chain->import(background_terms[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1359,7 +1359,7 @@ void MainWindow::actionExportSTLorOFF(bool)
|
|||
}
|
||||
|
||||
if (!this->root_N->p3->is_simple()) {
|
||||
PRINT("Object isn't a valid 2-manifold! Modify your design..");
|
||||
PRINT("Object isn't a valid 2-manifold! Modify your design. See http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/STL_Import_and_Export");
|
||||
clearCurrentOutput();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -294,6 +294,7 @@ int main(int argc, char **argv)
|
|||
PRINTB("Can't open file \"%s\" for export", csg_output_file);
|
||||
}
|
||||
else {
|
||||
fs::current_path(fparent); // Force exported filenames to be relative to document path
|
||||
fstream << tree.getString(*root_node) << "\n";
|
||||
fstream.close();
|
||||
}
|
||||
|
|
|
@ -1,30 +1,42 @@
|
|||
#include "parsersettings.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
using namespace boost::filesystem;
|
||||
#include <boost/foreach.hpp>
|
||||
#include "boosty.h"
|
||||
#include <qglobal.h> // Needed for Q_ defines - move the offending code somewhere else
|
||||
|
||||
std::string librarydir;
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
void set_librarydir(const std::string &libdir)
|
||||
std::vector<std::string> librarypath;
|
||||
|
||||
void add_librarydir(const std::string &libdir)
|
||||
{
|
||||
librarydir = libdir;
|
||||
librarypath.push_back(libdir);
|
||||
}
|
||||
|
||||
const std::string &get_librarydir()
|
||||
/*!
|
||||
Searces for the given file in library paths and returns the full path if found.
|
||||
Returns an empty path if file cannot be found.
|
||||
*/
|
||||
std::string locate_file(const std::string &filename)
|
||||
{
|
||||
return librarydir;
|
||||
BOOST_FOREACH(const std::string &dir, librarypath) {
|
||||
fs::path usepath = fs::path(dir) / filename;
|
||||
if (fs::exists(usepath)) return usepath.string();
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void parser_init(const std::string &applicationpath)
|
||||
{
|
||||
// FIXME: Append paths from OPENSCADPATH before adding built-in paths
|
||||
|
||||
std::string librarydir;
|
||||
path libdir(applicationpath);
|
||||
path tmpdir;
|
||||
#ifdef __APPLE__
|
||||
fs::path libdir(applicationpath);
|
||||
fs::path tmpdir;
|
||||
#ifdef Q_WS_MAC
|
||||
libdir /= "../Resources"; // Libraries can be bundled
|
||||
if (!is_directory(libdir / "libraries")) libdir /= "../../..";
|
||||
#elif !defined(WIN32)
|
||||
#elif defined(Q_OS_UNIX)
|
||||
if (is_directory(tmpdir = libdir / "../share/openscad/libraries")) {
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
} else if (is_directory(tmpdir = libdir / "../../share/openscad/libraries")) {
|
||||
|
@ -36,5 +48,5 @@ void parser_init(const std::string &applicationpath)
|
|||
if (is_directory(tmpdir = libdir / "libraries")) {
|
||||
librarydir = boosty::stringy( tmpdir );
|
||||
}
|
||||
set_librarydir(librarydir);
|
||||
if (!librarydir.empty()) add_librarydir(librarydir);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
extern int parser_error_pos;
|
||||
|
||||
void parser_init(const std::string &applicationpath);
|
||||
void set_librarydir(const std::string &libdir);
|
||||
const std::string &get_librarydir();
|
||||
void add_librarydir(const std::string &libdir);
|
||||
std::string locate_file(const std::string &filename);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
import();
|
||||
translate([-210,0,0]) import(file="../../dxf/polygons.dxf");
|
||||
translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[0,110]);
|
||||
translate([-210,0,0]) import(file="../../dxf/polygons.dxf", origin=[110,110], scale=0.5);
|
||||
import(file="../../dxf/multiple-layers.dxf");
|
||||
translate([-200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0");
|
||||
translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="0");
|
||||
translate([200,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="noname");
|
||||
translate([0,200,0]) import(file="../../dxf/multiple-layers.dxf", layer="Layer with a pretty long name including \\ \"special\" /'\\\\ characters");
|
||||
translate([200,0,0]) import(file="/Users/kintel/code/OpenSCAD/openscad/tests/../testdata/dxf/polygons.dxf");
|
|
@ -1,4 +0,0 @@
|
|||
import_stl("import.stl");
|
||||
translate([2,0,0]) import("import.stl");
|
||||
translate([4,0,0]) import("import_bin.stl");
|
||||
translate([0,2,0]) import("/Users/kintel/code/OpenSCAD/openscad/tests/../testdata/scad/features/import.stl");
|
|
@ -139,7 +139,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -112,7 +112,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -98,7 +98,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -91,7 +91,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -258,7 +258,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
|
|||
std::string currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
@ -302,8 +302,8 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
|
|||
}
|
||||
|
||||
// CSG normalization
|
||||
CSGTermNormalizer normalizer;
|
||||
csgInfo.root_norm_term = normalizer.normalize(root_raw_term, 5000);
|
||||
CSGTermNormalizer normalizer(5000);
|
||||
csgInfo.root_norm_term = normalizer.normalize(root_raw_term);
|
||||
if (csgInfo.root_norm_term) {
|
||||
csgInfo.root_chain = new CSGChain();
|
||||
csgInfo.root_chain->import(csgInfo.root_norm_term);
|
||||
|
@ -319,7 +319,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
|
|||
|
||||
csgInfo.highlights_chain = new CSGChain();
|
||||
for (unsigned int i = 0; i < csgInfo.highlight_terms.size(); i++) {
|
||||
csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i], 5000);
|
||||
csgInfo.highlight_terms[i] = normalizer.normalize(csgInfo.highlight_terms[i]);
|
||||
csgInfo.highlights_chain->import(csgInfo.highlight_terms[i]);
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type)
|
|||
|
||||
csgInfo.background_chain = new CSGChain();
|
||||
for (unsigned int i = 0; i < csgInfo.background_terms.size(); i++) {
|
||||
csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i], 5000);
|
||||
csgInfo.background_terms[i] = normalizer.normalize(csgInfo.background_terms[i]);
|
||||
csgInfo.background_chain->import(csgInfo.background_terms[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -84,10 +84,10 @@ int main(int argc, char **argv)
|
|||
QCoreApplication app(argc, argv);
|
||||
fs::path original_path = fs::current_path();
|
||||
|
||||
currentdir = boosty::stringy( fs::current_path() );
|
||||
currentdir = boosty::stringy(fs::current_path());
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -89,7 +89,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
|
@ -77,7 +77,7 @@ int main(int argc, char **argv)
|
|||
currentdir = boosty::stringy( fs::current_path() );
|
||||
|
||||
parser_init(QCoreApplication::instance()->applicationDirPath().toStdString());
|
||||
set_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
add_librarydir(boosty::stringy(fs::path(QCoreApplication::instance()->applicationDirPath().toStdString()) / "../libraries"));
|
||||
|
||||
Context root_ctx;
|
||||
register_builtin(root_ctx);
|
||||
|
|
Loading…
Reference in New Issue