Filler.xsp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/Fill/Fill.hpp"
  5. #include "libslic3r/PolylineCollection.hpp"
  6. #include "libslic3r/ExtrusionEntity.hpp"
  7. #include "libslic3r/ExtrusionEntityCollection.hpp"
  8. %}
  9. %name{Slic3r::Filler} class Filler {
  10. ~Filler();
  11. void set_bounding_box(BoundingBox *bbox)
  12. %code{% THIS->fill->bounding_box = *bbox; %};
  13. void set_min_spacing(coordf_t spacing)
  14. %code{% THIS->fill->min_spacing = spacing; %};
  15. coordf_t min_spacing()
  16. %code{% RETVAL = THIS->fill->min_spacing; %};
  17. coordf_t spacing()
  18. %code{% RETVAL = THIS->fill->spacing(); %};
  19. void set_endpoints_overlap(float overlap)
  20. %code{% THIS->fill->endpoints_overlap = overlap; %};
  21. float endpoints_overlap()
  22. %code{% RETVAL = THIS->fill->endpoints_overlap; %};
  23. void set_layer_id(size_t layer_id)
  24. %code{% THIS->fill->layer_id = layer_id; %};
  25. void set_z(coordf_t z)
  26. %code{% THIS->fill->z = z; %};
  27. void set_angle(float angle)
  28. %code{% THIS->fill->angle = angle; %};
  29. void set_link_max_length(coordf_t len)
  30. %code{% THIS->fill->link_max_length = len; %};
  31. void set_loop_clipping(coordf_t clipping)
  32. %code{% THIS->fill->loop_clipping = clipping; %};
  33. bool use_bridge_flow()
  34. %code{% RETVAL = THIS->fill->use_bridge_flow(); %};
  35. bool no_sort()
  36. %code{% RETVAL = THIS->fill->no_sort(); %};
  37. void set_density(float density)
  38. %code{% THIS->fill->density = density; %};
  39. void set_dont_connect(bool dont_connect)
  40. %code{% THIS->fill->dont_connect = dont_connect; %};
  41. void set_dont_adjust(bool dont_adjust)
  42. %code{% THIS->fill->dont_adjust = dont_adjust; %};
  43. void set_complete(bool complete)
  44. %code{% THIS->fill->complete = complete; %};
  45. PolylineCollection* _fill_surface(Surface *surface)
  46. %code{%
  47. PolylineCollection *pc = NULL;
  48. if (THIS->fill != NULL) {
  49. pc = new PolylineCollection();
  50. pc->polylines = THIS->fill->fill_surface(*surface);
  51. }
  52. RETVAL = pc;
  53. %};
  54. %{
  55. Filler*
  56. new_from_type(CLASS, type)
  57. char* CLASS;
  58. std::string type;
  59. CODE:
  60. Filler *filler = new Filler();
  61. filler->fill = Fill::new_from_type(type);
  62. RETVAL = filler;
  63. OUTPUT:
  64. RETVAL
  65. %}
  66. };