Layer.xsp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 merge_slices();
  27. void prepare_fill_surfaces();
  28. void make_perimeters(SurfaceCollection* slices, SurfaceCollection* fill_surfaces)
  29. %code%{ THIS->make_perimeters(*slices, fill_surfaces); %};
  30. double infill_area_threshold();
  31. };
  32. %name{Slic3r::Layer} class Layer {
  33. // owned by PrintObject, no constructor/destructor
  34. Ref<Layer> as_layer()
  35. %code%{ RETVAL = THIS; %};
  36. int id();
  37. void set_id(int id);
  38. Ref<PrintObject> object();
  39. Ref<Layer> upper_layer()
  40. %code%{ RETVAL = THIS->upper_layer; %};
  41. Ref<Layer> lower_layer()
  42. %code%{ RETVAL = THIS->lower_layer; %};
  43. bool slicing_errors()
  44. %code%{ RETVAL = THIS->slicing_errors; %};
  45. coordf_t slice_z()
  46. %code%{ RETVAL = THIS->slice_z; %};
  47. coordf_t print_z()
  48. %code%{ RETVAL = THIS->print_z; %};
  49. coordf_t height()
  50. %code%{ RETVAL = THIS->height; %};
  51. void set_print_z(coordf_t z)
  52. %code%{ THIS->print_z = z; %};
  53. void set_height(coordf_t h)
  54. %code%{ THIS->height = h; %};
  55. void set_upper_layer(Layer *layer)
  56. %code%{ THIS->upper_layer = layer; %};
  57. void set_lower_layer(Layer *layer)
  58. %code%{ THIS->lower_layer = layer; %};
  59. bool has_upper_layer()
  60. %code%{ RETVAL = (THIS->upper_layer != NULL); %};
  61. bool has_lower_layer()
  62. %code%{ RETVAL = (THIS->lower_layer != NULL); %};
  63. size_t region_count();
  64. Ref<LayerRegion> get_region(int idx);
  65. Ref<LayerRegion> add_region(PrintRegion* print_region);
  66. Ref<ExPolygonCollection> slices()
  67. %code%{ RETVAL = &THIS->slices; %};
  68. int ptr()
  69. %code%{ RETVAL = (int)(intptr_t)THIS; %};
  70. Ref<SupportLayer> as_support_layer()
  71. %code%{ RETVAL = dynamic_cast<SupportLayer*>(THIS); %};
  72. void make_slices();
  73. void merge_slices();
  74. bool any_internal_region_slice_contains_polyline(Polyline* polyline)
  75. %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %};
  76. bool any_bottom_region_slice_contains_polyline(Polyline* polyline)
  77. %code%{ RETVAL = THIS->any_bottom_region_slice_contains(*polyline); %};
  78. void make_perimeters();
  79. void make_fills();
  80. };
  81. %name{Slic3r::Layer::Support} class SupportLayer {
  82. // owned by PrintObject, no constructor/destructor
  83. Ref<Layer> as_layer()
  84. %code%{ RETVAL = THIS; %};
  85. Ref<ExPolygonCollection> support_islands()
  86. %code%{ RETVAL = &THIS->support_islands; %};
  87. Ref<ExtrusionEntityCollection> support_fills()
  88. %code%{ RETVAL = &THIS->support_fills; %};
  89. Ref<ExtrusionEntityCollection> support_interface_fills()
  90. %code%{ RETVAL = &THIS->support_interface_fills; %};
  91. // copies of some Layer methods, because the parameter wrapper code
  92. // gets confused about getting a Layer::Support instead of a Layer
  93. int id();
  94. void set_id(int id);
  95. Ref<PrintObject> object();
  96. Ref<SupportLayer> upper_layer()
  97. %code%{ RETVAL = (SupportLayer*)THIS->upper_layer; %};
  98. Ref<SupportLayer> lower_layer()
  99. %code%{ RETVAL = (SupportLayer*)THIS->lower_layer; %};
  100. bool slicing_errors()
  101. %code%{ RETVAL = THIS->slicing_errors; %};
  102. coordf_t slice_z()
  103. %code%{ RETVAL = THIS->slice_z; %};
  104. coordf_t print_z()
  105. %code%{ RETVAL = THIS->print_z; %};
  106. coordf_t height()
  107. %code%{ RETVAL = THIS->height; %};
  108. void set_upper_layer(SupportLayer *layer)
  109. %code%{ THIS->upper_layer = layer; %};
  110. void set_lower_layer(SupportLayer *layer)
  111. %code%{ THIS->lower_layer = layer; %};
  112. bool has_upper_layer()
  113. %code%{ RETVAL = (THIS->upper_layer != NULL); %};
  114. bool has_lower_layer()
  115. %code%{ RETVAL = (THIS->lower_layer != NULL); %};
  116. size_t region_count();
  117. Ref<LayerRegion> get_region(int idx);
  118. Ref<LayerRegion> add_region(PrintRegion* print_region);
  119. Ref<ExPolygonCollection> slices()
  120. %code%{ RETVAL = &THIS->slices; %};
  121. bool any_internal_region_slice_contains_polyline(Polyline* polyline)
  122. %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %};
  123. bool any_bottom_region_slice_contains_polyline(Polyline* polyline)
  124. %code%{ RETVAL = THIS->any_bottom_region_slice_contains(*polyline); %};
  125. };