2013-06-22 17:16:45 +02:00
package Slic3r::XS ;
use warnings ;
use strict ;
our $VERSION = '0.01' ;
2016-09-12 16:25:15 +02:00
# We have to load these modules in order to have Wx.pm find the correct paths
# for wxWidgets dlls on MSW.
# We avoid loading these on OS X because Wx::Load() initializes a Wx App
# automatically and it steals focus even when we're not running Slic3r in GUI mode.
# TODO: only load these when compiling with GUI support
BEGIN {
if ( $^O eq 'MSWin32' ) {
eval "use Wx" ;
2018-05-09 10:47:04 +02:00
eval "use Wx::GLCanvas" ;
eval "use Wx::GLContext" ;
2018-04-09 17:03:37 +02:00
eval "use Wx::Html" ;
2016-09-12 16:25:15 +02:00
eval "use Wx::Print" ; # because of some Wx bug, thread creation fails if we don't have this (looks like Wx::Printout is hard-coded in some thread cleanup code)
}
}
2013-09-09 23:09:56 +02:00
use Carp qw() ;
2013-06-22 17:16:45 +02:00
use XSLoader ;
XSLoader:: load ( __PACKAGE__ , $VERSION );
2013-07-16 17:13:01 +02:00
package Slic3r::Line ;
2013-07-15 12:14:22 +02:00
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-16 17:13:01 +02:00
package Slic3r::Point ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2014-05-06 11:07:18 +03:00
package Slic3r::Point3 ;
use overload
'@{}' => sub { [ $_ [ 0 ] -> x , $_ [ 0 ] -> y , $_ [ 0 ] -> z ] }, #,
'fallback' => 1 ;
2015-01-15 18:49:07 +01:00
sub pp {
my ( $self ) = @_ ;
return [ @$self ];
}
2014-04-28 01:13:50 +03:00
package Slic3r::Pointf ;
use overload
2014-08-03 00:20:55 +02:00
'@{}' => sub { $_ [ 0 ] -> arrayref },
2014-04-28 01:13:50 +03:00
'fallback' => 1 ;
2014-01-07 19:08:37 +01:00
package Slic3r::Pointf3 ;
use overload
'@{}' => sub { [ $_ [ 0 ] -> x , $_ [ 0 ] -> y , $_ [ 0 ] -> z ] }, #,
'fallback' => 1 ;
2015-01-15 18:49:07 +01:00
sub pp {
my ( $self ) = @_ ;
return [ @$self ];
}
2013-07-16 17:13:01 +02:00
package Slic3r::ExPolygon ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
package Slic3r::Polyline ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-08-30 00:06:10 +02:00
package Slic3r::Polyline::Collection ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-15 22:57:22 +02:00
package Slic3r::Polygon ;
2013-07-15 12:14:22 +02:00
use overload
2013-07-16 17:13:01 +02:00
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-15 12:14:22 +02:00
2013-07-14 00:38:01 +02:00
package Slic3r::ExPolygon::Collection ;
use overload
2013-07-16 17:13:01 +02:00
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-14 00:38:01 +02:00
2013-07-18 19:09:07 +02:00
package Slic3r::ExtrusionPath::Collection ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-18 22:29:12 +02:00
sub new {
2014-12-17 00:52:01 +01:00
my ( $class , @paths ) = @_ ;
2013-07-18 22:29:12 +02:00
2014-12-17 00:52:01 +01:00
my $self = $class -> _new ;
2013-07-18 22:29:12 +02:00
$self -> append ( @paths );
return $self ;
}
2013-07-15 12:14:22 +02:00
package Slic3r::ExtrusionLoop ;
2013-07-15 16:21:09 +02:00
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-15 12:14:22 +02:00
2014-05-08 11:07:37 +02:00
sub new_from_paths {
my ( $class , @paths ) = @_ ;
2013-07-15 12:14:22 +02:00
2014-05-08 11:07:37 +02:00
my $loop = $class -> new ;
$loop -> append ( $_ ) for @paths ;
return $loop ;
2013-07-15 12:14:22 +02:00
}
2017-01-19 13:35:55 +01:00
package Slic3r::ExtrusionMultiPath ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-15 12:14:22 +02:00
package Slic3r::ExtrusionPath ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
sub new {
my ( $class , %args ) = @_ ;
return $class -> _new (
2013-07-15 16:21:09 +02:00
$args { polyline }, # required
2013-07-15 12:14:22 +02:00
$args { role }, # required
2014-04-29 23:15:36 +02:00
$args { mm3_per_mm } // die ( "Missing required mm3_per_mm in ExtrusionPath constructor" ),
$args { width } // - 1 ,
$args { height } // - 1 ,
2013-07-15 12:14:22 +02:00
);
}
sub clone {
my ( $self , %args ) = @_ ;
2014-03-09 20:19:30 +01:00
return __PACKAGE__ -> _new (
2013-07-16 09:49:34 +02:00
$args { polyline } // $self -> polyline ,
2013-07-15 12:14:22 +02:00
$args { role } // $self -> role ,
2014-01-03 18:27:46 +01:00
$args { mm3_per_mm } // $self -> mm3_per_mm ,
2014-04-29 23:15:36 +02:00
$args { width } // $self -> width ,
$args { height } // $self -> height ,
2013-07-15 12:14:22 +02:00
);
}
2016-04-11 17:05:58 +02:00
package Slic3r::ExtrusionSimulator ;
sub new {
my ( $class , %args ) = @_ ;
return $class -> _new ();
}
package Slic3r::Filler ;
sub fill_surface {
my ( $self , $surface , %args ) = @_ ;
$self -> set_density ( $args { density }) if defined ( $args { density });
$self -> set_dont_connect ( $args { dont_connect }) if defined ( $args { dont_connect });
$self -> set_dont_adjust ( $args { dont_adjust }) if defined ( $args { dont_adjust });
$self -> set_complete ( $args { complete }) if defined ( $args { complete });
return $self -> _fill_surface ( $surface );
}
2014-01-05 13:16:13 +01:00
package Slic3r::Flow ;
sub new {
my ( $class , %args ) = @_ ;
my $self = $class -> _new (
2014-08-08 02:56:25 +02:00
@args { qw(width height nozzle_diameter) },
2014-01-05 13:16:13 +01:00
);
$self -> set_bridge ( $args { bridge } // 0 );
return $self ;
}
sub new_from_width {
my ( $class , %args ) = @_ ;
return $class -> _new_from_width (
@args { qw(role width nozzle_diameter layer_height bridge_flow_ratio) },
);
}
2013-07-14 13:05:55 +02:00
package Slic3r::Surface ;
sub new {
my ( $class , %args ) = @_ ;
# defensive programming: make sure no negative bridge_angle is supplied
die "Error: invalid negative bridge_angle\n"
if defined $args { bridge_angle } && $args { bridge_angle } < 0 ;
return $class -> _new (
2013-07-15 12:14:22 +02:00
$args { expolygon } // ( die "Missing required expolygon\n" ),
$args { surface_type } // ( die "Missing required surface_type\n" ),
$args { thickness } // - 1 ,
$args { thickness_layers } // 1 ,
$args { bridge_angle } // - 1 ,
$args { extra_perimeters } // 0 ,
2013-07-14 13:05:55 +02:00
);
}
sub clone {
my ( $self , %args ) = @_ ;
return ( ref $self ) -> _new (
2013-08-08 02:10:34 +02:00
delete $args { expolygon } // $self -> expolygon ,
2013-07-14 13:05:55 +02:00
delete $args { surface_type } // $self -> surface_type ,
delete $args { thickness } // $self -> thickness ,
delete $args { thickness_layers } // $self -> thickness_layers ,
delete $args { bridge_angle } // $self -> bridge_angle ,
delete $args { extra_perimeters } // $self -> extra_perimeters ,
);
}
2013-07-14 14:56:43 +02:00
package Slic3r::Surface::Collection ;
use overload
2013-07-16 17:13:01 +02:00
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2013-07-14 14:56:43 +02:00
2014-11-09 16:23:50 +01:00
sub new {
my ( $class , @surfaces ) = @_ ;
my $self = $class -> _new ;
$self -> append ( $_ ) for @surfaces ;
return $self ;
}
2016-10-16 16:30:56 +02:00
package Slic3r::Print::SupportMaterial2 ;
sub new {
my ( $class , %args ) = @_ ;
return $class -> _new (
$args { print_config }, # required
$args { object_config }, # required
$args { first_layer_flow }, # required
$args { flow }, # required
$args { interface_flow }, # required
$args { soluble_interface } // 0
);
}
2017-03-20 12:05:20 +01:00
package Slic3r::GUI::_3DScene::GLShader ;
sub CLONE_SKIP { 1 }
2017-03-13 16:02:17 +01:00
package Slic3r::GUI::_3DScene::GLVolume::Collection ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
2015-01-24 23:35:29 +01:00
sub CLONE_SKIP { 1 }
2017-10-17 20:00:15 +02:00
package Slic3r::GUI::PresetCollection ;
use overload
'@{}' => sub { $_ [ 0 ] -> arrayref },
'fallback' => 1 ;
sub CLONE_SKIP { 1 }
2014-04-30 02:04:49 +03:00
package main ;
for my $class ( qw(
2014-11-15 22:41:22 +01:00
Slic3r::BridgeDetector
2014-04-30 02:04:49 +03:00
Slic3r::Config
2014-05-07 01:38:57 +03:00
Slic3r::Config::Full
2014-11-09 19:02:45 +01:00
Slic3r::Config::GCode
2014-04-30 02:04:49 +03:00
Slic3r::Config::Print
2014-05-07 01:38:57 +03:00
Slic3r::Config::PrintObject
2014-05-06 11:07:18 +03:00
Slic3r::Config::PrintRegion
2015-12-16 12:33:19 +01:00
Slic3r::Config::Static
2014-04-30 02:04:49 +03:00
Slic3r::ExPolygon
2014-05-07 01:38:57 +03:00
Slic3r::ExPolygon::Collection
2014-04-30 02:04:49 +03:00
Slic3r::ExtrusionLoop
2017-01-20 15:17:32 +01:00
Slic3r::ExtrusionMultiPath
2014-04-30 02:04:49 +03:00
Slic3r::ExtrusionPath
Slic3r::ExtrusionPath::Collection
2016-04-11 17:05:58 +02:00
Slic3r::ExtrusionSimulator
Slic3r::Filler
2014-05-07 01:38:57 +03:00
Slic3r::Flow
2015-07-01 21:47:17 +02:00
Slic3r::GCode
2014-05-06 11:07:18 +03:00
Slic3r::GCode::PlaceholderParser
2014-05-07 01:38:57 +03:00
Slic3r::Geometry::BoundingBox
Slic3r::Geometry::BoundingBoxf
Slic3r::Geometry::BoundingBoxf3
2018-05-25 14:05:08 +02:00
Slic3r::GUI::_3DScene::GLShader
2017-03-13 16:02:17 +01:00
Slic3r::GUI::_3DScene::GLVolume
2017-09-19 13:55:48 +02:00
Slic3r::GUI::Preset
Slic3r::GUI::PresetCollection
2018-02-15 18:16:19 +01:00
Slic3r::GUI::Tab
2014-05-06 11:07:18 +03:00
Slic3r::Layer
Slic3r::Layer::Region
Slic3r::Layer::Support
2014-04-30 02:04:49 +03:00
Slic3r::Line
2014-12-16 01:12:37 +01:00
Slic3r::Linef3
2014-04-30 02:04:49 +03:00
Slic3r::Model
Slic3r::Model::Instance
Slic3r::Model::Material
Slic3r::Model::Object
Slic3r::Model::Volume
Slic3r::Point
2014-05-06 11:07:18 +03:00
Slic3r::Point3
2014-04-30 02:04:49 +03:00
Slic3r::Pointf
Slic3r::Pointf3
Slic3r::Polygon
Slic3r::Polyline
2014-05-07 01:38:57 +03:00
Slic3r::Polyline::Collection
2014-05-06 11:07:18 +03:00
Slic3r::Print
Slic3r::Print::Object
Slic3r::Print::Region
2014-05-07 01:38:57 +03:00
Slic3r::Print::State
2014-04-30 02:04:49 +03:00
Slic3r::Surface
2014-05-07 01:38:57 +03:00
Slic3r::Surface::Collection
2016-10-16 16:30:56 +02:00
Slic3r::Print::SupportMaterial2
2014-04-30 02:04:49 +03:00
Slic3r::TriangleMesh
) )
{
no strict 'refs' ;
my $ref_class = $class . "::Ref" ;
eval "package $ref_class; our \@ISA = '$class'; sub DESTROY {};" ;
}
2013-06-22 17:16:45 +02:00
1 ;