%module{Slic3r::XS}; %{ #include #include "Print.hpp" #include "PlaceholderParser.hpp" %} %package{Slic3r::Print::State}; %{ IV _constant() ALIAS: STEP_INIT_EXTRUDERS = psInitExtruders STEP_SLICE = posSlice STEP_PERIMETERS = posPerimeters STEP_PREPARE_INFILL = posPrepareInfill STEP_INFILL = posInfill STEP_SUPPORTMATERIAL = posSupportMaterial STEP_SKIRT = psSkirt STEP_BRIM = psBrim PROTOTYPE: CODE: RETVAL = ix; OUTPUT: RETVAL %} %name{Slic3r::Print::Region} class PrintRegion { // owned by Print, no constructor/destructor Ref config() %code%{ RETVAL = &THIS->config; %}; Ref print(); }; %name{Slic3r::Print::Object} class PrintObject { // owned by Print, no constructor/destructor void add_region_volume(int region_id, int volume_id); std::vector get_region_volumes(int region_id) %code%{ if (0 <= region_id && region_id < THIS->region_volumes.size()) RETVAL = THIS->region_volumes[region_id]; %}; int region_count() %code%{ RETVAL = THIS->print()->regions.size(); %}; Ref print(); Ref model_object(); Ref config() %code%{ RETVAL = &THIS->config; %}; Points copies() %code%{ RETVAL = THIS->copies; %}; t_layer_height_ranges layer_height_ranges() %code%{ RETVAL = THIS->layer_height_ranges; %}; Ref size() %code%{ RETVAL = &THIS->size; %}; Ref _copies_shift() %code%{ RETVAL = &THIS->_copies_shift; %}; bool typed_slices() %code%{ RETVAL = THIS->typed_slices; %}; void set_typed_slices(bool value) %code%{ THIS->typed_slices = value; %}; Points _shifted_copies() %code%{ RETVAL = THIS->_shifted_copies; %}; void set_shifted_copies(Points value) %code%{ THIS->_shifted_copies = value; %}; void set_copies(Points copies) %code%{ THIS->copies = copies; %}; void set_layer_height_ranges(t_layer_height_ranges layer_height_ranges) %code%{ THIS->layer_height_ranges = layer_height_ranges; %}; size_t layer_count(); void clear_layers(); Ref get_layer(int idx); Ref add_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z); void delete_layer(int idx); size_t support_layer_count(); void clear_support_layers(); Ref get_support_layer(int idx); Ref add_support_layer(int id, coordf_t height, coordf_t print_z, coordf_t slice_z); void delete_support_layer(int idx); bool invalidate_state_by_config_options(std::vector opt_keys); bool invalidate_step(PrintObjectStep step); bool invalidate_all_steps(); bool step_done(PrintObjectStep step) %code%{ RETVAL = THIS->state.is_done(step); %}; void set_step_done(PrintObjectStep step) %code%{ THIS->state.set_done(step); %}; void set_step_started(PrintObjectStep step) %code%{ THIS->state.set_started(step); %}; int ptr() %code%{ RETVAL = (int)(intptr_t)THIS; %}; }; %name{Slic3r::Print} class Print { %name{_new} Print(); ~Print(); Ref config() %code%{ RETVAL = &THIS->config; %}; Ref default_object_config() %code%{ RETVAL = &THIS->default_object_config; %}; Ref default_region_config() %code%{ RETVAL = &THIS->default_region_config; %}; Ref placeholder_parser() %code%{ RETVAL = &THIS->placeholder_parser; %}; // TODO: status_cb Ref skirt() %code%{ RETVAL = &THIS->skirt; %}; Ref brim() %code%{ RETVAL = &THIS->brim; %}; PrintObjectPtrs* objects() %code%{ RETVAL = &THIS->objects; %}; void clear_objects(); Ref get_object(int idx); Ref add_object(ModelObject* model_object, BoundingBoxf3 *modobj_bbox) %code%{ RETVAL = THIS->add_object(model_object, *modobj_bbox); %}; Ref set_new_object(size_t idx, ModelObject* model_object, BoundingBoxf3 *modobj_bbox) %code%{ RETVAL = THIS->set_new_object(idx, model_object, *modobj_bbox); %}; void delete_object(int idx); size_t object_count() %code%{ RETVAL = THIS->objects.size(); %}; PrintRegionPtrs* regions() %code%{ RETVAL = &THIS->regions; %}; Ref get_region(int idx); Ref add_region(); size_t region_count() %code%{ RETVAL = THIS->regions.size(); %}; bool invalidate_state_by_config_options(std::vector opt_keys); bool invalidate_step(PrintStep step); bool invalidate_all_steps(); bool step_done(PrintStep step) %code%{ RETVAL = THIS->state.is_done(step); %}; void set_step_done(PrintStep step) %code%{ THIS->state.set_done(step); %}; void set_step_started(PrintStep step) %code%{ THIS->state.set_started(step); %}; %{ double Print::total_used_filament(...) CODE: if (items > 1) { THIS->total_used_filament = (double)SvNV(ST(1)); } RETVAL = THIS->total_used_filament; OUTPUT: RETVAL double Print::total_extruded_volume(...) CODE: if (items > 1) { THIS->total_extruded_volume = (double)SvNV(ST(1)); } RETVAL = THIS->total_extruded_volume; OUTPUT: RETVAL %} };