GCode.xsp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/GCode.hpp"
  5. #include "libslic3r/GCode/CoolingBuffer.hpp"
  6. %}
  7. %name{Slic3r::GCode::CoolingBuffer} class CoolingBuffer {
  8. CoolingBuffer(GCode* gcode)
  9. %code{% RETVAL = new CoolingBuffer(*gcode); %};
  10. ~CoolingBuffer();
  11. Ref<GCode> gcodegen();
  12. std::string process_layer(std::string gcode, size_t layer_id);
  13. };
  14. %name{Slic3r::GCode} class GCode {
  15. GCode();
  16. ~GCode();
  17. void do_export(Print *print, const char *path)
  18. %code%{
  19. try {
  20. THIS->do_export(print, path);
  21. } catch (std::exception& e) {
  22. croak("%s\n", e.what());
  23. }
  24. %};
  25. // void do_export_w_preview(Print *print, const char *path, GCodePreviewData *preview_data)
  26. // %code%{
  27. // try {
  28. // THIS->do_export(print, path, preview_data);
  29. // } catch (std::exception& e) {
  30. // croak("%s\n", e.what());
  31. // }
  32. // %};
  33. Ref<Vec2d> origin()
  34. %code{% RETVAL = &(THIS->origin()); %};
  35. void set_origin(Vec2d* pointf)
  36. %code{% THIS->set_origin(*pointf); %};
  37. Ref<Point> last_pos()
  38. %code{% RETVAL = &(THIS->last_pos()); %};
  39. unsigned int layer_count() const;
  40. void set_layer_count(unsigned int value);
  41. void set_extruders(std::vector<unsigned int> extruders)
  42. %code{% THIS->writer().set_extruders(extruders); THIS->writer().set_extruder(0); %};
  43. void apply_print_config(StaticPrintConfig* print_config)
  44. %code{%
  45. if (const PrintConfig* config = dynamic_cast<PrintConfig*>(print_config)) {
  46. THIS->apply_print_config(*config);
  47. } else {
  48. CONFESS("A PrintConfig object was not supplied to apply_print_config()");
  49. }
  50. %};
  51. Ref<StaticPrintConfig> config()
  52. %code{% RETVAL = const_cast<StaticPrintConfig*>(static_cast<const StaticPrintConfig*>(static_cast<const PrintObjectConfig*>(&THIS->config()))); %};
  53. };
  54. //%name{Slic3r::GCode::PreviewData} class GCodePreviewData {
  55. // GCodePreviewData();
  56. // ~GCodePreviewData();
  57. // void reset();
  58. // bool empty() const;
  59. // void set_type(int type)
  60. // %code%{
  61. // if ((0 <= type) && (type < GCodePreviewData::Extrusion::Num_View_Types))
  62. // THIS->extrusion.view_type = (GCodePreviewData::Extrusion::EViewType)type;
  63. // %};
  64. // int type() %code%{ RETVAL = (int)THIS->extrusion.view_type; %};
  65. // void set_extrusion_flags(int flags)
  66. // %code%{ THIS->extrusion.role_flags = (unsigned int)flags; %};
  67. // void set_travel_visible(bool visible)
  68. // %code%{ THIS->travel.is_visible = visible; %};
  69. // void set_retractions_visible(bool visible)
  70. // %code%{ THIS->retraction.is_visible = visible; %};
  71. // void set_unretractions_visible(bool visible)
  72. // %code%{ THIS->unretraction.is_visible = visible; %};
  73. // void set_shells_visible(bool visible)
  74. // %code%{ THIS->shell.is_visible = visible; %};
  75. // void set_extrusion_paths_colors(std::vector<std::string> colors);
  76. //};