Skip to content

Commit

Permalink
Further slimming of Perl bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
bubnikv committed May 4, 2022
1 parent 576c167 commit aa3231e
Show file tree
Hide file tree
Showing 24 changed files with 3 additions and 380 deletions.
1 change: 0 additions & 1 deletion lib/Slic3r.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use Slic3r::Config;
use Slic3r::ExPolygon;
use Slic3r::ExtrusionLoop;
use Slic3r::ExtrusionPath;
use Slic3r::Flow;
use Slic3r::GCode::Reader;
use Slic3r::Layer;
use Slic3r::Line;
Expand Down
3 changes: 0 additions & 3 deletions lib/Slic3r/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ use parent 'Slic3r::Config';

sub Slic3r::Config::GCode::new { Slic3r::Config::Static::new_GCodeConfig }
sub Slic3r::Config::Print::new { Slic3r::Config::Static::new_PrintConfig }
sub Slic3r::Config::PrintObject::new { Slic3r::Config::Static::new_PrintObjectConfig }
sub Slic3r::Config::PrintRegion::new { Slic3r::Config::Static::new_PrintRegionConfig }
sub Slic3r::Config::Full::new { Slic3r::Config::Static::new_FullPrintConfig }

1;
13 changes: 0 additions & 13 deletions lib/Slic3r/Flow.pm

This file was deleted.

10 changes: 0 additions & 10 deletions lib/Slic3r/Geometry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ our @EXPORT_OK = qw(
scale
unscale
scaled_epsilon
size_2D
X Y Z
convex_hull
Expand Down Expand Up @@ -52,13 +51,4 @@ sub bounding_box {
return @bb[X1,Y1,X2,Y2];
}

# used by ExPolygon::size
sub size_2D {
my @bounding_box = bounding_box(@_);
return (
($bounding_box[X2] - $bounding_box[X1]),
($bounding_box[Y2] - $bounding_box[Y1]),
);
}

1;
1 change: 0 additions & 1 deletion lib/Slic3r/Print/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use strict;
use warnings;

use List::Util qw(min max sum first);
use Slic3r::Flow ':roles';
use Slic3r::Surface ':types';

sub layers {
Expand Down
6 changes: 0 additions & 6 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ double min_object_distance(const ConfigBase &cfg);
// The dynamic configuration is also used to store user modifications of the print global parameters,
// so the modified configuration values may be diffed against the active configuration
// to invalidate the proper slicing resp. g-code generation processing steps.
// This object is mapped to Perl as Slic3r::Config.
class DynamicPrintConfig : public DynamicConfig
{
public:
Expand Down Expand Up @@ -464,7 +463,6 @@ protected: \
BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_HASH, _, PARAMETER_DEFINITION_SEQ), \
BOOST_PP_SEQ_FOR_EACH(PRINT_CONFIG_CLASS_ELEMENT_EQUAL, _, PARAMETER_DEFINITION_SEQ))

// This object is mapped to Perl as Slic3r::Config::PrintObject.
PRINT_CONFIG_CLASS_DEFINE(
PrintObjectConfig,

Expand Down Expand Up @@ -528,7 +526,6 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, wipe_into_objects))
)

// This object is mapped to Perl as Slic3r::Config::PrintRegion.
PRINT_CONFIG_CLASS_DEFINE(
PrintRegionConfig,

Expand Down Expand Up @@ -619,7 +616,6 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloats, machine_min_extruding_rate))
)

// This object is mapped to Perl as Slic3r::Config::GCode.
PRINT_CONFIG_CLASS_DEFINE(
GCodeConfig,

Expand Down Expand Up @@ -705,7 +701,6 @@ static inline std::string get_extrusion_axis(const GCodeConfig &cfg)
(cfg.gcode_flavor.value == gcfNoExtrusion) ? "" : cfg.extrusion_axis.value;
}

