SLAPrint.xsp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/SLAPrint.hpp"
  5. %}
  6. %name{Slic3r::SLAPrint} class SLAPrint {
  7. SLAPrint(Model* model);
  8. ~SLAPrint();
  9. void apply_config(DynamicPrintConfig* config)
  10. %code%{ THIS->config.apply(*config, true); %};
  11. void slice();
  12. size_t layer_count()
  13. %code{% RETVAL = THIS->layers.size(); %};
  14. DynamicPrintConfig* config()
  15. %code%{ RETVAL = new DynamicPrintConfig; RETVAL->apply(THIS->config); %};
  16. ExPolygons layer_slices(size_t i)
  17. %code%{ RETVAL = THIS->layers[i].slices; %};
  18. ExPolygons layer_solid_infill(size_t i)
  19. %code%{ RETVAL = THIS->layers[i].solid_infill; %};
  20. ExPolygons layer_perimeters(size_t i)
  21. %code%{ RETVAL = THIS->layers[i].perimeters; %};
  22. Ref<ExtrusionEntityCollection> layer_infill(size_t i)
  23. %code%{ RETVAL = &THIS->layers[i].infill; %};
  24. bool layer_solid(size_t i)
  25. %code%{ RETVAL = THIS->layers[i].solid; %};
  26. void write_svg(std::string file);
  27. %{
  28. std::vector<double>
  29. SLAPrint::heights()
  30. CODE:
  31. for (std::vector<SLAPrint::Layer>::const_iterator it = THIS->layers.begin();
  32. it != THIS->layers.end();
  33. ++it)
  34. RETVAL.push_back(it->print_z);
  35. OUTPUT:
  36. RETVAL
  37. SV*
  38. SLAPrint::sm_pillars()
  39. CODE:
  40. AV* av = newAV();
  41. for (std::vector<SLAPrint::SupportPillar>::const_iterator it = THIS->sm_pillars.begin();
  42. it != THIS->sm_pillars.end();
  43. ++it)
  44. {
  45. HV* hv = newHV();
  46. (void)hv_stores( hv, "top_layer", newSViv(it->top_layer) );
  47. (void)hv_stores( hv, "bottom_layer", newSViv(it->bottom_layer) );
  48. (void)hv_stores( hv, "point", perl_to_SV_clone_ref((Point)*it) );
  49. av_push(av, newRV_noinc((SV*)hv));
  50. }
  51. RETVAL = newRV_noinc((SV*)av);
  52. OUTPUT:
  53. RETVAL
  54. %}
  55. };