Filler.xsp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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->set_bounding_box(*bbox); %};
  13. void set_spacing(coordf_t spacing)
  14. %code{% THIS->fill->spacing = spacing; %};
  15. coordf_t spacing()
  16. %code{% RETVAL = THIS->fill->spacing; %};
  17. void set_layer_id(size_t layer_id)
  18. %code{% THIS->fill->layer_id = layer_id; %};
  19. void set_z(coordf_t z)
  20. %code{% THIS->fill->z = z; %};
  21. void set_angle(float angle)
  22. %code{% THIS->fill->angle = angle; %};
  23. void set_link_max_length(coordf_t len)
  24. %code{% THIS->fill->link_max_length = len; %};
  25. void set_loop_clipping(coordf_t clipping)
  26. %code{% THIS->fill->loop_clipping = clipping; %};
  27. bool use_bridge_flow()
  28. %code{% RETVAL = THIS->fill->use_bridge_flow(); %};
  29. bool no_sort()
  30. %code{% RETVAL = THIS->fill->no_sort(); %};
  31. void set_density(float density)
  32. %code{% THIS->params.density = density; %};
  33. void set_dont_connect(bool dont_connect)
  34. %code{% THIS->params.dont_connect = dont_connect; %};
  35. void set_dont_adjust(bool dont_adjust)
  36. %code{% THIS->params.dont_adjust = dont_adjust; %};
  37. void set_complete(bool complete)
  38. %code{% THIS->params.complete = complete; %};
  39. PolylineCollection* _fill_surface(Surface *surface)
  40. %code{%
  41. PolylineCollection *pc = NULL;
  42. if (THIS->fill != NULL) {
  43. pc = new PolylineCollection();
  44. pc->polylines = THIS->fill->fill_surface(surface, THIS->params);
  45. }
  46. RETVAL = pc;
  47. %};
  48. %{
  49. Filler*
  50. new_from_type(CLASS, type)
  51. char* CLASS;
  52. std::string type;
  53. CODE:
  54. Filler *filler = new Filler();
  55. filler->fill = Fill::new_from_type(type);
  56. RETVAL = filler;
  57. OUTPUT:
  58. RETVAL
  59. void
  60. make_fill(CLASS, layer_region, out_append)
  61. char* CLASS;
  62. LayerRegion* layer_region;
  63. ExtrusionEntityCollection* out_append;
  64. CODE:
  65. make_fill(*layer_region, *out_append);
  66. %}
  67. };