// This object is mapped to Perl as Slic3r::Config::Print.
PRINT_CONFIG_CLASS_DERIVED_DEFINE(
PrintConfig,
(MachineEnvelopeConfig, GCodeConfig),
Expand Down Expand Up @@ -784,7 +779,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, z_offset))
)

// This object is mapped to Perl as Slic3r::Config::Full.
PRINT_CONFIG_CLASS_DERIVED_DEFINE0(
FullPrintConfig,
(PrintObjectConfig, PrintRegionConfig, PrintConfig)
Expand Down
1 change: 0 additions & 1 deletion t/gaps.t
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ BEGIN {

use List::Util qw(first);
use Slic3r;
use Slic3r::Flow ':roles';
use Slic3r::Geometry qw(PI scale unscale convex_hull);
use Slic3r::Surface ':types';
use Slic3r::Test;
Expand Down
2 changes: 0 additions & 2 deletions xs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ set(XS_XSP_FILES
${XSP_DIR}/ExPolygon.xsp
${XSP_DIR}/ExtrusionEntityCollection.xsp
${XSP_DIR}/ExtrusionLoop.xsp
${XSP_DIR}/ExtrusionMultiPath.xsp
${XSP_DIR}/ExtrusionPath.xsp
${XSP_DIR}/Flow.xsp
${XSP_DIR}/GCode.xsp
${XSP_DIR}/Geometry.xsp
${XSP_DIR}/Layer.xsp
Expand Down
32 changes: 0 additions & 32 deletions xs/lib/Slic3r/XS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ sub new_from_paths {
return $loop;
}

package Slic3r::ExtrusionMultiPath;
use overload
'@{}' => sub { $_[0]->arrayref },
'fallback' => 1;

package Slic3r::ExtrusionPath;
use overload
'@{}' => sub { $_[0]->arrayref },
Expand Down Expand Up @@ -108,25 +103,6 @@ sub clone {
);
}

package Slic3r::Flow;

sub new {
my ($class, %args) = @_;

my $self = $class->_new(
@args{qw(width height nozzle_diameter)},
);
return $self;
}

sub new_from_width {
my ($class, %args) = @_;

return $class->_new_from_width(
@args{qw(role width nozzle_diameter layer_height)},
);
}

package Slic3r::Surface;

sub new {
Expand Down Expand Up @@ -175,26 +151,18 @@ sub new {
package main;
for my $class (qw(
Slic3r::Config
Slic3r::Config::Full
Slic3r::Config::GCode
Slic3r::Config::Print
Slic3r::Config::PrintObject
Slic3r::Config::PrintRegion
Slic3r::Config::Static
Slic3r::ExPolygon
Slic3r::ExtrusionLoop
Slic3r::ExtrusionMultiPath
Slic3r::ExtrusionPath
Slic3r::ExtrusionPath::Collection
Slic3r::Flow
Slic3r::GCode
Slic3r::Geometry::BoundingBox
Slic3r::Geometry::BoundingBoxf
Slic3r::Geometry::BoundingBoxf3
Slic3r::Layer
Slic3r::Layer::Region
Slic3r::Line
Slic3r::Linef3
Slic3r::Model
Slic3r::Model::Instance
Slic3r::Model::Material
Expand Down
9 changes: 1 addition & 8 deletions xs/src/perlglue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
namespace Slic3r {

REGISTER_CLASS(ExPolygon, "ExPolygon");
REGISTER_CLASS(ExtrusionMultiPath, "ExtrusionMultiPath");
REGISTER_CLASS(ExtrusionPath, "ExtrusionPath");
REGISTER_CLASS(ExtrusionLoop, "ExtrusionLoop");
REGISTER_CLASS(ExtrusionEntityCollection, "ExtrusionPath::Collection");
REGISTER_CLASS(Flow, "Flow");
REGISTER_CLASS(CoolingBuffer, "GCode::CoolingBuffer");
REGISTER_CLASS(GCode, "GCode");
REGISTER_CLASS(Layer, "Layer");
REGISTER_CLASS(LayerRegion, "Layer::Region");
REGISTER_CLASS(Line, "Line");
REGISTER_CLASS(Linef3, "Linef3");
REGISTER_CLASS(Polygon, "Polygon");
REGISTER_CLASS(Polyline, "Polyline");
REGISTER_CLASS(Print, "Print");
Expand All @@ -26,20 +23,16 @@ REGISTER_CLASS(ModelObject, "Model::Object");
REGISTER_CLASS(ModelVolume, "Model::Volume");
REGISTER_CLASS(ModelInstance, "Model::Instance");
REGISTER_CLASS(BoundingBox, "Geometry::BoundingBox");
REGISTER_CLASS(BoundingBoxf, "Geometry::BoundingBoxf");
REGISTER_CLASS(BoundingBoxf3, "Geometry::BoundingBoxf3");
REGISTER_CLASS(Point, "Point");
__REGISTER_CLASS(Vec2d, "Pointf");
__REGISTER_CLASS(Vec3d, "Pointf3");
REGISTER_CLASS(DynamicPrintConfig, "Config");
REGISTER_CLASS(StaticPrintConfig, "Config::Static");
REGISTER_CLASS(PrintObjectConfig, "Config::PrintObject");
REGISTER_CLASS(PrintRegionConfig, "Config::PrintRegion");
REGISTER_CLASS(GCodeConfig, "Config::GCode");
REGISTER_CLASS(PrintConfig, "Config::Print");
REGISTER_CLASS(FullPrintConfig, "Config::Full");
REGISTER_CLASS(Surface, "Surface");
REGISTER_CLASS(SurfaceCollection, "Surface::Collection");
REGISTER_CLASS(FullPrintConfig, "Config::Full");
REGISTER_CLASS(TriangleMesh, "TriangleMesh");

SV* ConfigBase__as_hash(ConfigBase* THIS)
Expand Down
66 changes: 0 additions & 66 deletions xs/xsp/BoundingBox.xsp
Original file line number Diff line number Diff line change
Expand Up @@ -50,69 +50,3 @@ new_from_points(CLASS, points)
%}
};

%name{Slic3r::Geometry::BoundingBoxf} class BoundingBoxf {
BoundingBoxf();
~BoundingBoxf();
Clone<BoundingBoxf> clone()
%code{% RETVAL = THIS; %};
void merge(BoundingBoxf* bb) %code{% THIS->merge(*bb); %};
void merge_point(Vec2d* point) %code{% THIS->merge(*point); %};
void scale(double factor);
void translate(double x, double y);
Clone<Vec2d> size();
Clone<Vec2d> center();
double radius();
bool empty() %code{% RETVAL = empty(*THIS); %};
Clone<Vec2d> min_point() %code{% RETVAL = THIS->min; %};
Clone<Vec2d> max_point() %code{% RETVAL = THIS->max; %};
double x_min() %code{% RETVAL = THIS->min(0); %};
double x_max() %code{% RETVAL = THIS->max(0); %};
double y_min() %code{% RETVAL = THIS->min(1); %};
double y_max() %code{% RETVAL = THIS->max(1); %};
void set_x_min(double val) %code{% THIS->min(0) = val; %};
void set_x_max(double val) %code{% THIS->max(0) = val; %};
void set_y_min(double val) %code{% THIS->min(1) = val; %};
void set_y_max(double val) %code{% THIS->max(1) = val; %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf;%lf,%lf", THIS->min(0), THIS->min(1), THIS->max(0), THIS->max(1)); RETVAL = buf; %};
bool defined() %code{% RETVAL = THIS->defined; %};

%{

BoundingBoxf*
new_from_points(CLASS, points)
char* CLASS
Pointfs points
CODE:
RETVAL = new BoundingBoxf(points);
OUTPUT:
RETVAL

%}
};

%name{Slic3r::Geometry::BoundingBoxf3} class BoundingBoxf3 {
BoundingBoxf3();
~BoundingBoxf3();
Clone<BoundingBoxf3> clone()
%code{% RETVAL = THIS; %};
void merge(BoundingBoxf3* bb) %code{% THIS->merge(*bb); %};
void merge_point(Vec3d* point) %code{% THIS->merge(*point); %};
void scale(double factor);
void translate(double x, double y, double z);
void offset(double delta);
bool contains_point(Vec3d* point) %code{% RETVAL = THIS->contains(*point); %};
Clone<Vec3d> size();
Clone<Vec3d> center();
double radius();
bool empty() %code{% RETVAL = empty(*THIS); %};
Clone<Vec3d> min_point() %code{% RETVAL = THIS->min; %};
Clone<Vec3d> max_point() %code{% RETVAL = THIS->max; %};
double x_min() %code{% RETVAL = THIS->min(0); %};
double x_max() %code{% RETVAL = THIS->max(0); %};
double y_min() %code{% RETVAL = THIS->min(1); %};
double y_max() %code{% RETVAL = THIS->max(1); %};
double z_min() %code{% RETVAL = THIS->min(2); %};
double z_max() %code{% RETVAL = THIS->max(2); %};
std::string serialize() %code{% char buf[2048]; sprintf(buf, "%lf,%lf,%lf;%lf,%lf,%lf", THIS->min(0), THIS->min(1), THIS->min(2), THIS->max(0), THIS->max(1), THIS->max(2)); RETVAL = buf; %};
bool defined() %code{% RETVAL = THIS->defined; %};
};
4 changes: 0 additions & 4 deletions xs/xsp/Config.xsp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@
%code{% RETVAL = new GCodeConfig(); %};
static StaticPrintConfig* new_PrintConfig()
%code{% RETVAL = static_cast<GCodeConfig*>(new PrintConfig()); %};
static StaticPrintConfig* new_PrintObjectConfig()
%code{% RETVAL = new PrintObjectConfig(); %};
static StaticPrintConfig* new_PrintRegionConfig()
%code{% RETVAL = new PrintRegionConfig(); %};
static StaticPrintConfig* new_FullPrintConfig()
%code{% RETVAL = static_cast<GCodeConfig*>(new FullPrintConfig()); %};
~StaticPrintConfig();
Expand Down
4 changes: 0 additions & 4 deletions xs/xsp/ExtrusionEntityCollection.xsp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ ExtrusionEntityCollection::arrayref()
// return our item by reference
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(*it)) {
sv_setref_pv( sv, perl_class_name_ref(path), path );
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(*it)) {
sv_setref_pv( sv, perl_class_name_ref(multipath), multipath );
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(*it)) {
sv_setref_pv( sv, perl_class_name_ref(loop), loop );
} else if (ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(*it)) {
Expand All @@ -81,8 +79,6 @@ ExtrusionEntityCollection::append(...)
// append COPIES
if (ExtrusionPath* path = dynamic_cast<ExtrusionPath*>(entity)) {
THIS->entities.push_back( new ExtrusionPath(*path) );
} else if (ExtrusionMultiPath* multipath = dynamic_cast<ExtrusionMultiPath*>(entity)) {
THIS->entities.push_back( new ExtrusionMultiPath(*multipath) );
} else if (ExtrusionLoop* loop = dynamic_cast<ExtrusionLoop*>(entity)) {
THIS->entities.push_back( new ExtrusionLoop(*loop) );
} else if(ExtrusionEntityCollection* collection = dynamic_cast<ExtrusionEntityCollection*>(entity)) {
Expand Down
38 changes: 0 additions & 38 deletions xs/xsp/ExtrusionMultiPath.xsp

This file was deleted.

Loading

0 comments on commit aa3231e

Please sign in to comment.