Layer.xsp 4.0 KB

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