GCodeWriter.xsp 2.6 KB

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