Flow.xsp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. Flow*
  45. _new_from_spacing(CLASS, spacing, nozzle_diameter, height, bridge)
  46. char* CLASS;
  47. float spacing;
  48. float nozzle_diameter;
  49. float height;
  50. bool bridge;
  51. CODE:
  52. RETVAL = new Flow(Flow::new_from_spacing(spacing, nozzle_diameter, height, bridge));
  53. OUTPUT:
  54. RETVAL
  55. %}
  56. };
  57. %package{Slic3r::Flow};
  58. %{
  59. IV
  60. _constant()
  61. ALIAS:
  62. FLOW_ROLE_EXTERNAL_PERIMETER = frExternalPerimeter
  63. FLOW_ROLE_PERIMETER = frPerimeter
  64. FLOW_ROLE_INFILL = frInfill
  65. FLOW_ROLE_SOLID_INFILL = frSolidInfill
  66. FLOW_ROLE_TOP_SOLID_INFILL = frTopSolidInfill
  67. FLOW_ROLE_SUPPORT_MATERIAL = frSupportMaterial
  68. FLOW_ROLE_SUPPORT_MATERIAL_INTERFACE = frSupportMaterialInterface
  69. PROTOTYPE:
  70. CODE:
  71. RETVAL = ix;
  72. OUTPUT: RETVAL
  73. %}
  74. coord_t solid_spacing(coord_t width, coord_t distance)
  75. %code{% RETVAL = Flow::solid_spacing(width, distance); %};