Layer.xsp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/Layer.hpp"
  5. #include "libslic3r/ExPolygonCollection.hpp"
  6. %}
  7. %name{Slic3r::Layer::Region} class LayerRegion {
  8. // owned by Layer, no constructor/destructor
  9. Ref<Layer> layer();
  10. Ref<PrintRegion> region()
  11. %code%{ RETVAL = &THIS->region(); %};
  12. Ref<SurfaceCollection> slices()
  13. %code%{ RETVAL = &THIS->slices; %};
  14. Ref<ExtrusionEntityCollection> thin_fills()
  15. %code%{ RETVAL = &THIS->thin_fills; %};
  16. Ref<SurfaceCollection> fill_surfaces()
  17. %code%{ RETVAL = &THIS->fill_surfaces; %};
  18. Ref<ExtrusionEntityCollection> perimeters()
  19. %code%{ RETVAL = &THIS->perimeters; %};
  20. Ref<ExtrusionEntityCollection> fills()
  21. %code%{ RETVAL = &THIS->fills; %};
  22. Clone<Flow> flow(FlowRole role)
  23. %code%{ RETVAL = THIS->flow(role); %};
  24. void prepare_fill_surfaces();
  25. void make_perimeters(SurfaceCollection* slices, SurfaceCollection* fill_surfaces)
  26. %code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
  27. double infill_area_threshold();
  28. void export_region_slices_to_svg(const char *path) const;
  29. void export_region_fill_surfaces_to_svg(const char *path) const;
  30. void export_region_slices_to_svg_debug(const char *name) const;
  31. void export_region_fill_surfaces_to_svg_debug(const char *name) const;
  32. };
  33. %name{Slic3r::Layer} class Layer {
  34. // owned by PrintObject, no constructor/destructor
  35. Ref<Layer> as_layer()
  36. %code%{ RETVAL = THIS; %};
  37. int id();
  38. void set_id(int id);
  39. Ref<PrintObject> object();
  40. bool slicing_errors()
  41. %code%{ RETVAL = THIS->slicing_errors; %};
  42. coordf_t slice_z()
  43. %code%{ RETVAL = THIS->slice_z; %};
  44. coordf_t print_z()
  45. %code%{ RETVAL = THIS->print_z; %};
  46. coordf_t height()
  47. %code%{ RETVAL = THIS->height; %};
  48. size_t region_count();
  49. Ref<LayerRegion> get_region(int idx);
  50. Ref<LayerRegion> add_region(PrintRegion* print_region);
  51. ExPolygonCollection* slices()
  52. %code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
  53. int ptr()
  54. %code%{ RETVAL = (int)(intptr_t)THIS; %};
  55. Ref<SupportLayer> as_support_layer()
  56. %code%{ RETVAL = dynamic_cast<SupportLayer*>(THIS); %};
  57. void make_slices();
  58. void backup_untyped_slices();
  59. void restore_untyped_slices();
  60. void make_perimeters();
  61. void make_fills();
  62. void export_region_slices_to_svg(const char *path);
  63. void export_region_fill_surfaces_to_svg(const char *path);
  64. void export_region_slices_to_svg_debug(const char *name);
  65. void export_region_fill_surfaces_to_svg_debug(const char *name);
  66. };
  67. %name{Slic3r::Layer::Support} class SupportLayer {
  68. // owned by PrintObject, no constructor/destructor
  69. Ref<Layer> as_layer()
  70. %code%{ RETVAL = THIS; %};
  71. Ref<ExPolygonCollection> support_islands()
  72. %code%{ RETVAL = &THIS->support_islands; %};
  73. Ref<ExtrusionEntityCollection> support_fills()
  74. %code%{ RETVAL = &THIS->support_fills; %};
  75. // copies of some Layer methods, because the parameter wrapper code
  76. // gets confused about getting a Layer::Support instead of a Layer
  77. int id();
  78. void set_id(int id);
  79. Ref<PrintObject> object();
  80. bool slicing_errors()
  81. %code%{ RETVAL = THIS->slicing_errors; %};
  82. coordf_t slice_z()
  83. %code%{ RETVAL = THIS->slice_z; %};
  84. coordf_t print_z()
  85. %code%{ RETVAL = THIS->print_z; %};
  86. coordf_t height()
  87. %code%{ RETVAL = THIS->height; %};
  88. size_t region_count();
  89. Ref<LayerRegion> get_region(int idx);
  90. Ref<LayerRegion> add_region(PrintRegion* print_region);
  91. ExPolygonCollection* slices()
  92. %code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
  93. void export_region_slices_to_svg(const char *path);
  94. void export_region_fill_surfaces_to_svg(const char *path);
  95. void export_region_slices_to_svg_debug(const char *name);
  96. void export_region_fill_surfaces_to_svg_debug(const char *name);
  97. };