GCodeWriter.xsp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/GCodeWriter.hpp"
  5. %}
  6. %name{Slic3r::GCode::Writer} class GCodeWriter {
  7. GCodeWriter();
  8. ~GCodeWriter();
  9. Ref<StaticPrintConfig> config()
  10. %code%{ RETVAL = &THIS->config; %};
  11. bool multiple_extruders()
  12. %code{% RETVAL = THIS->multiple_extruders; %};
  13. Ref<Extruder> extruder();
  14. std::string extrusion_axis();
  15. void apply_print_config(PrintConfig* print_config)
  16. %code{% THIS->apply_print_config(*print_config); %};
  17. void set_extruders(std::vector<unsigned int> extruder_ids);
  18. std::string notes();
  19. std::string preamble();
  20. std::string postamble();
  21. std::string set_temperature(unsigned int temperature, bool wait = false, int tool = -1);
  22. std::string set_bed_temperature(unsigned int temperature, bool wait = false);
  23. std::string set_fan(unsigned int speed, bool dont_save = false);
  24. std::string set_acceleration(unsigned int acceleration);
  25. std::string reset_e(bool force = false);
  26. std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false);
  27. bool need_toolchange(unsigned int extruder_id);
  28. std::string set_extruder(unsigned int extruder_id);
  29. std::string toolchange(unsigned int extruder_id);
  30. std::string set_speed(double F, std::string comment = std::string());
  31. std::string travel_to_xy(Pointf* point, std::string comment = std::string())
  32. %code{% RETVAL = THIS->travel_to_xy(*point, comment); %};
  33. std::string travel_to_xyz(Pointf3* point, std::string comment = std::string())
  34. %code{% RETVAL = THIS->travel_to_xyz(*point, comment); %};
  35. std::string travel_to_z(double z, std::string comment = std::string());
  36. bool will_move_z(double z);
  37. std::string extrude_to_xy(Pointf* point, double dE, std::string comment = std::string())
  38. %code{% RETVAL = THIS->extrude_to_xy(*point, dE, comment); %};
  39. std::string extrude_to_xyz(Pointf3* point, double dE, std::string comment = std::string())
  40. %code{% RETVAL = THIS->extrude_to_xyz(*point, dE, comment); %};
  41. std::string retract();
  42. std::string retract_for_toolchange();
  43. std::string unretract();
  44. std::string lift();
  45. std::string unlift();
  46. Clone<Pointf3> get_position() const;
  47. %{
  48. SV*
  49. GCodeWriter::extruders()
  50. CODE:
  51. AV* av = newAV();
  52. av_fill(av, THIS->extruders.size()-1);
  53. int i = 0;
  54. for (std::map<unsigned int,Extruder>::iterator it = THIS->extruders.begin(); it != THIS->extruders.end(); ++it) {
  55. av_store(av, i++, perl_to_SV_ref(it->second));
  56. }
  57. RETVAL = newRV_noinc((SV*)av);
  58. OUTPUT:
  59. RETVAL
  60. %}
  61. };