From 3985f50c5b9f9ead7da7527142bdcf1e5c22ea5c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Fri, 20 Jan 2017 15:41:50 +0100 Subject: [PATCH] Added new file: ExtrusionMultiPath.xsp Fixed a missing copy constructor of ExtrusionPath. --- xs/src/libslic3r/ExtrusionEntity.hpp | 1 + xs/xsp/ExtrusionMultiPath.xsp | 39 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 xs/xsp/ExtrusionMultiPath.xsp diff --git a/xs/src/libslic3r/ExtrusionEntity.hpp b/xs/src/libslic3r/ExtrusionEntity.hpp index d7b683801..f04238ac2 100644 --- a/xs/src/libslic3r/ExtrusionEntity.hpp +++ b/xs/src/libslic3r/ExtrusionEntity.hpp @@ -78,6 +78,7 @@ public: ExtrusionPath(ExtrusionRole role) : role(role), mm3_per_mm(-1), width(-1), height(-1) {}; ExtrusionPath(ExtrusionRole role, double mm3_per_mm, float width, float height) : role(role), mm3_per_mm(mm3_per_mm), width(width), height(height) {}; + ExtrusionPath(const ExtrusionPath &rhs) : role(rhs.role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(rhs.polyline) {} ExtrusionPath(ExtrusionPath &&rhs) : role(rhs.role), mm3_per_mm(rhs.mm3_per_mm), width(rhs.width), height(rhs.height), polyline(std::move(rhs.polyline)) {} // ExtrusionPath(ExtrusionRole role, const Flow &flow) : role(role), mm3_per_mm(flow.mm3_per_mm()), width(flow.width), height(flow.height) {}; diff --git a/xs/xsp/ExtrusionMultiPath.xsp b/xs/xsp/ExtrusionMultiPath.xsp new file mode 100644 index 000000000..31522331c --- /dev/null +++ b/xs/xsp/ExtrusionMultiPath.xsp @@ -0,0 +1,39 @@ +%module{Slic3r::XS}; + +%{ +#include +#include "libslic3r/ExtrusionEntity.hpp" +%} + +%name{Slic3r::ExtrusionMultiPath} class ExtrusionMultiPath { + ExtrusionMultiPath(); + ~ExtrusionMultiPath(); + Clone clone() + %code{% RETVAL = THIS; %}; + void reverse(); + Clone first_point(); + Clone last_point(); + void append(ExtrusionPath* path) + %code{% THIS->paths.push_back(*path); %}; + double length(); + bool is_perimeter(); + bool is_infill(); + bool is_solid_infill(); + Polygons polygons_covered_by_width(); + Polygons polygons_covered_by_spacing(); +%{ + +SV* +ExtrusionMultiPath::arrayref() + CODE: + AV* av = newAV(); + av_fill(av, THIS->paths.size()-1); + for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) { + av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it)); + } + RETVAL = newRV_noinc((SV*)av); + OUTPUT: + RETVAL + +%} +};