Filler.xsp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_adjust(bool dont_adjust)
  33. %code{% THIS->params.dont_adjust = dont_adjust; %};
  34. PolylineCollection* _fill_surface(Surface *surface)
  35. %code{%
  36. PolylineCollection *pc = NULL;
  37. if (THIS->fill != NULL) {
  38. pc = new PolylineCollection();
  39. pc->polylines = THIS->fill->fill_surface(surface, THIS->params);
  40. }
  41. RETVAL = pc;
  42. %};
  43. %{
  44. Filler*
  45. new_from_type(CLASS, type)
  46. char* CLASS;
  47. std::string type;
  48. CODE:
  49. Filler *filler = new Filler();
  50. filler->fill = Fill::new_from_type(type);
  51. RETVAL = filler;
  52. OUTPUT:
  53. RETVAL
  54. %}
  55. };