GCode.xsp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. std::string do_export(Print *print, const char *path);
  18. Ref<Pointf> origin()
  19. %code{% RETVAL = &(THIS->origin()); %};
  20. void set_origin(Pointf* pointf)
  21. %code{% THIS->set_origin(*pointf); %};
  22. Ref<Point> last_pos()
  23. %code{% RETVAL = &(THIS->last_pos()); %};
  24. unsigned int layer_count() const;
  25. void set_layer_count(unsigned int value);
  26. void set_extruders(std::vector<unsigned int> extruders)
  27. %code{% THIS->writer().set_extruders(extruders); THIS->writer().set_extruder(0); %};
  28. void apply_print_config(StaticPrintConfig* print_config)
  29. %code{%
  30. if (const PrintConfig* config = dynamic_cast<PrintConfig*>(print_config)) {
  31. THIS->apply_print_config(*config);
  32. } else {
  33. CONFESS("A PrintConfig object was not supplied to apply_print_config()");
  34. }
  35. %};
  36. Ref<StaticPrintConfig> config()
  37. %code{% RETVAL = const_cast<StaticPrintConfig*>(dynamic_cast<const StaticPrintConfig*>(&THIS->config())); %};
  38. };