Flow.xsp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. %module{Slic3r::XS};
  2. %{
  3. #include <xsinit.h>
  4. #include "libslic3r/Flow.hpp"
  5. %}
  6. %name{Slic3r::Flow} class Flow {
  7. ~Flow();
  8. %name{_new} Flow(float width, float height, float nozzle_diameter);
  9. void set_height(float height)
  10. %code{% THIS->height = height; %};
  11. void set_bridge(bool bridge)
  12. %code{% THIS->bridge = bridge; %};
  13. Clone<Flow> clone()
  14. %code{% RETVAL = THIS; %};
  15. float width()
  16. %code{% RETVAL = THIS->width; %};
  17. float height()
  18. %code{% RETVAL = THIS->height; %};
  19. float nozzle_diameter()
  20. %code{% RETVAL = THIS->nozzle_diameter; %};
  21. bool bridge()
  22. %code{% RETVAL = THIS->bridge; %};
  23. float spacing();
  24. float spacing_to(Flow* other)
  25. %code{% RETVAL = THIS->spacing(*other); %};
  26. long scaled_width();
  27. long scaled_spacing();
  28. double mm3_per_mm();
  29. %{
  30. Flow*
  31. _new_from_width(CLASS, role, width, nozzle_diameter, height, bridge_flow_ratio)
  32. char* CLASS;
  33. FlowRole role;
  34. std::string width;
  35. float nozzle_diameter;
  36. float height;
  37. float bridge_flow_ratio;
  38. CODE:
  39. ConfigOptionFloatOrPercent optwidth;
  40. optwidth.deserialize(width);
  41. RETVAL = new Flow(Flow::new_from_config_width(role, optwidth, nozzle_diameter, height, bridge_flow_ratio));
  42. OUTPUT:
  43. RETVAL
  44. %}
  45. };
  46. %package{Slic3r::Flow};
  47. %{
  48. IV
  49. _constant()
  50. ALIAS:
  51. FLOW_ROLE_EXTERNAL_PERIMETER = frExternalPerimeter
  52. FLOW_ROLE_PERIMETER = frPerimeter
  53. FLOW_ROLE_INFILL = frInfill
  54. FLOW_ROLE_SOLID_INFILL = frSolidInfill
  55. FLOW_ROLE_TOP_SOLID_INFILL = frTopSolidInfill
  56. FLOW_ROLE_SUPPORT_MATERIAL = frSupportMaterial
  57. FLOW_ROLE_SUPPORT_MATERIAL_INTERFACE = frSupportMaterialInterface
  58. PROTOTYPE:
  59. CODE:
  60. RETVAL = ix;
  61. OUTPUT: RETVAL
  62. %}