Remove any Perl related code from libslic3r
This commit is contained in:
parent
3fac8cd77e
commit
4913e90e10
@ -17,8 +17,8 @@ if ($^O eq 'darwin') {
|
|||||||
push @ldflags, qw(-framework IOKit -framework CoreFoundation);
|
push @ldflags, qw(-framework IOKit -framework CoreFoundation);
|
||||||
}
|
}
|
||||||
|
|
||||||
my @INC = qw();
|
my @INC = qw(-Isrc/libslic3r);
|
||||||
my @LIBS = qw();
|
my @LIBS = qw(-Lsrc/libslic3r);
|
||||||
|
|
||||||
# search for Boost in a number of places
|
# search for Boost in a number of places
|
||||||
my @boost_include = my @boost_libs = ();
|
my @boost_include = my @boost_libs = ();
|
||||||
|
10
xs/MANIFEST
10
xs/MANIFEST
@ -78,8 +78,7 @@ src/libslic3r/SVG.hpp
|
|||||||
src/libslic3r/TriangleMesh.cpp
|
src/libslic3r/TriangleMesh.cpp
|
||||||
src/libslic3r/TriangleMesh.hpp
|
src/libslic3r/TriangleMesh.hpp
|
||||||
src/libslic3r/utils.cpp
|
src/libslic3r/utils.cpp
|
||||||
src/myinit.h
|
src/perlglue.cpp
|
||||||
src/perlglue.hpp
|
|
||||||
src/poly2tri/common/shapes.cc
|
src/poly2tri/common/shapes.cc
|
||||||
src/poly2tri/common/shapes.h
|
src/poly2tri/common/shapes.h
|
||||||
src/poly2tri/common/utils.h
|
src/poly2tri/common/utils.h
|
||||||
@ -95,10 +94,11 @@ src/poly2tri/sweep/sweep_context.h
|
|||||||
src/polypartition.cpp
|
src/polypartition.cpp
|
||||||
src/polypartition.h
|
src/polypartition.h
|
||||||
src/ppport.h
|
src/ppport.h
|
||||||
src/slic3r/GUI/GUI.cpp
|
|
||||||
src/slic3r/GUI/GUI.hpp
|
|
||||||
src/slic3r/GUI/3DScene.cpp
|
src/slic3r/GUI/3DScene.cpp
|
||||||
src/slic3r/GUI/3DScene.hpp
|
src/slic3r/GUI/3DScene.hpp
|
||||||
|
src/slic3r/GUI/GUI.cpp
|
||||||
|
src/slic3r/GUI/GUI.hpp
|
||||||
|
src/xsinit.h
|
||||||
t/01_trianglemesh.t
|
t/01_trianglemesh.t
|
||||||
t/03_point.t
|
t/03_point.t
|
||||||
t/04_expolygon.t
|
t/04_expolygon.t
|
||||||
@ -130,8 +130,8 @@ xsp/ExtrusionEntityCollection.xsp
|
|||||||
xsp/ExtrusionLoop.xsp
|
xsp/ExtrusionLoop.xsp
|
||||||
xsp/ExtrusionPath.xsp
|
xsp/ExtrusionPath.xsp
|
||||||
xsp/Flow.xsp
|
xsp/Flow.xsp
|
||||||
xsp/GCodeSender.xsp
|
|
||||||
xsp/GCode.xsp
|
xsp/GCode.xsp
|
||||||
|
xsp/GCodeSender.xsp
|
||||||
xsp/GCodeWriter.xsp
|
xsp/GCodeWriter.xsp
|
||||||
xsp/Geometry.xsp
|
xsp/Geometry.xsp
|
||||||
xsp/GUI.xsp
|
xsp/GUI.xsp
|
||||||
|
@ -219,10 +219,4 @@ BoundingBox3Base<PointClass>::center() const
|
|||||||
}
|
}
|
||||||
template Pointf3 BoundingBox3Base<Pointf3>::center() const;
|
template Pointf3 BoundingBox3Base<Pointf3>::center() const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(BoundingBox, "Geometry::BoundingBox");
|
|
||||||
REGISTER_CLASS(BoundingBoxf, "Geometry::BoundingBoxf");
|
|
||||||
REGISTER_CLASS(BoundingBoxf3, "Geometry::BoundingBoxf3");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_BoundingBox_hpp_
|
#ifndef slic3r_BoundingBox_hpp_
|
||||||
#define slic3r_BoundingBox_hpp_
|
#define slic3r_BoundingBox_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
|
|
||||||
|
@ -327,8 +327,4 @@ BridgeDetector::unsupported_edges(double angle) const
|
|||||||
return pp;
|
return pp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(BridgeDetector, "BridgeDetector");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_BridgeDetector_hpp_
|
#ifndef slic3r_BridgeDetector_hpp_
|
||||||
#define slic3r_BridgeDetector_hpp_
|
#define slic3r_BridgeDetector_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
#include "ExPolygonCollection.hpp"
|
#include "ExPolygonCollection.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -689,35 +689,4 @@ void safety_offset(ClipperLib::Paths* paths)
|
|||||||
scaleClipperPolygons(*paths, 1.0/CLIPPER_OFFSET_SCALE);
|
scaleClipperPolygons(*paths, 1.0/CLIPPER_OFFSET_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
SV*
|
|
||||||
polynode_children_2_perl(const ClipperLib::PolyNode& node)
|
|
||||||
{
|
|
||||||
AV* av = newAV();
|
|
||||||
const int len = node.ChildCount();
|
|
||||||
if (len > 0) av_extend(av, len-1);
|
|
||||||
for (int i = 0; i < len; ++i) {
|
|
||||||
av_store(av, i, polynode2perl(*node.Childs[i]));
|
|
||||||
}
|
|
||||||
return (SV*)newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
polynode2perl(const ClipperLib::PolyNode& node)
|
|
||||||
{
|
|
||||||
HV* hv = newHV();
|
|
||||||
Slic3r::Polygon p;
|
|
||||||
ClipperPath_to_Slic3rMultiPoint(node.Contour, &p);
|
|
||||||
if (node.IsHole()) {
|
|
||||||
(void)hv_stores( hv, "hole", Slic3r::perl_to_SV_clone_ref(p) );
|
|
||||||
} else {
|
|
||||||
(void)hv_stores( hv, "outer", Slic3r::perl_to_SV_clone_ref(p) );
|
|
||||||
}
|
|
||||||
(void)hv_stores( hv, "children", polynode_children_2_perl(node) );
|
|
||||||
return (SV*)newRV_noinc((SV*)hv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_ClipperUtils_hpp_
|
#ifndef slic3r_ClipperUtils_hpp_
|
||||||
#define slic3r_ClipperUtils_hpp_
|
#define slic3r_ClipperUtils_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include <libslic3r.h>
|
||||||
#include "clipper.hpp"
|
#include "clipper.hpp"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
@ -134,13 +134,6 @@ void simplify_polygons(const Slic3r::Polygons &subject, Slic3r::ExPolygons* retv
|
|||||||
|
|
||||||
void safety_offset(ClipperLib::Paths* paths);
|
void safety_offset(ClipperLib::Paths* paths);
|
||||||
|
|
||||||
/////////////////
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
SV* polynode_children_2_perl(const ClipperLib::PolyNode& node);
|
|
||||||
SV* polynode2perl(const ClipperLib::PolyNode& node);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,219 +149,6 @@ ConfigBase::setenv_()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
SV*
|
|
||||||
ConfigBase::as_hash() {
|
|
||||||
HV* hv = newHV();
|
|
||||||
|
|
||||||
t_config_option_keys opt_keys = this->keys();
|
|
||||||
for (t_config_option_keys::const_iterator it = opt_keys.begin(); it != opt_keys.end(); ++it)
|
|
||||||
(void)hv_store( hv, it->c_str(), it->length(), this->get(*it), 0 );
|
|
||||||
|
|
||||||
return newRV_noinc((SV*)hv);
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
ConfigBase::get(t_config_option_key opt_key) {
|
|
||||||
ConfigOption* opt = this->option(opt_key);
|
|
||||||
if (opt == NULL) return &PL_sv_undef;
|
|
||||||
|
|
||||||
const ConfigOptionDef* def = this->def->get(opt_key);
|
|
||||||
if (def->type == coFloat) {
|
|
||||||
ConfigOptionFloat* optv = dynamic_cast<ConfigOptionFloat*>(opt);
|
|
||||||
return newSVnv(optv->value);
|
|
||||||
} else if (def->type == coFloats) {
|
|
||||||
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, optv->values.size()-1);
|
|
||||||
for (std::vector<double>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
|
||||||
av_store(av, it - optv->values.begin(), newSVnv(*it));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
} else if (def->type == coPercent) {
|
|
||||||
ConfigOptionPercent* optv = dynamic_cast<ConfigOptionPercent*>(opt);
|
|
||||||
return newSVnv(optv->value);
|
|
||||||
} else if (def->type == coInt) {
|
|
||||||
ConfigOptionInt* optv = dynamic_cast<ConfigOptionInt*>(opt);
|
|
||||||
return newSViv(optv->value);
|
|
||||||
} else if (def->type == coInts) {
|
|
||||||
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, optv->values.size()-1);
|
|
||||||
for (std::vector<int>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
|
||||||
av_store(av, it - optv->values.begin(), newSViv(*it));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
} else if (def->type == coString) {
|
|
||||||
ConfigOptionString* optv = dynamic_cast<ConfigOptionString*>(opt);
|
|
||||||
// we don't serialize() because that would escape newlines
|
|
||||||
return newSVpvn_utf8(optv->value.c_str(), optv->value.length(), true);
|
|
||||||
} else if (def->type == coStrings) {
|
|
||||||
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, optv->values.size()-1);
|
|
||||||
for (std::vector<std::string>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
|
||||||
av_store(av, it - optv->values.begin(), newSVpvn_utf8(it->c_str(), it->length(), true));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
} else if (def->type == coPoint) {
|
|
||||||
ConfigOptionPoint* optv = dynamic_cast<ConfigOptionPoint*>(opt);
|
|
||||||
return perl_to_SV_clone_ref(optv->value);
|
|
||||||
} else if (def->type == coPoints) {
|
|
||||||
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, optv->values.size()-1);
|
|
||||||
for (Pointfs::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
|
||||||
av_store(av, it - optv->values.begin(), perl_to_SV_clone_ref(*it));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
} else if (def->type == coBool) {
|
|
||||||
ConfigOptionBool* optv = dynamic_cast<ConfigOptionBool*>(opt);
|
|
||||||
return newSViv(optv->value ? 1 : 0);
|
|
||||||
} else if (def->type == coBools) {
|
|
||||||
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, optv->values.size()-1);
|
|
||||||
for (std::vector<bool>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
|
||||||
av_store(av, it - optv->values.begin(), newSViv(*it ? 1 : 0));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
} else {
|
|
||||||
std::string serialized = opt->serialize();
|
|
||||||
return newSVpvn_utf8(serialized.c_str(), serialized.length(), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
ConfigBase::get_at(t_config_option_key opt_key, size_t i) {
|
|
||||||
ConfigOption* opt = this->option(opt_key);
|
|
||||||
if (opt == NULL) return &PL_sv_undef;
|
|
||||||
|
|
||||||
const ConfigOptionDef* def = this->def->get(opt_key);
|
|
||||||
if (def->type == coFloats) {
|
|
||||||
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
|
||||||
return newSVnv(optv->get_at(i));
|
|
||||||
} else if (def->type == coInts) {
|
|
||||||
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
|
||||||
return newSViv(optv->get_at(i));
|
|
||||||
} else if (def->type == coStrings) {
|
|
||||||
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
|
||||||
// we don't serialize() because that would escape newlines
|
|
||||||
std::string val = optv->get_at(i);
|
|
||||||
return newSVpvn_utf8(val.c_str(), val.length(), true);
|
|
||||||
} else if (def->type == coPoints) {
|
|
||||||
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
|
||||||
return perl_to_SV_clone_ref(optv->get_at(i));
|
|
||||||
} else if (def->type == coBools) {
|
|
||||||
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
|
||||||
return newSViv(optv->get_at(i) ? 1 : 0);
|
|
||||||
} else {
|
|
||||||
return &PL_sv_undef;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
ConfigBase::set(t_config_option_key opt_key, SV* value) {
|
|
||||||
ConfigOption* opt = this->option(opt_key, true);
|
|
||||||
if (opt == NULL) CONFESS("Trying to set non-existing option");
|
|
||||||
|
|
||||||
const ConfigOptionDef* def = this->def->get(opt_key);
|
|
||||||
if (def->type == coFloat) {
|
|
||||||
if (!looks_like_number(value)) return false;
|
|
||||||
ConfigOptionFloat* optv = dynamic_cast<ConfigOptionFloat*>(opt);
|
|
||||||
optv->value = SvNV(value);
|
|
||||||
} else if (def->type == coFloats) {
|
|
||||||
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
|
||||||
std::vector<double> values;
|
|
||||||
AV* av = (AV*)SvRV(value);
|
|
||||||
const size_t len = av_len(av)+1;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
SV** elem = av_fetch(av, i, 0);
|
|
||||||
if (elem == NULL || !looks_like_number(*elem)) return false;
|
|
||||||
values.push_back(SvNV(*elem));
|
|
||||||
}
|
|
||||||
optv->values = values;
|
|
||||||
} else if (def->type == coInt) {
|
|
||||||
if (!looks_like_number(value)) return false;
|
|
||||||
ConfigOptionInt* optv = dynamic_cast<ConfigOptionInt*>(opt);
|
|
||||||
optv->value = SvIV(value);
|
|
||||||
} else if (def->type == coInts) {
|
|
||||||
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
|
||||||
std::vector<int> values;
|
|
||||||
AV* av = (AV*)SvRV(value);
|
|
||||||
const size_t len = av_len(av)+1;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
SV** elem = av_fetch(av, i, 0);
|
|
||||||
if (elem == NULL || !looks_like_number(*elem)) return false;
|
|
||||||
values.push_back(SvIV(*elem));
|
|
||||||
}
|
|
||||||
optv->values = values;
|
|
||||||
} else if (def->type == coString) {
|
|
||||||
ConfigOptionString* optv = dynamic_cast<ConfigOptionString*>(opt);
|
|
||||||
optv->value = std::string(SvPV_nolen(value), SvCUR(value));
|
|
||||||
} else if (def->type == coStrings) {
|
|
||||||
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
|
||||||
optv->values.clear();
|
|
||||||
AV* av = (AV*)SvRV(value);
|
|
||||||
const size_t len = av_len(av)+1;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
SV** elem = av_fetch(av, i, 0);
|
|
||||||
if (elem == NULL) return false;
|
|
||||||
optv->values.push_back(std::string(SvPV_nolen(*elem), SvCUR(*elem)));
|
|
||||||
}
|
|
||||||
} else if (def->type == coPoint) {
|
|
||||||
ConfigOptionPoint* optv = dynamic_cast<ConfigOptionPoint*>(opt);
|
|
||||||
return optv->value.from_SV_check(value);
|
|
||||||
} else if (def->type == coPoints) {
|
|
||||||
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
|
||||||
std::vector<Pointf> values;
|
|
||||||
AV* av = (AV*)SvRV(value);
|
|
||||||
const size_t len = av_len(av)+1;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
SV** elem = av_fetch(av, i, 0);
|
|
||||||
Pointf point;
|
|
||||||
if (elem == NULL || !point.from_SV_check(*elem)) return false;
|
|
||||||
values.push_back(point);
|
|
||||||
}
|
|
||||||
optv->values = values;
|
|
||||||
} else if (def->type == coBool) {
|
|
||||||
ConfigOptionBool* optv = dynamic_cast<ConfigOptionBool*>(opt);
|
|
||||||
optv->value = SvTRUE(value);
|
|
||||||
} else if (def->type == coBools) {
|
|
||||||
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
|
||||||
optv->values.clear();
|
|
||||||
AV* av = (AV*)SvRV(value);
|
|
||||||
const size_t len = av_len(av)+1;
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
|
||||||
SV** elem = av_fetch(av, i, 0);
|
|
||||||
if (elem == NULL) return false;
|
|
||||||
optv->values.push_back(SvTRUE(*elem));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!opt->deserialize( std::string(SvPV_nolen(value)) )) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This method is implemented as a workaround for this typemap bug:
|
|
||||||
https://rt.cpan.org/Public/Bug/Display.html?id=94110 */
|
|
||||||
bool
|
|
||||||
ConfigBase::set_deserialize(const t_config_option_key &opt_key, SV* str) {
|
|
||||||
size_t len;
|
|
||||||
const char * c = SvPV(str, len);
|
|
||||||
std::string value(c, len);
|
|
||||||
|
|
||||||
return this->set_deserialize(opt_key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ConfigBase::set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize)
|
|
||||||
{
|
|
||||||
if (!this->has(opt_key)) {
|
|
||||||
if (deserialize) {
|
|
||||||
this->set_deserialize(opt_key, value);
|
|
||||||
} else {
|
|
||||||
this->set(opt_key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DynamicConfig& DynamicConfig::operator= (DynamicConfig other)
|
DynamicConfig& DynamicConfig::operator= (DynamicConfig other)
|
||||||
{
|
{
|
||||||
this->swap(other);
|
this->swap(other);
|
||||||
@ -491,19 +278,4 @@ StaticConfig::option(const t_config_option_key &opt_key) const
|
|||||||
return const_cast<StaticConfig*>(this)->option(opt_key, false);
|
return const_cast<StaticConfig*>(this)->option(opt_key, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
bool
|
|
||||||
StaticConfig::set(t_config_option_key opt_key, SV* value) {
|
|
||||||
const ConfigOptionDef* optdef = this->def->get(opt_key);
|
|
||||||
if (!optdef->shortcut.empty()) {
|
|
||||||
for (std::vector<t_config_option_key>::const_iterator it = optdef->shortcut.begin(); it != optdef->shortcut.end(); ++it) {
|
|
||||||
if (!this->set(*it, value)) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<ConfigBase*>(this)->set(opt_key, value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -555,18 +555,9 @@ class ConfigBase
|
|||||||
t_config_option_keys diff(ConfigBase &other);
|
t_config_option_keys diff(ConfigBase &other);
|
||||||
std::string serialize(const t_config_option_key &opt_key) const;
|
std::string serialize(const t_config_option_key &opt_key) const;
|
||||||
bool set_deserialize(const t_config_option_key &opt_key, std::string str);
|
bool set_deserialize(const t_config_option_key &opt_key, std::string str);
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
|
||||||
double get_abs_value(const t_config_option_key &opt_key);
|
double get_abs_value(const t_config_option_key &opt_key);
|
||||||
double get_abs_value(const t_config_option_key &opt_key, double ratio_over);
|
double get_abs_value(const t_config_option_key &opt_key, double ratio_over);
|
||||||
void setenv_();
|
void setenv_();
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
SV* as_hash();
|
|
||||||
SV* get(t_config_option_key opt_key);
|
|
||||||
SV* get_at(t_config_option_key opt_key, size_t i);
|
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
|
||||||
bool set_deserialize(const t_config_option_key &opt_key, SV* str);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DynamicConfig : public virtual ConfigBase
|
class DynamicConfig : public virtual ConfigBase
|
||||||
@ -596,10 +587,6 @@ class StaticConfig : public virtual ConfigBase
|
|||||||
virtual ConfigOption* option(const t_config_option_key &opt_key, bool create = false) = 0;
|
virtual ConfigOption* option(const t_config_option_key &opt_key, bool create = false) = 0;
|
||||||
const ConfigOption* option(const t_config_option_key &opt_key) const;
|
const ConfigOption* option(const t_config_option_key &opt_key) const;
|
||||||
void set_defaults();
|
void set_defaults();
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -425,65 +425,4 @@ ExPolygon::lines() const
|
|||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(ExPolygon, "ExPolygon");
|
|
||||||
|
|
||||||
SV*
|
|
||||||
ExPolygon::to_AV() {
|
|
||||||
const unsigned int num_holes = this->holes.size();
|
|
||||||
AV* av = newAV();
|
|
||||||
av_extend(av, num_holes); // -1 +1
|
|
||||||
|
|
||||||
av_store(av, 0, perl_to_SV_ref(this->contour));
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < num_holes; i++) {
|
|
||||||
av_store(av, i+1, perl_to_SV_ref(this->holes[i]));
|
|
||||||
}
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
ExPolygon::to_SV_pureperl() const
|
|
||||||
{
|
|
||||||
const unsigned int num_holes = this->holes.size();
|
|
||||||
AV* av = newAV();
|
|
||||||
av_extend(av, num_holes); // -1 +1
|
|
||||||
av_store(av, 0, this->contour.to_SV_pureperl());
|
|
||||||
for (unsigned int i = 0; i < num_holes; i++) {
|
|
||||||
av_store(av, i+1, this->holes[i].to_SV_pureperl());
|
|
||||||
}
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ExPolygon::from_SV(SV* expoly_sv)
|
|
||||||
{
|
|
||||||
AV* expoly_av = (AV*)SvRV(expoly_sv);
|
|
||||||
const unsigned int num_polygons = av_len(expoly_av)+1;
|
|
||||||
this->holes.resize(num_polygons-1);
|
|
||||||
|
|
||||||
SV** polygon_sv = av_fetch(expoly_av, 0, 0);
|
|
||||||
this->contour.from_SV(*polygon_sv);
|
|
||||||
for (unsigned int i = 0; i < num_polygons-1; i++) {
|
|
||||||
polygon_sv = av_fetch(expoly_av, i+1, 0);
|
|
||||||
this->holes[i].from_SV(*polygon_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ExPolygon::from_SV_check(SV* expoly_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(expoly_sv) && (SvTYPE(SvRV(expoly_sv)) == SVt_PVMG)) {
|
|
||||||
if (!sv_isa(expoly_sv, perl_class_name(this)) && !sv_isa(expoly_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object", perl_class_name(this));
|
|
||||||
// a XS ExPolygon was supplied
|
|
||||||
*this = *(ExPolygon *)SvIV((SV*)SvRV( expoly_sv ));
|
|
||||||
} else {
|
|
||||||
// a Perl arrayref was supplied
|
|
||||||
this->from_SV(expoly_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_ExPolygon_hpp_
|
#ifndef slic3r_ExPolygon_hpp_
|
||||||
#define slic3r_ExPolygon_hpp_
|
#define slic3r_ExPolygon_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -40,13 +41,6 @@ class ExPolygon
|
|||||||
void triangulate_pp(Polygons* polygons) const;
|
void triangulate_pp(Polygons* polygons) const;
|
||||||
void triangulate_p2t(Polygons* polygons) const;
|
void triangulate_p2t(Polygons* polygons) const;
|
||||||
Lines lines() const;
|
Lines lines() const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV(SV* poly_sv);
|
|
||||||
void from_SV_check(SV* poly_sv);
|
|
||||||
SV* to_AV();
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,4 @@ ExPolygonCollection::append(const ExPolygons &expp)
|
|||||||
this->expolygons.insert(this->expolygons.end(), expp.begin(), expp.end());
|
this->expolygons.insert(this->expolygons.end(), expp.begin(), expp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ExPolygonCollection, "ExPolygon::Collection");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_ExPolygonCollection_hpp_
|
#ifndef slic3r_ExPolygonCollection_hpp_
|
||||||
#define slic3r_ExPolygonCollection_hpp_
|
#define slic3r_ExPolygonCollection_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
#include "Line.hpp"
|
#include "Line.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
|
@ -153,9 +153,4 @@ Extruder::retract_restart_extra_toolchange() const
|
|||||||
return this->config->retract_restart_extra_toolchange.get_at(this->id);
|
return this->config->retract_restart_extra_toolchange.get_at(this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Extruder, "Extruder");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Extruder_hpp_
|
#ifndef slic3r_Extruder_hpp_
|
||||||
#define slic3r_Extruder_hpp_
|
#define slic3r_Extruder_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "PrintConfig.hpp"
|
#include "PrintConfig.hpp"
|
||||||
|
|
||||||
|
@ -110,10 +110,6 @@ ExtrusionPath::_inflate_collection(const Polylines &polylines, ExtrusionEntityCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ExtrusionPath, "ExtrusionPath");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Polygons
|
Polygons
|
||||||
ExtrusionPath::grow() const
|
ExtrusionPath::grow() const
|
||||||
{
|
{
|
||||||
@ -339,8 +335,4 @@ ExtrusionLoop::min_mm3_per_mm() const
|
|||||||
return min_mm3_per_mm;
|
return min_mm3_per_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ExtrusionLoop, "ExtrusionLoop");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_ExtrusionEntity_hpp_
|
#ifndef slic3r_ExtrusionEntity_hpp_
|
||||||
#define slic3r_ExtrusionEntity_hpp_
|
#define slic3r_ExtrusionEntity_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
|
|
||||||
|
@ -227,9 +227,4 @@ ExtrusionEntityCollection::min_mm3_per_mm() const
|
|||||||
return min_mm3_per_mm;
|
return min_mm3_per_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
// there is no ExtrusionLoop::Collection or ExtrusionEntity::Collection
|
|
||||||
REGISTER_CLASS(ExtrusionEntityCollection, "ExtrusionPath::Collection");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_ExtrusionEntityCollection_hpp_
|
#ifndef slic3r_ExtrusionEntityCollection_hpp_
|
||||||
#define slic3r_ExtrusionEntityCollection_hpp_
|
#define slic3r_ExtrusionEntityCollection_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ExtrusionEntity.hpp"
|
#include "ExtrusionEntity.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -114,8 +114,4 @@ Flow::_width_from_spacing(float spacing, float nozzle_diameter, float height, bo
|
|||||||
return spacing + OVERLAP_FACTOR * height * (1 - PI/4.0);
|
return spacing + OVERLAP_FACTOR * height * (1 - PI/4.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Flow, "Flow");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Flow_hpp_
|
#ifndef slic3r_Flow_hpp_
|
||||||
#define slic3r_Flow_hpp_
|
#define slic3r_Flow_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Config.hpp"
|
#include "Config.hpp"
|
||||||
#include "ExtrusionEntity.hpp"
|
#include "ExtrusionEntity.hpp"
|
||||||
|
|
||||||
|
@ -65,10 +65,6 @@ AvoidCrossingPerimeters::travel_to(GCode &gcodegen, Point point)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(AvoidCrossingPerimeters, "GCode::AvoidCrossingPerimeters");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OozePrevention::OozePrevention()
|
OozePrevention::OozePrevention()
|
||||||
: enable(false)
|
: enable(false)
|
||||||
{
|
{
|
||||||
@ -125,10 +121,6 @@ OozePrevention::_get_temp(GCode &gcodegen)
|
|||||||
: gcodegen.config.temperature.get_at(gcodegen.writer.extruder()->id);
|
: gcodegen.config.temperature.get_at(gcodegen.writer.extruder()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(OozePrevention, "GCode::OozePrevention");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Wipe::Wipe()
|
Wipe::Wipe()
|
||||||
: enable(false)
|
: enable(false)
|
||||||
{
|
{
|
||||||
@ -202,10 +194,6 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
|
|||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Wipe, "GCode::Wipe");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EXTRUDER_CONFIG(OPT) this->config.OPT.get_at(this->writer.extruder()->id)
|
#define EXTRUDER_CONFIG(OPT) this->config.OPT.get_at(this->writer.extruder()->id)
|
||||||
|
|
||||||
GCode::GCode()
|
GCode::GCode()
|
||||||
@ -766,8 +754,4 @@ GCode::point_to_gcode(const Point &point)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(GCode, "GCode");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_GCode_hpp_
|
#ifndef slic3r_GCode_hpp_
|
||||||
#define slic3r_GCode_hpp_
|
#define slic3r_GCode_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
#include "GCodeWriter.hpp"
|
#include "GCodeWriter.hpp"
|
||||||
#include "Layer.hpp"
|
#include "Layer.hpp"
|
||||||
|
@ -474,11 +474,4 @@ GCodeSender::reset()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
#include <myinit.h>
|
|
||||||
namespace Slic3r {
|
|
||||||
__REGISTER_CLASS(GCodeSender, "GCode::Sender");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define slic3r_GCodeSender_hpp_
|
#define slic3r_GCodeSender_hpp_
|
||||||
#ifdef BOOST_LIBS
|
#ifdef BOOST_LIBS
|
||||||
|
|
||||||
#include <libslic3r/libslic3r.h>
|
#include "libslic3r.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -520,8 +520,4 @@ GCodeWriter::get_position() const
|
|||||||
return this->_pos;
|
return this->_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(GCodeWriter, "GCode::Writer");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_GCodeWriter_hpp_
|
#ifndef slic3r_GCodeWriter_hpp_
|
||||||
#define slic3r_GCodeWriter_hpp_
|
#define slic3r_GCodeWriter_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Extruder.hpp"
|
#include "Extruder.hpp"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_Geometry_hpp_
|
#ifndef slic3r_Geometry_hpp_
|
||||||
#define slic3r_Geometry_hpp_
|
#define slic3r_Geometry_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "BoundingBox.hpp"
|
#include "BoundingBox.hpp"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
|
@ -245,10 +245,6 @@ Layer::make_perimeters()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Layer, "Layer");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
SupportLayer::SupportLayer(size_t id, PrintObject *object, coordf_t height,
|
SupportLayer::SupportLayer(size_t id, PrintObject *object, coordf_t height,
|
||||||
coordf_t print_z, coordf_t slice_z)
|
coordf_t print_z, coordf_t slice_z)
|
||||||
@ -260,9 +256,5 @@ SupportLayer::~SupportLayer()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(SupportLayer, "Layer::Support");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Layer_hpp_
|
#ifndef slic3r_Layer_hpp_
|
||||||
#define slic3r_Layer_hpp_
|
#define slic3r_Layer_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Flow.hpp"
|
#include "Flow.hpp"
|
||||||
#include "SurfaceCollection.hpp"
|
#include "SurfaceCollection.hpp"
|
||||||
#include "ExtrusionEntityCollection.hpp"
|
#include "ExtrusionEntityCollection.hpp"
|
||||||
|
@ -271,8 +271,4 @@ LayerRegion::infill_area_threshold() const
|
|||||||
return ss*ss;
|
return ss*ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(LayerRegion, "Layer::Region");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -163,51 +163,6 @@ Line::normal() const
|
|||||||
return Vector((this->b.y - this->a.y), -(this->b.x - this->a.x));
|
return Vector((this->b.y - this->a.y), -(this->b.x - this->a.x));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(Line, "Line");
|
|
||||||
|
|
||||||
void
|
|
||||||
Line::from_SV(SV* line_sv)
|
|
||||||
{
|
|
||||||
AV* line_av = (AV*)SvRV(line_sv);
|
|
||||||
this->a.from_SV_check(*av_fetch(line_av, 0, 0));
|
|
||||||
this->b.from_SV_check(*av_fetch(line_av, 1, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Line::from_SV_check(SV* line_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(line_sv) && (SvTYPE(SvRV(line_sv)) == SVt_PVMG)) {
|
|
||||||
if (!sv_isa(line_sv, perl_class_name(this)) && !sv_isa(line_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object", perl_class_name(this));
|
|
||||||
*this = *(Line*)SvIV((SV*)SvRV( line_sv ));
|
|
||||||
} else {
|
|
||||||
this->from_SV(line_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
Line::to_AV() {
|
|
||||||
AV* av = newAV();
|
|
||||||
av_extend(av, 1);
|
|
||||||
|
|
||||||
av_store(av, 0, perl_to_SV_ref(this->a));
|
|
||||||
av_store(av, 1, perl_to_SV_ref(this->b));
|
|
||||||
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
Line::to_SV_pureperl() const {
|
|
||||||
AV* av = newAV();
|
|
||||||
av_extend(av, 1);
|
|
||||||
av_store(av, 0, this->a.to_SV_pureperl());
|
|
||||||
av_store(av, 1, this->b.to_SV_pureperl());
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Pointf3
|
Pointf3
|
||||||
Linef3::intersect_plane(double z) const
|
Linef3::intersect_plane(double z) const
|
||||||
{
|
{
|
||||||
@ -225,8 +180,4 @@ Linef3::scale(double factor)
|
|||||||
this->b.scale(factor);
|
this->b.scale(factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Linef3, "Linef3");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Line_hpp_
|
#ifndef slic3r_Line_hpp_
|
||||||
#define slic3r_Line_hpp_
|
#define slic3r_Line_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -39,13 +39,6 @@ class Line
|
|||||||
double direction() const;
|
double direction() const;
|
||||||
Vector vector() const;
|
Vector vector() const;
|
||||||
Vector normal() const;
|
Vector normal() const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV(SV* line_sv);
|
|
||||||
void from_SV_check(SV* line_sv);
|
|
||||||
SV* to_AV();
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Linef
|
class Linef
|
||||||
@ -66,12 +59,6 @@ class Linef3
|
|||||||
explicit Linef3(Pointf3 _a, Pointf3 _b): a(_a), b(_b) {};
|
explicit Linef3(Pointf3 _a, Pointf3 _b): a(_a), b(_b) {};
|
||||||
Pointf3 intersect_plane(double z) const;
|
Pointf3 intersect_plane(double z) const;
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV(SV* line_sv);
|
|
||||||
void from_SV_check(SV* line_sv);
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -311,11 +311,6 @@ Model::duplicate_objects_grid(size_t x, size_t y, coordf_t dist)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Model, "Model");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
ModelMaterial::ModelMaterial(Model *model) : model(model) {}
|
ModelMaterial::ModelMaterial(Model *model) : model(model) {}
|
||||||
ModelMaterial::ModelMaterial(Model *model, const ModelMaterial &other)
|
ModelMaterial::ModelMaterial(Model *model, const ModelMaterial &other)
|
||||||
: attributes(other.attributes), config(other.config), model(model)
|
: attributes(other.attributes), config(other.config), model(model)
|
||||||
@ -328,11 +323,6 @@ ModelMaterial::apply(const t_model_material_attributes &attributes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ModelMaterial, "Model::Material");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
ModelObject::ModelObject(Model *model)
|
ModelObject::ModelObject(Model *model)
|
||||||
: model(model)
|
: model(model)
|
||||||
{}
|
{}
|
||||||
@ -711,10 +701,6 @@ ModelObject::split(ModelObjectPtrs* new_objects)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ModelObject, "Model::Object");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh)
|
ModelVolume::ModelVolume(ModelObject* object, const TriangleMesh &mesh)
|
||||||
: mesh(mesh), modifier(false), object(object)
|
: mesh(mesh), modifier(false), object(object)
|
||||||
@ -765,10 +751,6 @@ ModelVolume::assign_unique_material()
|
|||||||
return model->add_material(this->_material_id);
|
return model->add_material(this->_material_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ModelVolume, "Model::Volume");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
ModelInstance::ModelInstance(ModelObject *object)
|
ModelInstance::ModelInstance(ModelObject *object)
|
||||||
: rotation(0), scaling_factor(1), object(object)
|
: rotation(0), scaling_factor(1), object(object)
|
||||||
@ -794,8 +776,4 @@ ModelInstance::transform_polygon(Polygon* polygon) const
|
|||||||
polygon->scale(this->scaling_factor); // scale around polygon origin
|
polygon->scale(this->scaling_factor); // scale around polygon origin
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(ModelInstance, "Model::Instance");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Model_hpp_
|
#ifndef slic3r_Model_hpp_
|
||||||
#define slic3r_Model_hpp_
|
#define slic3r_Model_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "PrintConfig.hpp"
|
#include "PrintConfig.hpp"
|
||||||
#include "Layer.hpp"
|
#include "Layer.hpp"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
|
@ -391,8 +391,4 @@ MotionPlannerGraph::shortest_path(size_t from, size_t to)
|
|||||||
return polyline;
|
return polyline;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(MotionPlanner, "MotionPlanner");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_MotionPlanner_hpp_
|
#ifndef slic3r_MotionPlanner_hpp_
|
||||||
#define slic3r_MotionPlanner_hpp_
|
#define slic3r_MotionPlanner_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ClipperUtils.hpp"
|
#include "ClipperUtils.hpp"
|
||||||
#include "ExPolygonCollection.hpp"
|
#include "ExPolygonCollection.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
|
@ -154,51 +154,4 @@ MultiPoint::_douglas_peucker(const Points &points, const double tolerance)
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void
|
|
||||||
MultiPoint::from_SV(SV* poly_sv)
|
|
||||||
{
|
|
||||||
AV* poly_av = (AV*)SvRV(poly_sv);
|
|
||||||
const unsigned int num_points = av_len(poly_av)+1;
|
|
||||||
this->points.resize(num_points);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < num_points; i++) {
|
|
||||||
SV** point_sv = av_fetch(poly_av, i, 0);
|
|
||||||
this->points[i].from_SV_check(*point_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MultiPoint::from_SV_check(SV* poly_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(poly_sv) && (SvTYPE(SvRV(poly_sv)) == SVt_PVMG)) {
|
|
||||||
*this = *(MultiPoint*)SvIV((SV*)SvRV( poly_sv ));
|
|
||||||
} else {
|
|
||||||
this->from_SV(poly_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
MultiPoint::to_AV() {
|
|
||||||
const unsigned int num_points = this->points.size();
|
|
||||||
AV* av = newAV();
|
|
||||||
if (num_points > 0) av_extend(av, num_points-1);
|
|
||||||
for (unsigned int i = 0; i < num_points; i++) {
|
|
||||||
av_store(av, i, perl_to_SV_ref(this->points[i]));
|
|
||||||
}
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
SV*
|
|
||||||
MultiPoint::to_SV_pureperl() const {
|
|
||||||
const unsigned int num_points = this->points.size();
|
|
||||||
AV* av = newAV();
|
|
||||||
if (num_points > 0) av_extend(av, num_points-1);
|
|
||||||
for (unsigned int i = 0; i < num_points; i++) {
|
|
||||||
av_store(av, i, this->points[i].to_SV_pureperl());
|
|
||||||
}
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_MultiPoint_hpp_
|
#ifndef slic3r_MultiPoint_hpp_
|
||||||
#define slic3r_MultiPoint_hpp_
|
#define slic3r_MultiPoint_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "Line.hpp"
|
#include "Line.hpp"
|
||||||
@ -38,13 +38,6 @@ class MultiPoint
|
|||||||
void append(const Points::const_iterator &begin, const Points::const_iterator &end);
|
void append(const Points::const_iterator &begin, const Points::const_iterator &end);
|
||||||
|
|
||||||
static Points _douglas_peucker(const Points &points, const double tolerance);
|
static Points _douglas_peucker(const Points &points, const double tolerance);
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV(SV* poly_sv);
|
|
||||||
void from_SV_check(SV* poly_sv);
|
|
||||||
SV* to_AV();
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -497,10 +497,6 @@ PerimeterGenerator::_fill_gaps(double min, double max, double w,
|
|||||||
return coll;
|
return coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(PerimeterGenerator, "Layer::PerimeterGenerator");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PerimeterGeneratorLoop::is_external() const
|
PerimeterGeneratorLoop::is_external() const
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_PerimeterGenerator_hpp_
|
#ifndef slic3r_PerimeterGenerator_hpp_
|
||||||
#define slic3r_PerimeterGenerator_hpp_
|
#define slic3r_PerimeterGenerator_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "ExPolygonCollection.hpp"
|
#include "ExPolygonCollection.hpp"
|
||||||
#include "Flow.hpp"
|
#include "Flow.hpp"
|
||||||
|
@ -151,8 +151,4 @@ PlaceholderParser::find_and_replace(std::string &source, std::string const &find
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(PlaceholderParser, "GCode::PlaceholderParser");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#ifndef slic3r_PlaceholderParser_hpp_
|
#ifndef slic3r_PlaceholderParser_hpp_
|
||||||
#define slic3r_PlaceholderParser_hpp_
|
#define slic3r_PlaceholderParser_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include <myinit.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -299,46 +299,6 @@ operator*(double scalar, const Point& point2)
|
|||||||
return Point(scalar * point2.x, scalar * point2.y);
|
return Point(scalar * point2.x, scalar * point2.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(Point, "Point");
|
|
||||||
|
|
||||||
SV*
|
|
||||||
Point::to_SV_pureperl() const {
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, 1);
|
|
||||||
av_store(av, 0, newSViv(this->x));
|
|
||||||
av_store(av, 1, newSViv(this->y));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Point::from_SV(SV* point_sv)
|
|
||||||
{
|
|
||||||
AV* point_av = (AV*)SvRV(point_sv);
|
|
||||||
// get a double from Perl and round it, otherwise
|
|
||||||
// it would get truncated
|
|
||||||
this->x = lrint(SvNV(*av_fetch(point_av, 0, 0)));
|
|
||||||
this->y = lrint(SvNV(*av_fetch(point_av, 1, 0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Point::from_SV_check(SV* point_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
|
||||||
if (!sv_isa(point_sv, perl_class_name(this)) && !sv_isa(point_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object (got %s)", perl_class_name(this), HvNAME(SvSTASH(SvRV(point_sv))));
|
|
||||||
*this = *(Point*)SvIV((SV*)SvRV( point_sv ));
|
|
||||||
} else {
|
|
||||||
this->from_SV(point_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
REGISTER_CLASS(Point3, "Point3");
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<<(std::ostream &stm, const Pointf &pointf)
|
operator<<(std::ostream &stm, const Pointf &pointf)
|
||||||
{
|
{
|
||||||
@ -386,46 +346,6 @@ Pointf::vector_to(const Pointf &point) const
|
|||||||
return Vectorf(point.x - this->x, point.y - this->y);
|
return Vectorf(point.x - this->x, point.y - this->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(Pointf, "Pointf");
|
|
||||||
|
|
||||||
SV*
|
|
||||||
Pointf::to_SV_pureperl() const {
|
|
||||||
AV* av = newAV();
|
|
||||||
av_fill(av, 1);
|
|
||||||
av_store(av, 0, newSVnv(this->x));
|
|
||||||
av_store(av, 1, newSVnv(this->y));
|
|
||||||
return newRV_noinc((SV*)av);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
Pointf::from_SV(SV* point_sv)
|
|
||||||
{
|
|
||||||
AV* point_av = (AV*)SvRV(point_sv);
|
|
||||||
SV* sv_x = *av_fetch(point_av, 0, 0);
|
|
||||||
SV* sv_y = *av_fetch(point_av, 1, 0);
|
|
||||||
if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false;
|
|
||||||
|
|
||||||
this->x = SvNV(sv_x);
|
|
||||||
this->y = SvNV(sv_y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
Pointf::from_SV_check(SV* point_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
|
||||||
if (!sv_isa(point_sv, perl_class_name(this)) && !sv_isa(point_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object (got %s)", perl_class_name(this), HvNAME(SvSTASH(SvRV(point_sv))));
|
|
||||||
*this = *(Pointf*)SvIV((SV*)SvRV( point_sv ));
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return this->from_SV(point_sv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Pointf3::scale(double factor)
|
Pointf3::scale(double factor)
|
||||||
{
|
{
|
||||||
@ -467,8 +387,4 @@ Pointf3::vector_to(const Pointf3 &point) const
|
|||||||
return Vectorf3(point.x - this->x, point.y - this->y, point.z - this->z);
|
return Vectorf3(point.x - this->x, point.y - this->y, point.z - this->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Pointf3, "Pointf3");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Point_hpp_
|
#ifndef slic3r_Point_hpp_
|
||||||
#define slic3r_Point_hpp_
|
#define slic3r_Point_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -60,12 +60,6 @@ class Point
|
|||||||
Point projection_onto(const Line &line) const;
|
Point projection_onto(const Line &line) const;
|
||||||
Point negative() const;
|
Point negative() const;
|
||||||
Vector vector_to(const Point &point) const;
|
Vector vector_to(const Point &point) const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV(SV* point_sv);
|
|
||||||
void from_SV_check(SV* point_sv);
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Point operator+(const Point& point1, const Point& point2);
|
Point operator+(const Point& point1, const Point& point2);
|
||||||
@ -98,12 +92,6 @@ class Pointf
|
|||||||
void rotate(double angle, const Pointf ¢er);
|
void rotate(double angle, const Pointf ¢er);
|
||||||
Pointf negative() const;
|
Pointf negative() const;
|
||||||
Vectorf vector_to(const Pointf &point) const;
|
Vectorf vector_to(const Pointf &point) const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
bool from_SV(SV* point_sv);
|
|
||||||
bool from_SV_check(SV* point_sv);
|
|
||||||
SV* to_SV_pureperl() const;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Pointf3 : public Pointf
|
class Pointf3 : public Pointf
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include <myinit.h>
|
|
||||||
#include "ClipperUtils.hpp"
|
#include "ClipperUtils.hpp"
|
||||||
#include "Polygon.hpp"
|
#include "Polygon.hpp"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
@ -266,17 +265,4 @@ Polygon::convex_points(double angle) const
|
|||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Polygon, "Polygon");
|
|
||||||
|
|
||||||
void
|
|
||||||
Polygon::from_SV_check(SV* poly_sv)
|
|
||||||
{
|
|
||||||
if (sv_isobject(poly_sv) && !sv_isa(poly_sv, perl_class_name(this)) && !sv_isa(poly_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object", perl_class_name(this));
|
|
||||||
|
|
||||||
MultiPoint::from_SV_check(poly_sv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Polygon_hpp_
|
#ifndef slic3r_Polygon_hpp_
|
||||||
#define slic3r_Polygon_hpp_
|
#define slic3r_Polygon_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Line.hpp"
|
#include "Line.hpp"
|
||||||
@ -42,10 +42,6 @@ class Polygon : public MultiPoint {
|
|||||||
std::string wkt() const;
|
std::string wkt() const;
|
||||||
Points concave_points(double angle = PI) const;
|
Points concave_points(double angle = PI) const;
|
||||||
Points convex_points(double angle = PI) const;
|
Points convex_points(double angle = PI) const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV_check(SV* poly_sv);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -247,18 +247,4 @@ Polyline::wkt() const
|
|||||||
return wkt.str();
|
return wkt.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Polyline, "Polyline");
|
|
||||||
|
|
||||||
void
|
|
||||||
Polyline::from_SV_check(SV* poly_sv)
|
|
||||||
{
|
|
||||||
if (!sv_isa(poly_sv, perl_class_name(this)) && !sv_isa(poly_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object",perl_class_name(this));
|
|
||||||
|
|
||||||
MultiPoint::from_SV_check(poly_sv);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_Polyline_hpp_
|
#ifndef slic3r_Polyline_hpp_
|
||||||
#define slic3r_Polyline_hpp_
|
#define slic3r_Polyline_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "Line.hpp"
|
#include "Line.hpp"
|
||||||
#include "MultiPoint.hpp"
|
#include "MultiPoint.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -28,10 +29,6 @@ class Polyline : public MultiPoint {
|
|||||||
void split_at(const Point &point, Polyline* p1, Polyline* p2) const;
|
void split_at(const Point &point, Polyline* p1, Polyline* p2) const;
|
||||||
bool is_straight() const;
|
bool is_straight() const;
|
||||||
std::string wkt() const;
|
std::string wkt() const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV_check(SV* poly_sv);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,4 @@ PolylineCollection::append(const Polylines &pp)
|
|||||||
this->polylines.insert(this->polylines.end(), pp.begin(), pp.end());
|
this->polylines.insert(this->polylines.end(), pp.begin(), pp.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(PolylineCollection, "Polyline::Collection");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_PolylineCollection_hpp_
|
#ifndef slic3r_PolylineCollection_hpp_
|
||||||
#define slic3r_PolylineCollection_hpp_
|
#define slic3r_PolylineCollection_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "Polyline.hpp"
|
#include "Polyline.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -842,10 +842,4 @@ Print::auto_assign_extruders(ModelObject* model_object) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(Print, "Print");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_Print_hpp_
|
#ifndef slic3r_Print_hpp_
|
||||||
#define slic3r_Print_hpp_
|
#define slic3r_Print_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -1316,13 +1316,4 @@ PrintConfigBase::min_object_distance() const
|
|||||||
: duplicate_distance;
|
: duplicate_distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
|
||||||
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
|
||||||
REGISTER_CLASS(PrintRegionConfig, "Config::PrintRegion");
|
|
||||||
REGISTER_CLASS(GCodeConfig, "Config::GCode");
|
|
||||||
REGISTER_CLASS(PrintConfig, "Config::Print");
|
|
||||||
REGISTER_CLASS(FullPrintConfig, "Config::Full");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_PrintConfig_hpp_
|
#ifndef slic3r_PrintConfig_hpp_
|
||||||
#define slic3r_PrintConfig_hpp_
|
#define slic3r_PrintConfig_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "Config.hpp"
|
#include "Config.hpp"
|
||||||
|
|
||||||
#define OPT_PTR(KEY) if (opt_key == #KEY) return &this->KEY
|
#define OPT_PTR(KEY) if (opt_key == #KEY) return &this->KEY
|
||||||
|
@ -485,9 +485,4 @@ PrintObject::bridge_over_infill()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(PrintObject, "Print::Object");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,8 +65,4 @@ PrintRegion::flow(FlowRole role, double layer_height, bool bridge, bool first_la
|
|||||||
return Flow::new_from_config_width(role, config_width, nozzle_diameter, layer_height, bridge ? (float)this->config.bridge_flow_ratio : 0.0);
|
return Flow::new_from_config_width(role, config_width, nozzle_diameter, layer_height, bridge ? (float)this->config.bridge_flow_ratio : 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(PrintRegion, "Print::Region");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_SVG_hpp_
|
#ifndef slic3r_SVG_hpp_
|
||||||
#define slic3r_SVG_hpp_
|
#define slic3r_SVG_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
#include "Line.hpp"
|
#include "Line.hpp"
|
||||||
#include "TriangleMesh.hpp"
|
#include "TriangleMesh.hpp"
|
||||||
|
@ -54,18 +54,4 @@ Surface::is_bridge() const
|
|||||||
|| this->surface_type == stInternalBridge;
|
|| this->surface_type == stInternalBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(Surface, "Surface");
|
|
||||||
|
|
||||||
void
|
|
||||||
Surface::from_SV_check(SV* surface_sv)
|
|
||||||
{
|
|
||||||
if (!sv_isa(surface_sv, perl_class_name(this)) && !sv_isa(surface_sv, perl_class_name_ref(this)))
|
|
||||||
CONFESS("Not a valid %s object", perl_class_name(this));
|
|
||||||
// a XS Surface was supplied
|
|
||||||
*this = *(Surface *)SvIV((SV*)SvRV( surface_sv ));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_Surface_hpp_
|
#ifndef slic3r_Surface_hpp_
|
||||||
#define slic3r_Surface_hpp_
|
#define slic3r_Surface_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "ExPolygon.hpp"
|
#include "ExPolygon.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -28,10 +29,6 @@ class Surface
|
|||||||
bool is_internal() const;
|
bool is_internal() const;
|
||||||
bool is_bottom() const;
|
bool is_bottom() const;
|
||||||
bool is_bridge() const;
|
bool is_bridge() const;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
void from_SV_check(SV* surface_sv);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Surface> Surfaces;
|
typedef std::vector<Surface> Surfaces;
|
||||||
|
@ -117,8 +117,4 @@ SurfaceCollection::append(const SurfaceCollection &coll)
|
|||||||
this->surfaces.insert(this->surfaces.end(), coll.surfaces.begin(), coll.surfaces.end());
|
this->surfaces.insert(this->surfaces.end(), coll.surfaces.begin(), coll.surfaces.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(SurfaceCollection, "Surface::Collection");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_SurfaceCollection_hpp_
|
#ifndef slic3r_SurfaceCollection_hpp_
|
||||||
#define slic3r_SurfaceCollection_hpp_
|
#define slic3r_SurfaceCollection_hpp_
|
||||||
|
|
||||||
|
#include "libslic3r.h"
|
||||||
#include "Surface.hpp"
|
#include "Surface.hpp"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -405,52 +405,6 @@ TriangleMesh::require_shared_vertices()
|
|||||||
if (this->stl.v_shared == NULL) stl_generate_shared_vertices(&(this->stl));
|
if (this->stl.v_shared == NULL) stl_generate_shared_vertices(&(this->stl));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
|
|
||||||
REGISTER_CLASS(TriangleMesh, "TriangleMesh");
|
|
||||||
|
|
||||||
SV*
|
|
||||||
TriangleMesh::to_SV() {
|
|
||||||
SV* sv = newSV(0);
|
|
||||||
sv_setref_pv( sv, perl_class_name(this), (void*)this );
|
|
||||||
return sv;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TriangleMesh::ReadFromPerl(SV* vertices, SV* facets)
|
|
||||||
{
|
|
||||||
stl.error = 0;
|
|
||||||
stl.stats.type = inmemory;
|
|
||||||
|
|
||||||
// count facets and allocate memory
|
|
||||||
AV* facets_av = (AV*)SvRV(facets);
|
|
||||||
stl.stats.number_of_facets = av_len(facets_av)+1;
|
|
||||||
stl.stats.original_num_facets = stl.stats.number_of_facets;
|
|
||||||
stl_allocate(&stl);
|
|
||||||
|
|
||||||
// read geometry
|
|
||||||
AV* vertices_av = (AV*)SvRV(vertices);
|
|
||||||
for (int i = 0; i < stl.stats.number_of_facets; i++) {
|
|
||||||
AV* facet_av = (AV*)SvRV(*av_fetch(facets_av, i, 0));
|
|
||||||
stl_facet facet;
|
|
||||||
facet.normal.x = 0;
|
|
||||||
facet.normal.y = 0;
|
|
||||||
facet.normal.z = 0;
|
|
||||||
for (unsigned int v = 0; v <= 2; v++) {
|
|
||||||
AV* vertex_av = (AV*)SvRV(*av_fetch(vertices_av, SvIV(*av_fetch(facet_av, v, 0)), 0));
|
|
||||||
facet.vertex[v].x = SvNV(*av_fetch(vertex_av, 0, 0));
|
|
||||||
facet.vertex[v].y = SvNV(*av_fetch(vertex_av, 1, 0));
|
|
||||||
facet.vertex[v].z = SvNV(*av_fetch(vertex_av, 2, 0));
|
|
||||||
}
|
|
||||||
facet.extra[0] = 0;
|
|
||||||
facet.extra[1] = 0;
|
|
||||||
|
|
||||||
stl.facet_start[i] = facet;
|
|
||||||
}
|
|
||||||
|
|
||||||
stl_get_size(&(this->stl));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* layers)
|
TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* layers)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_TriangleMesh_hpp_
|
#ifndef slic3r_TriangleMesh_hpp_
|
||||||
#define slic3r_TriangleMesh_hpp_
|
#define slic3r_TriangleMesh_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "libslic3r.h"
|
||||||
#include <admesh/stl.h>
|
#include <admesh/stl.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "BoundingBox.hpp"
|
#include "BoundingBox.hpp"
|
||||||
@ -53,11 +53,6 @@ class TriangleMesh
|
|||||||
stl_file stl;
|
stl_file stl;
|
||||||
bool repaired;
|
bool repaired;
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
SV* to_SV();
|
|
||||||
void ReadFromPerl(SV* vertices, SV* facets);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void require_shared_vertices();
|
void require_shared_vertices();
|
||||||
friend class TriangleMeshSlicer;
|
friend class TriangleMeshSlicer;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
confess_at(const char *file, int line, const char *func,
|
confess_at(const char *file, int line, const char *func,
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
#ifndef _myinit_h_
|
|
||||||
#define _myinit_h_
|
|
||||||
|
|
||||||
// undef some macros set by Perl which cause compilation errors on Win32
|
|
||||||
#undef read
|
|
||||||
#undef seekdir
|
|
||||||
#undef bind
|
|
||||||
#undef send
|
|
||||||
#undef connect
|
|
||||||
#undef wait
|
|
||||||
#undef accept
|
|
||||||
#undef close
|
|
||||||
#undef open
|
|
||||||
#undef write
|
|
||||||
#undef socket
|
|
||||||
#undef listen
|
|
||||||
#undef shutdown
|
|
||||||
#undef ioctl
|
|
||||||
#undef getpeername
|
|
||||||
#undef rect
|
|
||||||
#undef setsockopt
|
|
||||||
#undef getsockopt
|
|
||||||
#undef getsockname
|
|
||||||
#undef gethostname
|
|
||||||
#undef select
|
|
||||||
#undef socketpair
|
|
||||||
#undef recvfrom
|
|
||||||
#undef sendto
|
|
||||||
|
|
||||||
// these need to be included early for Win32 (listing it in Build.PL is not enough)
|
|
||||||
#include <ostream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
extern "C" {
|
|
||||||
#include "EXTERN.h"
|
|
||||||
#include "perl.h"
|
|
||||||
#include "XSUB.h"
|
|
||||||
#include "ppport.h"
|
|
||||||
#undef do_open
|
|
||||||
#undef do_close
|
|
||||||
}
|
|
||||||
#include "perlglue.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libslic3r/libslic3r.h"
|
|
||||||
|
|
||||||
#endif
|
|
537
xs/src/perlglue.cpp
Normal file
537
xs/src/perlglue.cpp
Normal file
@ -0,0 +1,537 @@
|
|||||||
|
#ifdef SLIC3RXS
|
||||||
|
#include <xsinit.h>
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
REGISTER_CLASS(ExPolygon, "ExPolygon");
|
||||||
|
REGISTER_CLASS(ExPolygonCollection, "ExPolygon::Collection");
|
||||||
|
REGISTER_CLASS(Extruder, "Extruder");
|
||||||
|
REGISTER_CLASS(ExtrusionPath, "ExtrusionPath");
|
||||||
|
REGISTER_CLASS(ExtrusionLoop, "ExtrusionLoop");
|
||||||
|
// there is no ExtrusionLoop::Collection or ExtrusionEntity::Collection
|
||||||
|
REGISTER_CLASS(ExtrusionEntityCollection, "ExtrusionPath::Collection");
|
||||||
|
REGISTER_CLASS(Flow, "Flow");
|
||||||
|
REGISTER_CLASS(AvoidCrossingPerimeters, "GCode::AvoidCrossingPerimeters");
|
||||||
|
REGISTER_CLASS(OozePrevention, "GCode::OozePrevention");
|
||||||
|
REGISTER_CLASS(Wipe, "GCode::Wipe");
|
||||||
|
REGISTER_CLASS(GCode, "GCode");
|
||||||
|
REGISTER_CLASS(GCodeSender, "GCode::Sender");
|
||||||
|
REGISTER_CLASS(GCodeWriter, "GCode::Writer");
|
||||||
|
REGISTER_CLASS(Layer, "Layer");
|
||||||
|
REGISTER_CLASS(SupportLayer, "Layer::Support");
|
||||||
|
REGISTER_CLASS(LayerRegion, "Layer::Region");
|
||||||
|
REGISTER_CLASS(Line, "Line");
|
||||||
|
REGISTER_CLASS(Linef3, "Linef3");
|
||||||
|
REGISTER_CLASS(PerimeterGenerator, "Layer::PerimeterGenerator");
|
||||||
|
REGISTER_CLASS(PlaceholderParser, "GCode::PlaceholderParser");
|
||||||
|
REGISTER_CLASS(Polygon, "Polygon");
|
||||||
|
REGISTER_CLASS(Polyline, "Polyline");
|
||||||
|
REGISTER_CLASS(PolylineCollection, "Polyline::Collection");
|
||||||
|
REGISTER_CLASS(Print, "Print");
|
||||||
|
REGISTER_CLASS(PrintObject, "Print::Object");
|
||||||
|
REGISTER_CLASS(PrintRegion, "Print::Region");
|
||||||
|
REGISTER_CLASS(Model, "Model");
|
||||||
|
REGISTER_CLASS(ModelMaterial, "Model::Material");
|
||||||
|
REGISTER_CLASS(ModelObject, "Model::Object");
|
||||||
|
REGISTER_CLASS(ModelVolume, "Model::Volume");
|
||||||
|
REGISTER_CLASS(ModelInstance, "Model::Instance");
|
||||||
|
REGISTER_CLASS(MotionPlanner, "MotionPlanner");
|
||||||
|
REGISTER_CLASS(BoundingBox, "Geometry::BoundingBox");
|
||||||
|
REGISTER_CLASS(BoundingBoxf, "Geometry::BoundingBoxf");
|
||||||
|
REGISTER_CLASS(BoundingBoxf3, "Geometry::BoundingBoxf3");
|
||||||
|
REGISTER_CLASS(BridgeDetector, "BridgeDetector");
|
||||||
|
REGISTER_CLASS(Point, "Point");
|
||||||
|
REGISTER_CLASS(Point3, "Point3");
|
||||||
|
REGISTER_CLASS(Pointf, "Pointf");
|
||||||
|
REGISTER_CLASS(Pointf3, "Pointf3");
|
||||||
|
REGISTER_CLASS(DynamicPrintConfig, "Config");
|
||||||
|
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
|
||||||
|
REGISTER_CLASS(PrintRegionConfig, "Config::PrintRegion");
|
||||||
|
REGISTER_CLASS(GCodeConfig, "Config::GCode");
|
||||||
|
REGISTER_CLASS(PrintConfig, "Config::Print");
|
||||||
|
REGISTER_CLASS(FullPrintConfig, "Config::Full");
|
||||||
|
REGISTER_CLASS(Surface, "Surface");
|
||||||
|
REGISTER_CLASS(SurfaceCollection, "Surface::Collection");
|
||||||
|
REGISTER_CLASS(TriangleMesh, "TriangleMesh");
|
||||||
|
REGISTER_CLASS(GLVertexArray, "GUI::_3DScene::GLVertexArray");
|
||||||
|
|
||||||
|
SV*
|
||||||
|
ConfigBase__as_hash(ConfigBase* THIS) {
|
||||||
|
HV* hv = newHV();
|
||||||
|
|
||||||
|
t_config_option_keys opt_keys = THIS->keys();
|
||||||
|
for (t_config_option_keys::const_iterator it = opt_keys.begin(); it != opt_keys.end(); ++it)
|
||||||
|
(void)hv_store( hv, it->c_str(), it->length(), ConfigBase__get(THIS, *it), 0 );
|
||||||
|
|
||||||
|
return newRV_noinc((SV*)hv);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV*
|
||||||
|
ConfigBase__get(ConfigBase* THIS, const t_config_option_key &opt_key) {
|
||||||
|
ConfigOption* opt = THIS->option(opt_key);
|
||||||
|
if (opt == NULL) return &PL_sv_undef;
|
||||||
|
|
||||||
|
const ConfigOptionDef* def = THIS->def->get(opt_key);
|
||||||
|
if (def->type == coFloat) {
|
||||||
|
ConfigOptionFloat* optv = dynamic_cast<ConfigOptionFloat*>(opt);
|
||||||
|
return newSVnv(optv->value);
|
||||||
|
} else if (def->type == coFloats) {
|
||||||
|
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, optv->values.size()-1);
|
||||||
|
for (std::vector<double>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||||
|
av_store(av, it - optv->values.begin(), newSVnv(*it));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
} else if (def->type == coPercent) {
|
||||||
|
ConfigOptionPercent* optv = dynamic_cast<ConfigOptionPercent*>(opt);
|
||||||
|
return newSVnv(optv->value);
|
||||||
|
} else if (def->type == coInt) {
|
||||||
|
ConfigOptionInt* optv = dynamic_cast<ConfigOptionInt*>(opt);
|
||||||
|
return newSViv(optv->value);
|
||||||
|
} else if (def->type == coInts) {
|
||||||
|
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, optv->values.size()-1);
|
||||||
|
for (std::vector<int>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||||
|
av_store(av, it - optv->values.begin(), newSViv(*it));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
} else if (def->type == coString) {
|
||||||
|
ConfigOptionString* optv = dynamic_cast<ConfigOptionString*>(opt);
|
||||||
|
// we don't serialize() because that would escape newlines
|
||||||
|
return newSVpvn_utf8(optv->value.c_str(), optv->value.length(), true);
|
||||||
|
} else if (def->type == coStrings) {
|
||||||
|
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, optv->values.size()-1);
|
||||||
|
for (std::vector<std::string>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||||
|
av_store(av, it - optv->values.begin(), newSVpvn_utf8(it->c_str(), it->length(), true));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
} else if (def->type == coPoint) {
|
||||||
|
ConfigOptionPoint* optv = dynamic_cast<ConfigOptionPoint*>(opt);
|
||||||
|
return perl_to_SV_clone_ref(optv->value);
|
||||||
|
} else if (def->type == coPoints) {
|
||||||
|
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, optv->values.size()-1);
|
||||||
|
for (Pointfs::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||||
|
av_store(av, it - optv->values.begin(), perl_to_SV_clone_ref(*it));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
} else if (def->type == coBool) {
|
||||||
|
ConfigOptionBool* optv = dynamic_cast<ConfigOptionBool*>(opt);
|
||||||
|
return newSViv(optv->value ? 1 : 0);
|
||||||
|
} else if (def->type == coBools) {
|
||||||
|
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, optv->values.size()-1);
|
||||||
|
for (std::vector<bool>::iterator it = optv->values.begin(); it != optv->values.end(); ++it)
|
||||||
|
av_store(av, it - optv->values.begin(), newSViv(*it ? 1 : 0));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
} else {
|
||||||
|
std::string serialized = opt->serialize();
|
||||||
|
return newSVpvn_utf8(serialized.c_str(), serialized.length(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SV*
|
||||||
|
ConfigBase__get_at(ConfigBase* THIS, const t_config_option_key &opt_key, size_t i) {
|
||||||
|
ConfigOption* opt = THIS->option(opt_key);
|
||||||
|
if (opt == NULL) return &PL_sv_undef;
|
||||||
|
|
||||||
|
const ConfigOptionDef* def = THIS->def->get(opt_key);
|
||||||
|
if (def->type == coFloats) {
|
||||||
|
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
||||||
|
return newSVnv(optv->get_at(i));
|
||||||
|
} else if (def->type == coInts) {
|
||||||
|
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
||||||
|
return newSViv(optv->get_at(i));
|
||||||
|
} else if (def->type == coStrings) {
|
||||||
|
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
||||||
|
// we don't serialize() because that would escape newlines
|
||||||
|
std::string val = optv->get_at(i);
|
||||||
|
return newSVpvn_utf8(val.c_str(), val.length(), true);
|
||||||
|
} else if (def->type == coPoints) {
|
||||||
|
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
||||||
|
return perl_to_SV_clone_ref(optv->get_at(i));
|
||||||
|
} else if (def->type == coBools) {
|
||||||
|
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
||||||
|
return newSViv(optv->get_at(i) ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
return &PL_sv_undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ConfigBase__set(ConfigBase* THIS, const t_config_option_key &opt_key, SV* value) {
|
||||||
|
ConfigOption* opt = THIS->option(opt_key, true);
|
||||||
|
if (opt == NULL) CONFESS("Trying to set non-existing option");
|
||||||
|
|
||||||
|
const ConfigOptionDef* def = THIS->def->get(opt_key);
|
||||||
|
if (def->type == coFloat) {
|
||||||
|
if (!looks_like_number(value)) return false;
|
||||||
|
ConfigOptionFloat* optv = dynamic_cast<ConfigOptionFloat*>(opt);
|
||||||
|
optv->value = SvNV(value);
|
||||||
|
} else if (def->type == coFloats) {
|
||||||
|
ConfigOptionFloats* optv = dynamic_cast<ConfigOptionFloats*>(opt);
|
||||||
|
std::vector<double> values;
|
||||||
|
AV* av = (AV*)SvRV(value);
|
||||||
|
const size_t len = av_len(av)+1;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
SV** elem = av_fetch(av, i, 0);
|
||||||
|
if (elem == NULL || !looks_like_number(*elem)) return false;
|
||||||
|
values.push_back(SvNV(*elem));
|
||||||
|
}
|
||||||
|
optv->values = values;
|
||||||
|
} else if (def->type == coInt) {
|
||||||
|
if (!looks_like_number(value)) return false;
|
||||||
|
ConfigOptionInt* optv = dynamic_cast<ConfigOptionInt*>(opt);
|
||||||
|
optv->value = SvIV(value);
|
||||||
|
} else if (def->type == coInts) {
|
||||||
|
ConfigOptionInts* optv = dynamic_cast<ConfigOptionInts*>(opt);
|
||||||
|
std::vector<int> values;
|
||||||
|
AV* av = (AV*)SvRV(value);
|
||||||
|
const size_t len = av_len(av)+1;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
SV** elem = av_fetch(av, i, 0);
|
||||||
|
if (elem == NULL || !looks_like_number(*elem)) return false;
|
||||||
|
values.push_back(SvIV(*elem));
|
||||||
|
}
|
||||||
|
optv->values = values;
|
||||||
|
} else if (def->type == coString) {
|
||||||
|
ConfigOptionString* optv = dynamic_cast<ConfigOptionString*>(opt);
|
||||||
|
optv->value = std::string(SvPV_nolen(value), SvCUR(value));
|
||||||
|
} else if (def->type == coStrings) {
|
||||||
|
ConfigOptionStrings* optv = dynamic_cast<ConfigOptionStrings*>(opt);
|
||||||
|
optv->values.clear();
|
||||||
|
AV* av = (AV*)SvRV(value);
|
||||||
|
const size_t len = av_len(av)+1;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
SV** elem = av_fetch(av, i, 0);
|
||||||
|
if (elem == NULL) return false;
|
||||||
|
optv->values.push_back(std::string(SvPV_nolen(*elem), SvCUR(*elem)));
|
||||||
|
}
|
||||||
|
} else if (def->type == coPoint) {
|
||||||
|
ConfigOptionPoint* optv = dynamic_cast<ConfigOptionPoint*>(opt);
|
||||||
|
return from_SV_check(value, &optv->value);
|
||||||
|
} else if (def->type == coPoints) {
|
||||||
|
ConfigOptionPoints* optv = dynamic_cast<ConfigOptionPoints*>(opt);
|
||||||
|
std::vector<Pointf> values;
|
||||||
|
AV* av = (AV*)SvRV(value);
|
||||||
|
const size_t len = av_len(av)+1;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
SV** elem = av_fetch(av, i, 0);
|
||||||
|
Pointf point;
|
||||||
|
if (elem == NULL || !from_SV_check(*elem, &point)) return false;
|
||||||
|
values.push_back(point);
|
||||||
|
}
|
||||||
|
optv->values = values;
|
||||||
|
} else if (def->type == coBool) {
|
||||||
|
ConfigOptionBool* optv = dynamic_cast<ConfigOptionBool*>(opt);
|
||||||
|
optv->value = SvTRUE(value);
|
||||||
|
} else if (def->type == coBools) {
|
||||||
|
ConfigOptionBools* optv = dynamic_cast<ConfigOptionBools*>(opt);
|
||||||
|
optv->values.clear();
|
||||||
|
AV* av = (AV*)SvRV(value);
|
||||||
|
const size_t len = av_len(av)+1;
|
||||||
|
for (size_t i = 0; i < len; i++) {
|
||||||
|
SV** elem = av_fetch(av, i, 0);
|
||||||
|
if (elem == NULL) return false;
|
||||||
|
optv->values.push_back(SvTRUE(*elem));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!opt->deserialize( std::string(SvPV_nolen(value)) )) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This method is implemented as a workaround for this typemap bug:
|
||||||
|
https://rt.cpan.org/Public/Bug/Display.html?id=94110 */
|
||||||
|
bool
|
||||||
|
ConfigBase__set_deserialize(ConfigBase* THIS, const t_config_option_key &opt_key, SV* str) {
|
||||||
|
size_t len;
|
||||||
|
const char * c = SvPV(str, len);
|
||||||
|
std::string value(c, len);
|
||||||
|
|
||||||
|
return THIS->set_deserialize(opt_key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ConfigBase__set_ifndef(ConfigBase* THIS, const t_config_option_key &opt_key, SV* value, bool deserialize)
|
||||||
|
{
|
||||||
|
if (!THIS->has(opt_key)) {
|
||||||
|
if (deserialize) {
|
||||||
|
ConfigBase__set_deserialize(THIS, opt_key, value);
|
||||||
|
} else {
|
||||||
|
ConfigBase__set(THIS, opt_key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
StaticConfig__set(StaticConfig* THIS, const t_config_option_key &opt_key, SV* value) {
|
||||||
|
const ConfigOptionDef* optdef = THIS->def->get(opt_key);
|
||||||
|
if (!optdef->shortcut.empty()) {
|
||||||
|
for (std::vector<t_config_option_key>::const_iterator it = optdef->shortcut.begin(); it != optdef->shortcut.end(); ++it) {
|
||||||
|
if (!StaticConfig__set(THIS, *it, value)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ConfigBase__set(THIS, opt_key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_AV(ExPolygon* expolygon)
|
||||||
|
{
|
||||||
|
const unsigned int num_holes = expolygon->holes.size();
|
||||||
|
AV* av = newAV();
|
||||||
|
av_extend(av, num_holes); // -1 +1
|
||||||
|
|
||||||
|
av_store(av, 0, perl_to_SV_ref(expolygon->contour));
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < num_holes; i++) {
|
||||||
|
av_store(av, i+1, perl_to_SV_ref(expolygon->holes[i]));
|
||||||
|
}
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV_pureperl(const ExPolygon* expolygon)
|
||||||
|
{
|
||||||
|
const unsigned int num_holes = expolygon->holes.size();
|
||||||
|
AV* av = newAV();
|
||||||
|
av_extend(av, num_holes); // -1 +1
|
||||||
|
av_store(av, 0, to_SV_pureperl(&expolygon->contour));
|
||||||
|
for (unsigned int i = 0; i < num_holes; i++) {
|
||||||
|
av_store(av, i+1, to_SV_pureperl(&expolygon->holes[i]));
|
||||||
|
}
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV(SV* expoly_sv, ExPolygon* expolygon)
|
||||||
|
{
|
||||||
|
AV* expoly_av = (AV*)SvRV(expoly_sv);
|
||||||
|
const unsigned int num_polygons = av_len(expoly_av)+1;
|
||||||
|
expolygon->holes.resize(num_polygons-1);
|
||||||
|
|
||||||
|
SV** polygon_sv = av_fetch(expoly_av, 0, 0);
|
||||||
|
from_SV(*polygon_sv, &expolygon->contour);
|
||||||
|
for (unsigned int i = 0; i < num_polygons-1; i++) {
|
||||||
|
polygon_sv = av_fetch(expoly_av, i+1, 0);
|
||||||
|
from_SV(*polygon_sv, &expolygon->holes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* expoly_sv, ExPolygon* expolygon)
|
||||||
|
{
|
||||||
|
if (sv_isobject(expoly_sv) && (SvTYPE(SvRV(expoly_sv)) == SVt_PVMG)) {
|
||||||
|
if (!sv_isa(expoly_sv, perl_class_name(expolygon)) && !sv_isa(expoly_sv, perl_class_name_ref(expolygon)))
|
||||||
|
CONFESS("Not a valid %s object", perl_class_name(expolygon));
|
||||||
|
// a XS ExPolygon was supplied
|
||||||
|
*expolygon = *(ExPolygon *)SvIV((SV*)SvRV( expoly_sv ));
|
||||||
|
} else {
|
||||||
|
// a Perl arrayref was supplied
|
||||||
|
from_SV(expoly_sv, expolygon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV(SV* line_sv, Line* THIS)
|
||||||
|
{
|
||||||
|
AV* line_av = (AV*)SvRV(line_sv);
|
||||||
|
from_SV_check(*av_fetch(line_av, 0, 0), &THIS->a);
|
||||||
|
from_SV_check(*av_fetch(line_av, 1, 0), &THIS->b);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* line_sv, Line* THIS)
|
||||||
|
{
|
||||||
|
if (sv_isobject(line_sv) && (SvTYPE(SvRV(line_sv)) == SVt_PVMG)) {
|
||||||
|
if (!sv_isa(line_sv, perl_class_name(THIS)) && !sv_isa(line_sv, perl_class_name_ref(THIS)))
|
||||||
|
CONFESS("Not a valid %s object", perl_class_name(THIS));
|
||||||
|
*THIS = *(Line*)SvIV((SV*)SvRV( line_sv ));
|
||||||
|
} else {
|
||||||
|
from_SV(line_sv, THIS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_AV(Line* THIS)
|
||||||
|
{
|
||||||
|
AV* av = newAV();
|
||||||
|
av_extend(av, 1);
|
||||||
|
|
||||||
|
av_store(av, 0, perl_to_SV_ref(THIS->a));
|
||||||
|
av_store(av, 1, perl_to_SV_ref(THIS->b));
|
||||||
|
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV_pureperl(const Line* THIS)
|
||||||
|
{
|
||||||
|
AV* av = newAV();
|
||||||
|
av_extend(av, 1);
|
||||||
|
av_store(av, 0, to_SV_pureperl(&THIS->a));
|
||||||
|
av_store(av, 1, to_SV_pureperl(&THIS->b));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV(SV* poly_sv, MultiPoint* THIS)
|
||||||
|
{
|
||||||
|
AV* poly_av = (AV*)SvRV(poly_sv);
|
||||||
|
const unsigned int num_points = av_len(poly_av)+1;
|
||||||
|
THIS->points.resize(num_points);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < num_points; i++) {
|
||||||
|
SV** point_sv = av_fetch(poly_av, i, 0);
|
||||||
|
from_SV_check(*point_sv, &THIS->points[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* poly_sv, MultiPoint* THIS)
|
||||||
|
{
|
||||||
|
if (sv_isobject(poly_sv) && (SvTYPE(SvRV(poly_sv)) == SVt_PVMG)) {
|
||||||
|
*THIS = *(MultiPoint*)SvIV((SV*)SvRV( poly_sv ));
|
||||||
|
} else {
|
||||||
|
from_SV(poly_sv, THIS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_AV(MultiPoint* THIS)
|
||||||
|
{
|
||||||
|
const unsigned int num_points = THIS->points.size();
|
||||||
|
AV* av = newAV();
|
||||||
|
if (num_points > 0) av_extend(av, num_points-1);
|
||||||
|
for (unsigned int i = 0; i < num_points; i++) {
|
||||||
|
av_store(av, i, perl_to_SV_ref(THIS->points[i]));
|
||||||
|
}
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV_pureperl(const MultiPoint* THIS)
|
||||||
|
{
|
||||||
|
const unsigned int num_points = THIS->points.size();
|
||||||
|
AV* av = newAV();
|
||||||
|
if (num_points > 0) av_extend(av, num_points-1);
|
||||||
|
for (unsigned int i = 0; i < num_points; i++) {
|
||||||
|
av_store(av, i, to_SV_pureperl(&THIS->points[i]));
|
||||||
|
}
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* poly_sv, Polygon* THIS)
|
||||||
|
{
|
||||||
|
if (sv_isobject(poly_sv) && !sv_isa(poly_sv, perl_class_name(THIS)) && !sv_isa(poly_sv, perl_class_name_ref(THIS)))
|
||||||
|
CONFESS("Not a valid %s object", perl_class_name(THIS));
|
||||||
|
|
||||||
|
from_SV_check(poly_sv, (MultiPoint*)THIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* poly_sv, Polyline* THIS)
|
||||||
|
{
|
||||||
|
if (!sv_isa(poly_sv, perl_class_name(THIS)) && !sv_isa(poly_sv, perl_class_name_ref(THIS)))
|
||||||
|
CONFESS("Not a valid %s object", perl_class_name(THIS));
|
||||||
|
|
||||||
|
from_SV_check(poly_sv, (MultiPoint*)THIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV_pureperl(const Point* THIS)
|
||||||
|
{
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, 1);
|
||||||
|
av_store(av, 0, newSViv(THIS->x));
|
||||||
|
av_store(av, 1, newSViv(THIS->y));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV(SV* point_sv, Point* point)
|
||||||
|
{
|
||||||
|
AV* point_av = (AV*)SvRV(point_sv);
|
||||||
|
// get a double from Perl and round it, otherwise
|
||||||
|
// it would get truncated
|
||||||
|
point->x = lrint(SvNV(*av_fetch(point_av, 0, 0)));
|
||||||
|
point->y = lrint(SvNV(*av_fetch(point_av, 1, 0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* point_sv, Point* point)
|
||||||
|
{
|
||||||
|
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
||||||
|
if (!sv_isa(point_sv, perl_class_name(point)) && !sv_isa(point_sv, perl_class_name_ref(point)))
|
||||||
|
CONFESS("Not a valid %s object (got %s)", perl_class_name(point), HvNAME(SvSTASH(SvRV(point_sv))));
|
||||||
|
*point = *(Point*)SvIV((SV*)SvRV( point_sv ));
|
||||||
|
} else {
|
||||||
|
from_SV(point_sv, point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV_pureperl(const Pointf* point)
|
||||||
|
{
|
||||||
|
AV* av = newAV();
|
||||||
|
av_fill(av, 1);
|
||||||
|
av_store(av, 0, newSVnv(point->x));
|
||||||
|
av_store(av, 1, newSVnv(point->y));
|
||||||
|
return newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool from_SV(SV* point_sv, Pointf* point)
|
||||||
|
{
|
||||||
|
AV* point_av = (AV*)SvRV(point_sv);
|
||||||
|
SV* sv_x = *av_fetch(point_av, 0, 0);
|
||||||
|
SV* sv_y = *av_fetch(point_av, 1, 0);
|
||||||
|
if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false;
|
||||||
|
|
||||||
|
point->x = SvNV(sv_x);
|
||||||
|
point->y = SvNV(sv_y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool from_SV_check(SV* point_sv, Pointf* point)
|
||||||
|
{
|
||||||
|
if (sv_isobject(point_sv) && (SvTYPE(SvRV(point_sv)) == SVt_PVMG)) {
|
||||||
|
if (!sv_isa(point_sv, perl_class_name(point)) && !sv_isa(point_sv, perl_class_name_ref(point)))
|
||||||
|
CONFESS("Not a valid %s object (got %s)", perl_class_name(point), HvNAME(SvSTASH(SvRV(point_sv))));
|
||||||
|
*point = *(Pointf*)SvIV((SV*)SvRV( point_sv ));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return from_SV(point_sv, point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_SV_check(SV* surface_sv, Surface* THIS)
|
||||||
|
{
|
||||||
|
if (!sv_isa(surface_sv, perl_class_name(THIS)) && !sv_isa(surface_sv, perl_class_name_ref(THIS)))
|
||||||
|
CONFESS("Not a valid %s object", perl_class_name(THIS));
|
||||||
|
// a XS Surface was supplied
|
||||||
|
*THIS = *(Surface *)SvIV((SV*)SvRV( surface_sv ));
|
||||||
|
}
|
||||||
|
|
||||||
|
SV* to_SV(TriangleMesh* THIS)
|
||||||
|
{
|
||||||
|
SV* sv = newSV(0);
|
||||||
|
sv_setref_pv( sv, perl_class_name(THIS), (void*)THIS );
|
||||||
|
return sv;
|
||||||
|
}
|
||||||
|
|
||||||
|
SV*
|
||||||
|
polynode_children_2_perl(const ClipperLib::PolyNode& node)
|
||||||
|
{
|
||||||
|
AV* av = newAV();
|
||||||
|
const int len = node.ChildCount();
|
||||||
|
if (len > 0) av_extend(av, len-1);
|
||||||
|
for (int i = 0; i < len; ++i) {
|
||||||
|
av_store(av, i, polynode2perl(*node.Childs[i]));
|
||||||
|
}
|
||||||
|
return (SV*)newRV_noinc((SV*)av);
|
||||||
|
}
|
||||||
|
|
||||||
|
SV*
|
||||||
|
polynode2perl(const ClipperLib::PolyNode& node)
|
||||||
|
{
|
||||||
|
HV* hv = newHV();
|
||||||
|
Slic3r::Polygon p;
|
||||||
|
ClipperPath_to_Slic3rMultiPoint(node.Contour, &p);
|
||||||
|
if (node.IsHole()) {
|
||||||
|
(void)hv_stores( hv, "hole", Slic3r::perl_to_SV_clone_ref(p) );
|
||||||
|
} else {
|
||||||
|
(void)hv_stores( hv, "outer", Slic3r::perl_to_SV_clone_ref(p) );
|
||||||
|
}
|
||||||
|
(void)hv_stores( hv, "children", polynode_children_2_perl(node) );
|
||||||
|
return (SV*)newRV_noinc((SV*)hv);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,64 +0,0 @@
|
|||||||
#ifndef slic3r_perlglue_hpp_
|
|
||||||
#define slic3r_perlglue_hpp_
|
|
||||||
|
|
||||||
namespace Slic3r {
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
struct ClassTraits {
|
|
||||||
static const char* name;
|
|
||||||
static const char* name_ref;
|
|
||||||
};
|
|
||||||
|
|
||||||
// use this for typedefs for which the forward prototype
|
|
||||||
// in REGISTER_CLASS won't work
|
|
||||||
#define __REGISTER_CLASS(cname, perlname) \
|
|
||||||
template <>const char* ClassTraits<cname>::name = "Slic3r::" perlname; \
|
|
||||||
template <>const char* ClassTraits<cname>::name_ref = "Slic3r::" perlname "::Ref";
|
|
||||||
|
|
||||||
#define REGISTER_CLASS(cname,perlname) \
|
|
||||||
class cname; \
|
|
||||||
__REGISTER_CLASS(cname, perlname);
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
const char* perl_class_name(const T*) { return ClassTraits<T>::name; }
|
|
||||||
template<class T>
|
|
||||||
const char* perl_class_name_ref(const T*) { return ClassTraits<T>::name_ref; }
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
SV* perl_to_SV_ref(T &t) {
|
|
||||||
SV* sv = newSV(0);
|
|
||||||
sv_setref_pv( sv, perl_class_name_ref(&t), &t );
|
|
||||||
return sv;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
SV* perl_to_SV_clone_ref(const T &t) {
|
|
||||||
SV* sv = newSV(0);
|
|
||||||
sv_setref_pv( sv, perl_class_name(&t), new T(t) );
|
|
||||||
return sv;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class Ref {
|
|
||||||
T* val;
|
|
||||||
public:
|
|
||||||
Ref() : val(NULL) {}
|
|
||||||
Ref(T* t) : val(t) {}
|
|
||||||
Ref(const T* t) : val(const_cast<T*>(t)) {}
|
|
||||||
operator T*() const { return val; }
|
|
||||||
static const char* CLASS() { return ClassTraits<T>::name_ref; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class Clone {
|
|
||||||
T* val;
|
|
||||||
public:
|
|
||||||
Clone() : val(NULL) {}
|
|
||||||
Clone(T* t) : val(new T(*t)) {}
|
|
||||||
Clone(const T& t) : val(new T(t)) {}
|
|
||||||
operator T*() const { return val; }
|
|
||||||
static const char* CLASS() { return ClassTraits<T>::name; }
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -241,8 +241,4 @@ GLVertexArray::load_mesh(const TriangleMesh &mesh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SLIC3RXS
|
|
||||||
REGISTER_CLASS(GLVertexArray, "GUI::_3DScene::GLVertexArray");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_3DScene_hpp_
|
#ifndef slic3r_3DScene_hpp_
|
||||||
#define slic3r_3DScene_hpp_
|
#define slic3r_3DScene_hpp_
|
||||||
|
|
||||||
#include <myinit.h>
|
#include "../../libslic3r/libslic3r.h"
|
||||||
#include "../../libslic3r/Point.hpp"
|
#include "../../libslic3r/Point.hpp"
|
||||||
#include "../../libslic3r/Line.hpp"
|
#include "../../libslic3r/Line.hpp"
|
||||||
#include "../../libslic3r/TriangleMesh.hpp"
|
#include "../../libslic3r/TriangleMesh.hpp"
|
||||||
|
149
xs/src/xsinit.h
Normal file
149
xs/src/xsinit.h
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
#ifndef _xsinit_h_
|
||||||
|
#define _xsinit_h_
|
||||||
|
|
||||||
|
// undef some macros set by Perl which cause compilation errors on Win32
|
||||||
|
#undef read
|
||||||
|
#undef seekdir
|
||||||
|
#undef bind
|
||||||
|
#undef send
|
||||||
|
#undef connect
|
||||||
|
#undef wait
|
||||||
|
#undef accept
|
||||||
|
#undef close
|
||||||
|
#undef open
|
||||||
|
#undef write
|
||||||
|
#undef socket
|
||||||
|
#undef listen
|
||||||
|
#undef shutdown
|
||||||
|
#undef ioctl
|
||||||
|
#undef getpeername
|
||||||
|
#undef rect
|
||||||
|
#undef setsockopt
|
||||||
|
#undef getsockopt
|
||||||
|
#undef getsockname
|
||||||
|
#undef gethostname
|
||||||
|
#undef select
|
||||||
|
#undef socketpair
|
||||||
|
#undef recvfrom
|
||||||
|
#undef sendto
|
||||||
|
|
||||||
|
// these need to be included early for Win32 (listing it in Build.PL is not enough)
|
||||||
|
#include <ostream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#ifdef SLIC3RXS
|
||||||
|
extern "C" {
|
||||||
|
#include "EXTERN.h"
|
||||||
|
#include "perl.h"
|
||||||
|
#include "XSUB.h"
|
||||||
|
#include "ppport.h"
|
||||||
|
#undef do_open
|
||||||
|
#undef do_close
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <libslic3r.h>
|
||||||
|
#include <ClipperUtils.hpp>
|
||||||
|
#include <Config.hpp>
|
||||||
|
#include <ExPolygon.hpp>
|
||||||
|
#include <MultiPoint.hpp>
|
||||||
|
#include <Point.hpp>
|
||||||
|
#include <Polygon.hpp>
|
||||||
|
#include <Polyline.hpp>
|
||||||
|
#include <TriangleMesh.hpp>
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ClassTraits {
|
||||||
|
static const char* name;
|
||||||
|
static const char* name_ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
// use this for typedefs for which the forward prototype
|
||||||
|
// in REGISTER_CLASS won't work
|
||||||
|
#define __REGISTER_CLASS(cname, perlname) \
|
||||||
|
template <>const char* ClassTraits<cname>::name = "Slic3r::" perlname; \
|
||||||
|
template <>const char* ClassTraits<cname>::name_ref = "Slic3r::" perlname "::Ref";
|
||||||
|
|
||||||
|
#define REGISTER_CLASS(cname,perlname) \
|
||||||
|
class cname; \
|
||||||
|
__REGISTER_CLASS(cname, perlname);
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
const char* perl_class_name(const T*) { return ClassTraits<T>::name; }
|
||||||
|
template<class T>
|
||||||
|
const char* perl_class_name_ref(const T*) { return ClassTraits<T>::name_ref; }
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
SV* perl_to_SV_ref(T &t) {
|
||||||
|
SV* sv = newSV(0);
|
||||||
|
sv_setref_pv( sv, perl_class_name_ref(&t), &t );
|
||||||
|
return sv;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
SV* perl_to_SV_clone_ref(const T &t) {
|
||||||
|
SV* sv = newSV(0);
|
||||||
|
sv_setref_pv( sv, perl_class_name(&t), new T(t) );
|
||||||
|
return sv;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Ref {
|
||||||
|
T* val;
|
||||||
|
public:
|
||||||
|
Ref() : val(NULL) {}
|
||||||
|
Ref(T* t) : val(t) {}
|
||||||
|
Ref(const T* t) : val(const_cast<T*>(t)) {}
|
||||||
|
operator T*() const { return val; }
|
||||||
|
static const char* CLASS() { return ClassTraits<T>::name_ref; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class Clone {
|
||||||
|
T* val;
|
||||||
|
public:
|
||||||
|
Clone() : val(NULL) {}
|
||||||
|
Clone(T* t) : val(new T(*t)) {}
|
||||||
|
Clone(const T& t) : val(new T(t)) {}
|
||||||
|
operator T*() const { return val; }
|
||||||
|
static const char* CLASS() { return ClassTraits<T>::name; }
|
||||||
|
};
|
||||||
|
|
||||||
|
SV* ConfigBase__as_hash(ConfigBase* THIS);
|
||||||
|
SV* ConfigBase__get(ConfigBase* THIS, const t_config_option_key &opt_key);
|
||||||
|
SV* ConfigBase__get_at(ConfigBase* THIS, const t_config_option_key &opt_key, size_t i);
|
||||||
|
bool ConfigBase__set(ConfigBase* THIS, const t_config_option_key &opt_key, SV* value);
|
||||||
|
bool ConfigBase__set_deserialize(ConfigBase* THIS, const t_config_option_key &opt_key, SV* str);
|
||||||
|
void ConfigBase__set_ifndef(ConfigBase* THIS, const t_config_option_key &opt_key, SV* value, bool deserialize = false);
|
||||||
|
bool StaticConfig__set(StaticConfig* THIS, const t_config_option_key &opt_key, SV* value);
|
||||||
|
SV* to_AV(ExPolygon* expolygon);
|
||||||
|
SV* to_SV_pureperl(const ExPolygon* expolygon);
|
||||||
|
void from_SV(SV* expoly_sv, ExPolygon* expolygon);
|
||||||
|
void from_SV_check(SV* expoly_sv, ExPolygon* expolygon);
|
||||||
|
void from_SV(SV* line_sv, Line* THIS);
|
||||||
|
void from_SV_check(SV* line_sv, Line* THIS);
|
||||||
|
SV* to_AV(Line* THIS);
|
||||||
|
SV* to_SV_pureperl(const Line* THIS);
|
||||||
|
void from_SV(SV* poly_sv, MultiPoint* THIS);
|
||||||
|
void from_SV_check(SV* poly_sv, MultiPoint* THIS);
|
||||||
|
SV* to_AV(MultiPoint* THIS);
|
||||||
|
SV* to_SV_pureperl(const MultiPoint* THIS);
|
||||||
|
void from_SV_check(SV* poly_sv, Polygon* THIS);
|
||||||
|
void from_SV_check(SV* poly_sv, Polyline* THIS);
|
||||||
|
SV* to_SV_pureperl(const Point* THIS);
|
||||||
|
void from_SV(SV* point_sv, Point* point);
|
||||||
|
void from_SV_check(SV* point_sv, Point* point);
|
||||||
|
SV* to_SV_pureperl(const Pointf* point);
|
||||||
|
bool from_SV(SV* point_sv, Pointf* point);
|
||||||
|
bool from_SV_check(SV* point_sv, Pointf* point);
|
||||||
|
void from_SV_check(SV* surface_sv, Surface* THIS);
|
||||||
|
SV* to_SV(TriangleMesh* THIS);
|
||||||
|
SV* polynode_children_2_perl(const ClipperLib::PolyNode& node);
|
||||||
|
SV* polynode2perl(const ClipperLib::PolyNode& node);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
#include "libslic3r/BoundingBox.hpp"
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/BridgeDetector.hpp"
|
#include "libslic3r/BridgeDetector.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "clipper.hpp"
|
#include "clipper.hpp"
|
||||||
#include "libslic3r/ClipperUtils.hpp"
|
#include "libslic3r/ClipperUtils.hpp"
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -9,12 +9,18 @@
|
|||||||
DynamicPrintConfig();
|
DynamicPrintConfig();
|
||||||
~DynamicPrintConfig();
|
~DynamicPrintConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = ConfigBase__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -38,12 +44,18 @@
|
|||||||
GCodeConfig();
|
GCodeConfig();
|
||||||
~GCodeConfig();
|
~GCodeConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -61,12 +73,18 @@
|
|||||||
PrintConfig();
|
PrintConfig();
|
||||||
~PrintConfig();
|
~PrintConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -83,12 +101,18 @@
|
|||||||
PrintRegionConfig();
|
PrintRegionConfig();
|
||||||
~PrintRegionConfig();
|
~PrintRegionConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -105,12 +129,18 @@
|
|||||||
PrintObjectConfig();
|
PrintObjectConfig();
|
||||||
~PrintObjectConfig();
|
~PrintObjectConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -127,12 +157,18 @@
|
|||||||
FullPrintConfig();
|
FullPrintConfig();
|
||||||
~FullPrintConfig();
|
~FullPrintConfig();
|
||||||
bool has(t_config_option_key opt_key);
|
bool has(t_config_option_key opt_key);
|
||||||
SV* as_hash();
|
SV* as_hash()
|
||||||
SV* get(t_config_option_key opt_key);
|
%code{% RETVAL = ConfigBase__as_hash(THIS); %};
|
||||||
SV* get_at(t_config_option_key opt_key, int i);
|
SV* get(t_config_option_key opt_key)
|
||||||
bool set(t_config_option_key opt_key, SV* value);
|
%code{% RETVAL = ConfigBase__get(THIS, opt_key); %};
|
||||||
bool set_deserialize(t_config_option_key opt_key, SV* str);
|
SV* get_at(t_config_option_key opt_key, int i)
|
||||||
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false);
|
%code{% RETVAL = ConfigBase__get_at(THIS, opt_key, i); %};
|
||||||
|
bool set(t_config_option_key opt_key, SV* value)
|
||||||
|
%code{% RETVAL = StaticConfig__set(THIS, opt_key, value); %};
|
||||||
|
bool set_deserialize(t_config_option_key opt_key, SV* str)
|
||||||
|
%code{% RETVAL = ConfigBase__set_deserialize(THIS, opt_key, str); %};
|
||||||
|
void set_ifndef(t_config_option_key opt_key, SV* value, bool deserialize = false)
|
||||||
|
%code{% ConfigBase__set_ifndef(THIS, opt_key, value, deserialize); %};
|
||||||
std::string serialize(t_config_option_key opt_key);
|
std::string serialize(t_config_option_key opt_key);
|
||||||
double get_abs_value(t_config_option_key opt_key);
|
double get_abs_value(t_config_option_key opt_key);
|
||||||
%name{get_abs_value_over}
|
%name{get_abs_value_over}
|
||||||
@ -244,7 +280,7 @@ print_config_def()
|
|||||||
(void)hv_stores( hv, "labels", newRV_noinc((SV*)av) );
|
(void)hv_stores( hv, "labels", newRV_noinc((SV*)av) );
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)hv_stores( hv, "default", config.get(opt_key) );
|
(void)hv_stores( hv, "default", ConfigBase__get(&config, opt_key) );
|
||||||
(void)hv_store( options_hv, opt_key.c_str(), opt_key.length(), newRV_noinc((SV*)hv), 0 );
|
(void)hv_store( options_hv, opt_key.c_str(), opt_key.length(), newRV_noinc((SV*)hv), 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/ExPolygon.hpp"
|
#include "libslic3r/ExPolygon.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -10,9 +10,9 @@
|
|||||||
Clone<ExPolygon> clone()
|
Clone<ExPolygon> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_AV(); %};
|
%code{% RETVAL = to_AV(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
Ref<Polygon> contour()
|
Ref<Polygon> contour()
|
||||||
%code{% RETVAL = &(THIS->contour); %};
|
%code{% RETVAL = &(THIS->contour); %};
|
||||||
Polygons* holes()
|
Polygons* holes()
|
||||||
@ -46,10 +46,10 @@ ExPolygon::new(...)
|
|||||||
CODE:
|
CODE:
|
||||||
RETVAL = new ExPolygon ();
|
RETVAL = new ExPolygon ();
|
||||||
// ST(0) is class name, ST(1) is contour and others are holes
|
// ST(0) is class name, ST(1) is contour and others are holes
|
||||||
RETVAL->contour.from_SV_check(ST(1));
|
from_SV_check(ST(1), &RETVAL->contour);
|
||||||
RETVAL->holes.resize(items-2);
|
RETVAL->holes.resize(items-2);
|
||||||
for (unsigned int i = 2; i < items; i++) {
|
for (unsigned int i = 2; i < items; i++) {
|
||||||
RETVAL->holes[i-2].from_SV_check(ST(i));
|
from_SV_check(ST(i), &RETVAL->holes[i-2]);
|
||||||
}
|
}
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -60,7 +60,7 @@ ExPolygon::rotate(angle, center_sv)
|
|||||||
SV* center_sv;
|
SV* center_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point center;
|
Point center;
|
||||||
center.from_SV_check(center_sv);
|
from_SV_check(center_sv, ¢er);
|
||||||
THIS->rotate(angle, center);
|
THIS->rotate(angle, center);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/ExPolygonCollection.hpp"
|
#include "libslic3r/ExPolygonCollection.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ ExPolygonCollection::new(...)
|
|||||||
RETVAL->expolygons.resize(items-1);
|
RETVAL->expolygons.resize(items-1);
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
// Note: a COPY of the input is stored
|
// Note: a COPY of the input is stored
|
||||||
RETVAL->expolygons[i-1].from_SV_check(ST(i));
|
from_SV_check(ST(i), &RETVAL->expolygons[i-1]);
|
||||||
}
|
}
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -62,7 +62,7 @@ ExPolygonCollection::pp()
|
|||||||
av_fill(av, THIS->expolygons.size()-1);
|
av_fill(av, THIS->expolygons.size()-1);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
|
||||||
av_store(av, i++, (*it).to_SV_pureperl());
|
av_store(av, i++, to_SV_pureperl(&*it));
|
||||||
}
|
}
|
||||||
RETVAL = newRV_noinc((SV*)av);
|
RETVAL = newRV_noinc((SV*)av);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
@ -73,7 +73,7 @@ ExPolygonCollection::append(...)
|
|||||||
CODE:
|
CODE:
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
ExPolygon expolygon;
|
ExPolygon expolygon;
|
||||||
expolygon.from_SV_check( ST(i) );
|
from_SV_check(ST(i), &expolygon);
|
||||||
THIS->expolygons.push_back(expolygon);
|
THIS->expolygons.push_back(expolygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Extruder.hpp"
|
#include "libslic3r/Extruder.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/ExtrusionEntity.hpp"
|
#include "libslic3r/ExtrusionEntity.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/ExtrusionEntity.hpp"
|
#include "libslic3r/ExtrusionEntity.hpp"
|
||||||
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
#include "libslic3r/ExtrusionEntityCollection.hpp"
|
||||||
%}
|
%}
|
||||||
@ -9,9 +9,9 @@
|
|||||||
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
|
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
|
||||||
~ExtrusionPath();
|
~ExtrusionPath();
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->polyline.to_AV(); %};
|
%code{% RETVAL = to_AV(&THIS->polyline); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->polyline.to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(&THIS->polyline); %};
|
||||||
void pop_back()
|
void pop_back()
|
||||||
%code{% THIS->polyline.points.pop_back(); %};
|
%code{% THIS->polyline.points.pop_back(); %};
|
||||||
void reverse();
|
void reverse();
|
||||||
@ -39,7 +39,7 @@ _new(CLASS, polyline_sv, role, mm3_per_mm, width, height)
|
|||||||
float height;
|
float height;
|
||||||
CODE:
|
CODE:
|
||||||
RETVAL = new ExtrusionPath (role);
|
RETVAL = new ExtrusionPath (role);
|
||||||
RETVAL->polyline.from_SV_check(polyline_sv);
|
from_SV_check(polyline_sv, &RETVAL->polyline);
|
||||||
RETVAL->mm3_per_mm = mm3_per_mm;
|
RETVAL->mm3_per_mm = mm3_per_mm;
|
||||||
RETVAL->width = width;
|
RETVAL->width = width;
|
||||||
RETVAL->height = height;
|
RETVAL->height = height;
|
||||||
@ -50,7 +50,7 @@ Ref<Polyline>
|
|||||||
ExtrusionPath::polyline(...)
|
ExtrusionPath::polyline(...)
|
||||||
CODE:
|
CODE:
|
||||||
if (items > 1) {
|
if (items > 1) {
|
||||||
THIS->polyline.from_SV_check( ST(1) );
|
from_SV_check(ST(1), &THIS->polyline);
|
||||||
}
|
}
|
||||||
RETVAL = &(THIS->polyline);
|
RETVAL = &(THIS->polyline);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
@ -101,7 +101,7 @@ ExtrusionPath::append(...)
|
|||||||
CODE:
|
CODE:
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
Point p;
|
Point p;
|
||||||
p.from_SV_check(ST(i));
|
from_SV_check(ST(i), &p);
|
||||||
THIS->polyline.points.push_back(p);
|
THIS->polyline.points.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Flow.hpp"
|
#include "libslic3r/Flow.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/GCode.hpp"
|
#include "libslic3r/GCode.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/GCodeWriter.hpp"
|
#include "libslic3r/GCodeWriter.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "slic3r/GUI/GUI.hpp"
|
#include "slic3r/GUI/GUI.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
|
|
||||||
%name{Slic3r::GUI::_3DScene::GLVertexArray} class GLVertexArray {
|
%name{Slic3r::GUI::_3DScene::GLVertexArray} class GLVertexArray {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Geometry.hpp"
|
#include "libslic3r/Geometry.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Layer.hpp"
|
#include "libslic3r/Layer.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Line.hpp"
|
#include "libslic3r/Line.hpp"
|
||||||
#include "libslic3r/Polyline.hpp"
|
#include "libslic3r/Polyline.hpp"
|
||||||
%}
|
%}
|
||||||
@ -11,9 +11,9 @@
|
|||||||
Clone<Line> clone()
|
Clone<Line> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_AV(); %};
|
%code{% RETVAL = to_AV(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
Ref<Point> a()
|
Ref<Point> a()
|
||||||
%code{% RETVAL=&THIS->a; %};
|
%code{% RETVAL=&THIS->a; %};
|
||||||
Ref<Point> b()
|
Ref<Point> b()
|
||||||
@ -48,8 +48,8 @@ Line::new(...)
|
|||||||
CODE:
|
CODE:
|
||||||
RETVAL = new Line ();
|
RETVAL = new Line ();
|
||||||
// ST(0) is class name, ST(1) and ST(2) are endpoints
|
// ST(0) is class name, ST(1) and ST(2) are endpoints
|
||||||
RETVAL->a.from_SV_check( ST(1) );
|
from_SV_check(ST(1), &RETVAL->a);
|
||||||
RETVAL->b.from_SV_check( ST(2) );
|
from_SV_check(ST(2), &RETVAL->b);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Line::rotate(angle, center_sv)
|
|||||||
SV* center_sv;
|
SV* center_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point center;
|
Point center;
|
||||||
center.from_SV_check(center_sv);
|
from_SV_check(center_sv, ¢er);
|
||||||
THIS->rotate(angle, center);
|
THIS->rotate(angle, center);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -67,7 +67,7 @@ Line::coincides_with(line_sv)
|
|||||||
SV* line_sv;
|
SV* line_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Line line;
|
Line line;
|
||||||
line.from_SV_check(line_sv);
|
from_SV_check(line_sv, &line);
|
||||||
RETVAL = THIS->coincides_with(line);
|
RETVAL = THIS->coincides_with(line);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/MotionPlanner.hpp"
|
#include "libslic3r/MotionPlanner.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/PerimeterGenerator.hpp"
|
#include "libslic3r/PerimeterGenerator.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "libslic3r/PlaceholderParser.hpp"
|
#include "libslic3r/PlaceholderParser.hpp"
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
#include "libslic3r/Polygon.hpp"
|
#include "libslic3r/Polygon.hpp"
|
||||||
#include "libslic3r/Polyline.hpp"
|
#include "libslic3r/Polyline.hpp"
|
||||||
@ -15,9 +15,9 @@
|
|||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
void translate(double x, double y);
|
void translate(double x, double y);
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
long x()
|
long x()
|
||||||
%code{% RETVAL = THIS->x; %};
|
%code{% RETVAL = THIS->x; %};
|
||||||
long y()
|
long y()
|
||||||
@ -58,7 +58,7 @@ Point::rotate(angle, center_sv)
|
|||||||
SV* center_sv;
|
SV* center_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point center;
|
Point center;
|
||||||
center.from_SV_check(center_sv);
|
from_SV_check(center_sv, ¢er);
|
||||||
THIS->rotate(angle, center);
|
THIS->rotate(angle, center);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -66,7 +66,7 @@ Point::coincides_with(point_sv)
|
|||||||
SV* point_sv;
|
SV* point_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point point;
|
Point point;
|
||||||
point.from_SV_check(point_sv);
|
from_SV_check(point_sv, &point);
|
||||||
RETVAL = THIS->coincides_with(point);
|
RETVAL = THIS->coincides_with(point);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -94,9 +94,9 @@ Point::coincides_with(point_sv)
|
|||||||
Clone<Pointf> clone()
|
Clone<Pointf> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
double x()
|
double x()
|
||||||
%code{% RETVAL = THIS->x; %};
|
%code{% RETVAL = THIS->x; %};
|
||||||
double y()
|
double y()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
#include "libslic3r/BoundingBox.hpp"
|
||||||
#include "libslic3r/Polygon.hpp"
|
#include "libslic3r/Polygon.hpp"
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
#include "libslic3r/BoundingBox.hpp"
|
||||||
@ -12,9 +12,9 @@
|
|||||||
Clone<Polygon> clone()
|
Clone<Polygon> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_AV(); %};
|
%code{% RETVAL = to_AV(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
void translate(double x, double y);
|
void translate(double x, double y);
|
||||||
void reverse();
|
void reverse();
|
||||||
@ -51,7 +51,7 @@ Polygon::new(...)
|
|||||||
// ST(0) is class name, ST(1) is first point
|
// ST(0) is class name, ST(1) is first point
|
||||||
RETVAL->points.resize(items-1);
|
RETVAL->points.resize(items-1);
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
RETVAL->points[i-1].from_SV_check( ST(i) );
|
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
||||||
}
|
}
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -62,7 +62,7 @@ Polygon::rotate(angle, center_sv)
|
|||||||
SV* center_sv;
|
SV* center_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point center;
|
Point center;
|
||||||
center.from_SV_check(center_sv);
|
from_SV_check(center_sv, ¢er);
|
||||||
THIS->rotate(angle, center);
|
THIS->rotate(angle, center);
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/BoundingBox.hpp"
|
#include "libslic3r/BoundingBox.hpp"
|
||||||
#include "libslic3r/ClipperUtils.hpp"
|
#include "libslic3r/ClipperUtils.hpp"
|
||||||
#include "libslic3r/Polyline.hpp"
|
#include "libslic3r/Polyline.hpp"
|
||||||
@ -12,9 +12,9 @@
|
|||||||
Clone<Polyline> clone()
|
Clone<Polyline> clone()
|
||||||
%code{% RETVAL = THIS; %};
|
%code{% RETVAL = THIS; %};
|
||||||
SV* arrayref()
|
SV* arrayref()
|
||||||
%code{% RETVAL = THIS->to_AV(); %};
|
%code{% RETVAL = to_AV(THIS); %};
|
||||||
SV* pp()
|
SV* pp()
|
||||||
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
void translate(double x, double y);
|
void translate(double x, double y);
|
||||||
void pop_back()
|
void pop_back()
|
||||||
@ -48,7 +48,7 @@ Polyline::new(...)
|
|||||||
// ST(0) is class name, ST(1) is first point
|
// ST(0) is class name, ST(1) is first point
|
||||||
RETVAL->points.resize(items-1);
|
RETVAL->points.resize(items-1);
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
RETVAL->points[i-1].from_SV_check( ST(i) );
|
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
||||||
}
|
}
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -58,7 +58,7 @@ Polyline::append(...)
|
|||||||
CODE:
|
CODE:
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
Point p;
|
Point p;
|
||||||
p.from_SV_check( ST(i) );
|
from_SV_check(ST(i), &p);
|
||||||
THIS->points.push_back(p);
|
THIS->points.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ Polyline::rotate(angle, center_sv)
|
|||||||
SV* center_sv;
|
SV* center_sv;
|
||||||
CODE:
|
CODE:
|
||||||
Point center;
|
Point center;
|
||||||
center.from_SV_check(center_sv);
|
from_SV_check(center_sv, ¢er);
|
||||||
THIS->rotate(angle, center);
|
THIS->rotate(angle, center);
|
||||||
|
|
||||||
Polygons
|
Polygons
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/PolylineCollection.hpp"
|
#include "libslic3r/PolylineCollection.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ PolylineCollection::new(...)
|
|||||||
RETVAL->polylines.resize(items-1);
|
RETVAL->polylines.resize(items-1);
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
// Note: a COPY of the input is stored
|
// Note: a COPY of the input is stored
|
||||||
RETVAL->polylines[i-1].from_SV_check(ST(i));
|
from_SV_check(ST(i), &RETVAL->polylines[i-1]);
|
||||||
}
|
}
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
RETVAL
|
RETVAL
|
||||||
@ -59,7 +59,7 @@ PolylineCollection::pp()
|
|||||||
av_fill(av, THIS->polylines.size()-1);
|
av_fill(av, THIS->polylines.size()-1);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
for (Polylines::iterator it = THIS->polylines.begin(); it != THIS->polylines.end(); ++it) {
|
||||||
av_store(av, i++, (*it).to_SV_pureperl());
|
av_store(av, i++, to_SV_pureperl(&*it));
|
||||||
}
|
}
|
||||||
RETVAL = newRV_noinc((SV*)av);
|
RETVAL = newRV_noinc((SV*)av);
|
||||||
OUTPUT:
|
OUTPUT:
|
||||||
@ -70,7 +70,7 @@ PolylineCollection::append(...)
|
|||||||
CODE:
|
CODE:
|
||||||
for (unsigned int i = 1; i < items; i++) {
|
for (unsigned int i = 1; i < items; i++) {
|
||||||
Polyline polyline;
|
Polyline polyline;
|
||||||
polyline.from_SV_check( ST(i) );
|
from_SV_check(ST(i), &polyline);
|
||||||
THIS->polylines.push_back(polyline);
|
THIS->polylines.push_back(polyline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
#include "libslic3r/PlaceholderParser.hpp"
|
#include "libslic3r/PlaceholderParser.hpp"
|
||||||
%}
|
%}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
%module{Slic3r::XS};
|
%module{Slic3r::XS};
|
||||||
|
|
||||||
#include <myinit.h>
|
#include <xsinit.h>
|
||||||
#include "libslic3r/SupportMaterial.hpp"
|
#include "libslic3r/SupportMaterial.hpp"
|
||||||
|
|
||||||
%package{Slic3r::Print::SupportMaterial};
|
%package{Slic3r::Print::SupportMaterial};
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user