ExtrusionLoop.xsp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/ExtrusionEntity.hpp"
  5. %}
  6. %name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
  7. ExtrusionLoop();
  8. ~ExtrusionLoop();
  9. Clone<ExtrusionLoop> clone()
  10. %code{% RETVAL = THIS; %};
  11. void reverse();
  12. bool make_clockwise();
  13. bool make_counter_clockwise();
  14. Clone<Point> first_point();
  15. Clone<Point> last_point();
  16. Clone<Polygon> polygon();
  17. void append(ExtrusionPath* path)
  18. %code{% THIS->paths.push_back(*path); %};
  19. double length();
  20. bool split_at_vertex(Point* point)
  21. %code{% RETVAL = THIS->split_at_vertex(*point); %};
  22. void split_at(Point* point, int prefer_non_overhang = 0)
  23. %code{% THIS->split_at(*point, prefer_non_overhang != 0); %};
  24. ExtrusionPaths clip_end(double distance)
  25. %code{% THIS->clip_end(distance, &RETVAL); %};
  26. bool has_overhang_point(Point* point)
  27. %code{% RETVAL = THIS->has_overhang_point(*point); %};
  28. bool is_perimeter();
  29. bool is_infill();
  30. bool is_solid_infill();
  31. Polygons grow();
  32. Clone<Polyline> as_polyline();
  33. %{
  34. SV*
  35. ExtrusionLoop::arrayref()
  36. CODE:
  37. AV* av = newAV();
  38. if (!THIS->paths.empty()) av_extend(av, THIS->paths.size()-1);
  39. for (ExtrusionPaths::iterator it = THIS->paths.begin(); it != THIS->paths.end(); ++it) {
  40. av_store(av, it - THIS->paths.begin(), perl_to_SV_ref(*it));
  41. }
  42. RETVAL = newRV_noinc((SV*)av);
  43. OUTPUT:
  44. RETVAL
  45. ExtrusionLoopRole
  46. ExtrusionLoop::role(...)
  47. CODE:
  48. if (items > 1) {
  49. THIS->role = (ExtrusionLoopRole)SvUV(ST(1));
  50. }
  51. RETVAL = THIS->role;
  52. OUTPUT:
  53. RETVAL
  54. %}
  55. };
  56. %package{Slic3r::ExtrusionLoop};
  57. %{
  58. IV
  59. _constant()
  60. ALIAS:
  61. EXTRL_ROLE_DEFAULT = elrDefault
  62. EXTRL_ROLE_CONTOUR_INTERNAL_PERIMETER = elrContourInternalPerimeter
  63. EXTRL_ROLE_SKIRT = elrSkirt
  64. PROTOTYPE:
  65. CODE:
  66. RETVAL = ix;
  67. OUTPUT: RETVAL
  68. %}