Browse Source

Added new file: ExtrusionMultiPath.xsp
Fixed a missing copy constructor of ExtrusionPath.

bubnikv 8 years ago
parent
commit
3985f50c5b
2 changed files with 40 additions and 0 deletions
  1. 1 0
      xs/src/libslic3r/ExtrusionEntity.hpp
  2. 39 0
      xs/xsp/ExtrusionMultiPath.xsp

+ 1 - 0
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) {};
 

+ 39 - 0
xs/xsp/ExtrusionMultiPath.xsp

@@ -0,0 +1,39 @@
+%module{Slic3r::XS};
+
+%{
+#include <xsinit.h>
+#include "libslic3r/ExtrusionEntity.hpp"
+%}
+
+%name{Slic3r::ExtrusionMultiPath} class ExtrusionMultiPath {
+    ExtrusionMultiPath();
+    ~ExtrusionMultiPath();
+    Clone<ExtrusionMultiPath> clone()
+        %code{% RETVAL = THIS; %};
+    void reverse();
+    Clone<Point> first_point();
+    Clone<Point> 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
+
+%}
+};