Filler.xsp 2.0 KB

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