Layer.xsp 4.1 KB

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