├── .github
├── CONTRIBUTING.md
└── ISSUE_TEMPLATE.md
├── .gitignore
├── .travis.yml
├── Build.PL
├── LICENSE
├── README.md
├── appveyor.yml
├── doc
└── How_to_build_Slic3r.txt
├── lib
├── Slic3r.pm
└── Slic3r
│ ├── Config.pm
│ ├── ExPolygon.pm
│ ├── ExtrusionLoop.pm
│ ├── ExtrusionPath.pm
│ ├── Flow.pm
│ ├── GCode
│ ├── ArcFitting.pm
│ ├── MotionPlanner.pm
│ ├── PressureRegulator.pm
│ ├── Reader.pm
│ └── VibrationLimit.pm
│ ├── GUI.pm
│ ├── GUI
│ ├── 2DBed.pm
│ ├── 3DScene.pm
│ ├── AboutDialog.pm
│ ├── BedShapeDialog.pm
│ ├── BonjourBrowser.pm
│ ├── ColorScheme.pm
│ ├── ConfigWizard.pm
│ ├── Controller.pm
│ ├── Controller
│ │ ├── ManualControlDialog.pm
│ │ └── PrinterPanel.pm
│ ├── MainFrame.pm
│ ├── Notifier.pm
│ ├── OptionsGroup.pm
│ ├── OptionsGroup
│ │ └── Field.pm
│ ├── Plater.pm
│ ├── Plater
│ │ ├── 2D.pm
│ │ ├── 2DToolpaths.pm
│ │ ├── 3D.pm
│ │ ├── 3DPreview.pm
│ │ ├── LambdaObjectDialog.pm
│ │ ├── ObjectCutDialog.pm
│ │ ├── ObjectPartsPanel.pm
│ │ ├── ObjectSettingsDialog.pm
│ │ ├── OverrideSettingsPanel.pm
│ │ └── SplineControl.pm
│ ├── Preferences.pm
│ ├── Preset.pm
│ ├── PresetEditor.pm
│ ├── PresetEditorDialog.pm
│ ├── ProgressStatusBar.pm
│ ├── Projector.pm
│ └── SLAPrintOptions.pm
│ ├── Geometry.pm
│ ├── Geometry
│ └── Clipper.pm
│ ├── Layer.pm
│ ├── Line.pm
│ ├── Model.pm
│ ├── Point.pm
│ ├── Polygon.pm
│ ├── Polyline.pm
│ ├── Print.pm
│ ├── Print
│ ├── GCode.pm
│ ├── Object.pm
│ ├── Simple.pm
│ ├── State.pm
│ └── SupportMaterial.pm
│ ├── SVG.pm
│ ├── Surface.pm
│ ├── Test.pm
│ └── Test
│ └── SectionCut.pm
├── package
├── common
│ ├── coreperl
│ ├── shell.cpp
│ └── util.sh
├── deploy
│ ├── bintray.sh
│ ├── sftp-symlink.sh
│ ├── sftp.sh
│ ├── slic3r-upload.ppk.enc
│ ├── slic3r-upload.rsa.enc
│ └── winscp.ps1
├── linux
│ ├── appimage.sh
│ ├── build_shell.mk
│ ├── libpaths.appimage.txt
│ ├── libpaths.txt
│ ├── make_archive.sh
│ ├── slic3r.desktop.in
│ ├── startup_script.sh
│ ├── travis-decrypt-key
│ └── travis-setup.sh
├── osx
│ ├── make_dmg.sh
│ ├── plist.sh
│ └── startup_script.sh
└── win
│ ├── appveyor_buildscript.ps1
│ ├── appveyor_deploy.ps1
│ ├── appveyor_preinstall.ps1
│ ├── compile_wrapper.ps1
│ ├── package_win32.ps1
│ ├── slic3r.exe.manifest
│ └── slic3r.rc
├── share
└── locale
│ └── ja
│ └── slic3r.mo
├── slic3r.pl
├── src
├── CMakeLists.txt
├── slic3r.cpp
├── standalone
│ └── config.h
├── utils
│ └── extrude-tin.cpp
└── windows-build.txt
├── t
├── adaptive_slicing.t
├── adaptive_width.t
├── angles.t
├── arcs.t
├── avoid_crossing_perimeters.t
├── bridges.t
├── clean_polylines.t
├── clipper.t
├── collinear.t
├── combineinfill.t
├── config.t
├── cooling.t
├── custom_gcode.t
├── fill.t
├── flow.t
├── gaps.t
├── gcode.t
├── geometry.t
├── layers.t
├── loops.t
├── multi.t
├── perimeters.t
├── polyclip.t
├── pressure.t
├── print.t
├── retraction.t
├── shells.t
├── skirt_brim.t
├── slice.t
├── speed.t
├── support.t
├── svg.t
├── thin.t
├── threads.t
└── vibrationlimit.t
├── utils
├── amf-to-stl.pl
├── config-bundle-to-config.pl
├── dump-stl.pl
├── estimate-gcode-time.pl
├── gcode_sectioncut.pl
├── modifier_helpers
│ ├── layer_generator.jscad
│ └── solid_layers.scad
├── pdf-slices.pl
├── post-processing
│ ├── decimate.pl
│ ├── fan_kickstart.py
│ ├── filament-weight.pl
│ ├── flowrate.pl
│ ├── prowl-notification.pl
│ ├── strip-toolchange.pl
│ └── z-every-line.pl
├── send-gcode.pl
├── split_stl.pl
├── stl-to-amf.pl
├── view-mesh.pl
├── view-toolpaths.pl
├── wireframe.pl
└── zsh
│ ├── README.markdown
│ └── functions
│ └── _slic3r
├── var
├── Slic3r.icns
├── Slic3r.ico
├── Slic3r.png
├── Slic3r_128px.png
├── Slic3r_192px.png
├── Slic3r_192px_transparent.png
├── add.png
├── application_view_tile.png
├── arrow_down.png
├── arrow_in.png
├── arrow_left.png
├── arrow_out.png
├── arrow_redo.png
├── arrow_refresh.png
├── arrow_right.png
├── arrow_rotate_anticlockwise.png
├── arrow_rotate_clockwise.png
├── arrow_undo.png
├── arrow_up.png
├── box.png
├── brick.png
├── brick_add.png
├── brick_delete.png
├── brick_go.png
├── bricks.png
├── building.png
├── bullet_black.png
├── bullet_blue.png
├── bullet_green.png
├── bullet_red.png
├── bullet_white.png
├── cog.png
├── cog_go.png
├── control_pause.png
├── control_pause_blue.png
├── control_play.png
├── control_play_blue.png
├── control_stop.png
├── control_stop_blue.png
├── cross.png
├── delete.png
├── disk.png
├── error.png
├── film.png
├── funnel.png
├── hourglass.png
├── house.png
├── infill.png
├── joystick.png
├── layers.png
├── lorry_add.png
├── lorry_go.png
├── lorry_import.png
├── map_add.png
├── note.png
├── package.png
├── package_green.png
├── page_white_go.png
├── plugin.png
├── plugin_add.png
├── plugin_go.png
├── printer_empty.png
├── script.png
├── shape_flip_horizontal.png
├── shape_handles.png
├── shape_ungroup.png
├── spool.png
├── tag_blue.png
├── textfield.png
├── tick.png
├── time.png
├── variable_layer_height.png
├── wand.png
├── wrench.png
├── zoom.png
├── zoom_in.png
└── zoom_out.png
└── xs
├── Build.PL
├── MANIFEST
├── MANIFEST.SKIP
├── lib
└── Slic3r
│ └── XS.pm
├── libslic3r.doxygen
├── src
├── BSpline
│ ├── BSpline.cpp
│ ├── BSpline.h
│ ├── BandedMatrix.h
│ └── COPYRIGHT
├── Zip
│ ├── ZipArchive.cpp
│ └── ZipArchive.hpp
├── admesh
│ ├── connect.c
│ ├── normals.c
│ ├── portable_endian.h
│ ├── shared.c
│ ├── stl.h
│ ├── stl_io.c
│ ├── stlinit.c
│ └── util.c
├── boost
│ └── nowide
│ │ ├── args.hpp
│ │ ├── cenv.hpp
│ │ ├── config.hpp
│ │ ├── convert.hpp
│ │ ├── cstdio.hpp
│ │ ├── cstdlib.hpp
│ │ ├── filebuf.hpp
│ │ ├── fstream.hpp
│ │ ├── integration
│ │ └── filesystem.hpp
│ │ ├── iostream.cpp
│ │ ├── iostream.hpp
│ │ ├── stackstring.hpp
│ │ ├── system.hpp
│ │ ├── utf8_codecvt.hpp
│ │ └── windows.hpp
├── clipper.cpp
├── clipper.hpp
├── expat
│ ├── COPYING
│ ├── README
│ ├── ascii.h
│ ├── asciitab.h
│ ├── expat.h
│ ├── expat_config.h
│ ├── expat_external.h
│ ├── iasciitab.h
│ ├── internal.h
│ ├── latin1tab.h
│ ├── nametab.h
│ ├── utf8tab.h
│ ├── xmlparse.c
│ ├── xmlrole.c
│ ├── xmlrole.h
│ ├── xmltok.c
│ ├── xmltok.h
│ ├── xmltok_impl.h
│ ├── xmltok_impl.inc
│ └── xmltok_ns.inc
├── exprtk
│ └── exprtk.hpp
├── libslic3r
│ ├── BoundingBox.cpp
│ ├── BoundingBox.hpp
│ ├── BridgeDetector.cpp
│ ├── BridgeDetector.hpp
│ ├── ClipperUtils.cpp
│ ├── ClipperUtils.hpp
│ ├── ConditionalGCode.cpp
│ ├── ConditionalGCode.hpp
│ ├── Config.cpp
│ ├── Config.hpp
│ ├── ExPolygon.cpp
│ ├── ExPolygon.hpp
│ ├── ExPolygonCollection.cpp
│ ├── ExPolygonCollection.hpp
│ ├── Extruder.cpp
│ ├── Extruder.hpp
│ ├── ExtrusionEntity.cpp
│ ├── ExtrusionEntity.hpp
│ ├── ExtrusionEntityCollection.cpp
│ ├── ExtrusionEntityCollection.hpp
│ ├── Fill
│ │ ├── Fill.cpp
│ │ ├── Fill.hpp
│ │ ├── Fill3DHoneycomb.cpp
│ │ ├── Fill3DHoneycomb.hpp
│ │ ├── FillConcentric.cpp
│ │ ├── FillConcentric.hpp
│ │ ├── FillGyroid.cpp
│ │ ├── FillGyroid.hpp
│ │ ├── FillHoneycomb.cpp
│ │ ├── FillHoneycomb.hpp
│ │ ├── FillPlanePath.cpp
│ │ ├── FillPlanePath.hpp
│ │ ├── FillRectilinear.cpp
│ │ └── FillRectilinear.hpp
│ ├── Flow.cpp
│ ├── Flow.hpp
│ ├── GCode.cpp
│ ├── GCode.hpp
│ ├── GCode
│ │ ├── CoolingBuffer.cpp
│ │ ├── CoolingBuffer.hpp
│ │ ├── SpiralVase.cpp
│ │ └── SpiralVase.hpp
│ ├── GCodeReader.cpp
│ ├── GCodeReader.hpp
│ ├── GCodeSender.cpp
│ ├── GCodeSender.hpp
│ ├── GCodeTimeEstimator.cpp
│ ├── GCodeTimeEstimator.hpp
│ ├── GCodeWriter.cpp
│ ├── GCodeWriter.hpp
│ ├── Geometry.cpp
│ ├── Geometry.hpp
│ ├── IO.cpp
│ ├── IO.hpp
│ ├── IO
│ │ ├── AMF.cpp
│ │ ├── TMF.cpp
│ │ └── TMF.hpp
│ ├── Layer.cpp
│ ├── Layer.hpp
│ ├── LayerHeightSpline.cpp
│ ├── LayerHeightSpline.hpp
│ ├── LayerRegion.cpp
│ ├── LayerRegionFill.cpp
│ ├── Line.cpp
│ ├── Line.hpp
│ ├── Model.cpp
│ ├── Model.hpp
│ ├── MotionPlanner.cpp
│ ├── MotionPlanner.hpp
│ ├── MultiPoint.cpp
│ ├── MultiPoint.hpp
│ ├── NonplanarFacet.cpp
│ ├── NonplanarFacet.hpp
│ ├── NonplanarSurface.cpp
│ ├── NonplanarSurface.hpp
│ ├── PerimeterGenerator.cpp
│ ├── PerimeterGenerator.hpp
│ ├── PlaceholderParser.cpp
│ ├── PlaceholderParser.hpp
│ ├── Point.cpp
│ ├── Point.hpp
│ ├── Polygon.cpp
│ ├── Polygon.hpp
│ ├── Polyline.cpp
│ ├── Polyline.hpp
│ ├── PolylineCollection.cpp
│ ├── PolylineCollection.hpp
│ ├── Print.cpp
│ ├── Print.hpp
│ ├── PrintConfig.cpp
│ ├── PrintConfig.hpp
│ ├── PrintObject.cpp
│ ├── PrintRegion.cpp
│ ├── SLAPrint.cpp
│ ├── SLAPrint.hpp
│ ├── SVG.cpp
│ ├── SVG.hpp
│ ├── SlicingAdaptive.cpp
│ ├── SlicingAdaptive.hpp
│ ├── SupportMaterial.hpp
│ ├── Surface.cpp
│ ├── Surface.hpp
│ ├── SurfaceCollection.cpp
│ ├── SurfaceCollection.hpp
│ ├── TriangleMesh.cpp
│ ├── TriangleMesh.hpp
│ ├── libslic3r.h
│ ├── utils.cpp
│ └── utils.hpp
├── miniz
│ └── miniz.h
├── perlglue.cpp
├── poly2tri
│ ├── common
│ │ ├── shapes.cc
│ │ ├── shapes.h
│ │ └── utils.h
│ ├── poly2tri.h
│ └── sweep
│ │ ├── advancing_front.cc
│ │ ├── advancing_front.h
│ │ ├── cdt.cc
│ │ ├── cdt.h
│ │ ├── sweep.cc
│ │ ├── sweep.h
│ │ ├── sweep_context.cc
│ │ └── sweep_context.h
├── polypartition.cpp
├── polypartition.h
├── ppport.h
├── slic3r
│ └── GUI
│ │ ├── 3DScene.cpp
│ │ ├── 3DScene.hpp
│ │ ├── GUI.cpp
│ │ └── GUI.hpp
├── tiny_obj_loader.h
└── xsinit.h
├── t
├── 01_trianglemesh.t
├── 03_point.t
├── 04_expolygon.t
├── 05_surface.t
├── 06_polygon.t
├── 07_extrusionpath.t
├── 08_extrusionloop.t
├── 09_polyline.t
├── 10_line.t
├── 11_clipper.t
├── 12_extrusionpathcollection.t
├── 13_polylinecollection.t
├── 14_geometry.t
├── 15_config.t
├── 16_flow.t
├── 17_boundingbox.t
├── 18_motionplanner.t
├── 19_model.t
├── 20_print.t
├── 21_gcode.t
├── 22_exception.t
├── 23_3mf.t
├── 24_gcodemath.t
├── inc
│ └── 22_config_bad_config_options.ini
└── models
│ ├── 3mf
│ ├── box.3mf
│ ├── chess.3mf
│ └── gimblekeychain.3mf
│ ├── amf
│ └── FaceColors.amf.xml
│ └── stl
│ └── spikey_top.stl
└── xsp
├── BoundingBox.xsp
├── BridgeDetector.xsp
├── Clipper.xsp
├── ConditionalGCode.xsp
├── Config.xsp
├── ExPolygon.xsp
├── ExPolygonCollection.xsp
├── Extruder.xsp
├── ExtrusionEntityCollection.xsp
├── ExtrusionLoop.xsp
├── ExtrusionPath.xsp
├── Filler.xsp
├── Flow.xsp
├── GCode.xsp
├── GCodeSender.xsp
├── GCodeTimeEstimator.xsp
├── GCodeWriter.xsp
├── GUI.xsp
├── GUI_3DScene.xsp
├── Geometry.xsp
├── Layer.xsp
├── LayerHeightSpline.xsp
├── Line.xsp
├── Model.xsp
├── MotionPlanner.xsp
├── NonplanarFacet.xsp
├── NonplanarSurface.xsp
├── PerimeterGenerator.xsp
├── PlaceholderParser.xsp
├── Point.xsp
├── Polygon.xsp
├── Polyline.xsp
├── PolylineCollection.xsp
├── Print.xsp
├── SLAPrint.xsp
├── SlicingAdaptive.xsp
├── SupportMaterial.xsp
├── Surface.xsp
├── SurfaceCollection.xsp
├── TriangleMesh.xsp
├── XS.xsp
├── my.map
├── mytype.map
└── typemap.xspt
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ### Version
2 | _Version of Slic3r used goes here_
3 |
4 | _Use `About->About Slic3r` for release versions._
5 |
6 | _Do not report Prusa3D Slic3r bugs here without confirming it is a problem on a development release of Slic3r, or your issue will be closed. *Only* use normal Slic3r version IDs._
7 |
8 | _For -dev versions, use `git describe --tag` or get the hash value for the version you downloaded or `git rev-parse HEAD`_
9 |
10 | ### Operating system type + version
11 | _What OS are you using, and state any version #s_
12 |
13 | ### Behavior
14 | * _Describe the problem_
15 | * _Steps needed to reproduce the problem_
16 | * _If this is a command-line slicing issue, include the options used_
17 | * _Expected Results_
18 | * _Actual Results_
19 | * _Screenshots from __*Slic3r*__ preview are preferred_
20 |
21 | _Is this a new feature request?_
22 | Related guides for writing feature requests: http://meta.stackexchange.com/a/259196 http://nickohrn.com/2013/09/write-great-feature-request-bug-report/
23 |
24 |
25 | #### STL/Config (.ZIP) where problem occurs
26 | _Upload a zipped copy of an STL and your config (`File -> Export Config`)_
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | Build
3 | Build.bat
4 | MYMETA.json
5 | MYMETA.yml
6 | _build
7 | blib
8 | xs/buildtmp
9 | *.o
10 | MANIFEST.bak
11 | xs/MANIFEST.bak
12 | xs/assertlib*
13 | .init_bundle.ini
14 | local-lib
15 | package/osx/Slic3r*.app
16 | *.dmg
17 | *.swp
18 | *.swo
19 | svg
20 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: perl
2 | before_install:
3 | - sh package/linux/travis-decrypt-key
4 | install:
5 | - export BOOST_DIR=$HOME/boost_1_63_0
6 | - export SLIC3R_STATIC=1
7 | - export CXX=g++-4.9
8 | - export CC=g++-4.9
9 | - source $HOME/perl5/perlbrew/etc/bashrc
10 | script:
11 | - bash package/linux/travis-setup.sh
12 | - perlbrew switch slic3r-perl
13 | - perl ./Build.PL
14 | after_success:
15 | - eval $(perl -Mlocal::lib=$TRAVIS_BUILD_DIR/local-lib)
16 | - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64
17 | - package/linux/appimage.sh x86_64
18 | - package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 Slic3r*.AppImage
19 | - package/deploy/sftp-symlink.sh linux ~/slic3r-upload.rsa AppImage Slic3r*.AppImage
20 | - package/deploy/sftp-symlink.sh linux ~/slic3r-upload.rsa tar.bz2 *.bz2
21 | branches:
22 | only:
23 | - master
24 | - xsgui
25 | cache:
26 | apt: true
27 | directories:
28 | - "$HOME/cache"
29 | addons:
30 | apt:
31 | sources:
32 | - ubuntu-toolchain-r-test
33 | packages:
34 | - g++-4.9
35 | - gcc-4.9
36 | - libgtk2.0-0
37 | - libgtk2.0-dev
38 | - freeglut3
39 | ssh_known_hosts: dl.slic3r.org
40 | notifications:
41 | irc:
42 | channels:
43 | - chat.freenode.net#slic3r
44 | on_success: change
45 | on_failure: always
46 | use_notice: true
47 | sudo: required
48 | dist: trusty
49 | env:
50 | matrix:
51 | global:
52 | - secure: eEVRZNMv7FM6jrOU9iAFkDhWxFQ1WtHBEaObImcvtFUxy6vWSt3ehFFeTRouj3uHQAnbvUzziDyvPPm8/95alv5g/du8ML6YzzqKBKfazM0xQ7SF6R2DQL8lfFIp+RSV7T02byEP1f1g7Zva7xH9szIlDcSfU0pXW4KWbkBFMd8=
53 | - secure: gj338h+qHGccTD/VQFmEJkqdg2McIe2pO0iZ4Ae9BvY5vxkIML4BpoYZQXQTqiAOETnUjlcknY9lx0hI/PfkDD9MSJc5BC/3fMYRCu3SgAclEwklWf9vvtodUeT69mtnZuw1zze1nTbExuOw2mepbqFjxKKMl+9l5oCz4O54fXU=
54 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.3.0-{branch}-{build}
2 | image: WMF 5
3 | init:
4 | - ps:
5 | environment:
6 | LDLOADLIBS: -lstdc++
7 | SLIC3R_STATIC: 1
8 | SLIC3R_VERSION: 1.3.0
9 | BOOST_DIR: C:\dev\boost_1_63_0
10 | WXDIR: C:\dev\wxwidgets
11 | WXSHARED: SHARED=0
12 | FORCE_WX_BUILD: 0
13 | FORCE_BOOST_REINSTALL: 0
14 | ENC_SECRET:
15 | secure: QfeTOSKXz1uFCEACqFKLNw==
16 | UPLOAD_USER:
17 | secure: fYPwnI3p6HNR+eMRJR3JfmyNolFn+Uc0MUn2bBXp9uU=
18 | matrix:
19 | - ARCH: 64bit
20 | - ARCH: 32bit
21 |
22 | install:
23 | - IF DEFINED ENC_SECRET nuget install secure-file -ExcludeVersion
24 | - IF DEFINED ENC_SECRET secure-file\tools\secure-file -decrypt package/deploy/slic3r-upload.ppk.enc -secret %ENC_SECRET%
25 | - ps: "& package/win/appveyor_preinstall.ps1"
26 | cache:
27 | - C:\Users\appveyor\local-lib-64bit.7z
28 | - C:\Users\appveyor\local-lib-32bit.7z
29 | - C:\Users\appveyor\freeglut.64bit.7z
30 | - C:\Users\appveyor\freeglut.32bit.7z
31 | - C:\users\appveyor\strawberry.64bit.msi
32 | - C:\users\appveyor\strawberry.32bit.msi
33 | - C:\Users\appveyor\winscp.zip
34 | - C:\Users\appveyor\extra_perl.7z
35 | - C:\Users\appveyor\wxwidgets-64bit.7z
36 | - C:\Users\appveyor\wxwidgets-32bit.7z
37 | - C:\Users\appveyor\boost.1.63.0.32bit.7z
38 | - C:\Users\appveyor\boost.1.63.0.64bit.7z
39 | build_script:
40 | - ps: "& package/win/appveyor_buildscript.ps1"
41 | artifacts:
42 | - path: .\slic3r*zip
43 | name: slic3r-dev
44 | deploy_script:
45 | - ps: "cd C:/projects/slic3r; & package/win/appveyor_deploy.ps1"
46 | on_success:
47 | - ps:
48 | on_failure:
49 | - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
50 | on_finish:
51 | - ps:
52 |
--------------------------------------------------------------------------------
/lib/Slic3r/ExPolygon.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::ExPolygon;
2 | use strict;
3 | use warnings;
4 |
5 | # an ExPolygon is a polygon with holes
6 |
7 | use List::Util qw(first);
8 | use Slic3r::Geometry qw(X Y A B point_in_polygon epsilon scaled_epsilon);
9 | use Slic3r::Geometry::Clipper qw(union_ex diff_pl);
10 |
11 | sub wkt {
12 | my $self = shift;
13 | return sprintf "POLYGON(%s)",
14 | join ',', map "($_)", map { join ',', map "$_->[0] $_->[1]", @$_ } @$self;
15 | }
16 |
17 | sub dump_perl {
18 | my $self = shift;
19 | return sprintf "[%s]",
20 | join ',', map "[$_]", map { join ',', map "[$_->[0],$_->[1]]", @$_ } @$self;
21 | }
22 |
23 | sub offset {
24 | my $self = shift;
25 | return Slic3r::Geometry::Clipper::offset(\@$self, @_);
26 | }
27 |
28 | sub offset_ex {
29 | my $self = shift;
30 | return Slic3r::Geometry::Clipper::offset_ex(\@$self, @_);
31 | }
32 |
33 | sub bounding_box {
34 | my $self = shift;
35 | return $self->contour->bounding_box;
36 | }
37 |
38 | package Slic3r::ExPolygon::Collection;
39 | use Slic3r::Geometry qw(X1 Y1);
40 |
41 | sub size {
42 | my $self = shift;
43 | return [ Slic3r::Geometry::size_2D([ map @$_, map @$_, @$self ]) ];
44 | }
45 |
46 | 1;
47 |
--------------------------------------------------------------------------------
/lib/Slic3r/ExtrusionLoop.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::ExtrusionLoop;
2 | use strict;
3 | use warnings;
4 |
5 | use parent qw(Exporter);
6 |
7 | our @EXPORT_OK = qw(EXTRL_ROLE_DEFAULT
8 | EXTRL_ROLE_CONTOUR_INTERNAL_PERIMETER EXTRL_ROLE_SKIRT);
9 | our %EXPORT_TAGS = (roles => \@EXPORT_OK);
10 |
11 |
12 | 1;
13 |
--------------------------------------------------------------------------------
/lib/Slic3r/ExtrusionPath.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::ExtrusionPath;
2 | use strict;
3 | use warnings;
4 |
5 | use parent qw(Exporter);
6 |
7 | our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_EXTERNAL_PERIMETER EXTR_ROLE_OVERHANG_PERIMETER
8 | EXTR_ROLE_FILL EXTR_ROLE_SOLIDFILL EXTR_ROLE_TOPSOLIDFILL EXTR_ROLE_GAPFILL EXTR_ROLE_BRIDGE
9 | EXTR_ROLE_SKIRT EXTR_ROLE_SUPPORTMATERIAL EXTR_ROLE_SUPPORTMATERIAL_INTERFACE
10 | EXTR_ROLE_NONE);
11 | our %EXPORT_TAGS = (roles => \@EXPORT_OK);
12 |
13 | 1;
14 |
--------------------------------------------------------------------------------
/lib/Slic3r/Flow.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Flow;
2 | use strict;
3 | use warnings;
4 |
5 | use parent qw(Exporter);
6 |
7 | our @EXPORT_OK = qw(FLOW_ROLE_EXTERNAL_PERIMETER FLOW_ROLE_PERIMETER FLOW_ROLE_INFILL
8 | FLOW_ROLE_SOLID_INFILL
9 | FLOW_ROLE_TOP_SOLID_INFILL FLOW_ROLE_SUPPORT_MATERIAL
10 | FLOW_ROLE_SUPPORT_MATERIAL_INTERFACE);
11 | our %EXPORT_TAGS = (roles => \@EXPORT_OK);
12 |
13 | 1;
14 |
--------------------------------------------------------------------------------
/lib/Slic3r/GCode/VibrationLimit.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::GCode::VibrationLimit;
2 | use Moo;
3 |
4 | extends 'Slic3r::GCode::Reader';
5 |
6 | has '_min_time' => (is => 'lazy');
7 | has '_last_dir' => (is => 'ro', default => sub { [0,0] });
8 | has '_dir_time' => (is => 'ro', default => sub { [0,0] });
9 |
10 | # inspired by http://hydraraptor.blogspot.it/2010/12/frequency-limit.html
11 |
12 | use List::Util qw(max);
13 |
14 | sub _build__min_time {
15 | my ($self) = @_;
16 | return 1 / ($self->config->vibration_limit * 60); # in minutes
17 | }
18 |
19 | sub process {
20 | my $self = shift;
21 | my ($gcode) = @_;
22 |
23 | my $new_gcode = "";
24 | $self->parse($gcode, sub {
25 | my ($reader, $cmd, $args, $info) = @_;
26 |
27 | if ($cmd eq 'G1' && $info->{dist_XY} > 0) {
28 | my $point = Slic3r::Pointf->new($args->{X} // $reader->X, $args->{Y} // $reader->Y);
29 | my @dir = (
30 | ($point->x <=> $reader->X),
31 | ($point->y <=> $reader->Y), #$
32 | );
33 | my $time = $info->{dist_XY} / ($args->{F} // $reader->F); # in minutes
34 |
35 | if ($time > 0) {
36 | my @pause = ();
37 | foreach my $axis (0..$#dir) {
38 | if ($dir[$axis] != 0 && $self->_last_dir->[$axis] != $dir[$axis]) {
39 | if ($self->_last_dir->[$axis] != 0) {
40 | # this axis is changing direction: check whether we need to pause
41 | if ($self->_dir_time->[$axis] < $self->_min_time) {
42 | push @pause, ($self->_min_time - $self->_dir_time->[$axis]);
43 | }
44 | }
45 | $self->_last_dir->[$axis] = $dir[$axis];
46 | $self->_dir_time->[$axis] = 0;
47 | }
48 | $self->_dir_time->[$axis] += $time;
49 | }
50 |
51 | if (@pause) {
52 | $new_gcode .= sprintf "G4 P%d\n", max(@pause) * 60 * 1000;
53 | }
54 | }
55 | }
56 |
57 | $new_gcode .= $info->{raw} . "\n";
58 | });
59 |
60 | return $new_gcode;
61 | }
62 |
63 | 1;
64 |
--------------------------------------------------------------------------------
/lib/Slic3r/GUI/BonjourBrowser.pm:
--------------------------------------------------------------------------------
1 | # A tiny dialog to select an OctoPrint device to print to.
2 |
3 | package Slic3r::GUI::BonjourBrowser;
4 | use strict;
5 | use warnings;
6 | use utf8;
7 |
8 | use Wx qw(:dialog :id :misc :sizer :choicebook wxTAB_TRAVERSAL);
9 | use Wx::Event qw(EVT_CLOSE);
10 | use base 'Wx::Dialog';
11 |
12 | sub new {
13 | my $class = shift;
14 | my ($parent, $devices) = @_;
15 | my $self = $class->SUPER::new($parent, -1, "Device Browser", wxDefaultPosition, [350,700], wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
16 |
17 | $self->{devices} = $devices;
18 |
19 | # label
20 | my $text = Wx::StaticText->new($self, -1, "Choose an OctoPrint device in your network:", wxDefaultPosition, wxDefaultSize);
21 |
22 | # selector
23 | $self->{choice} = my $choice = Wx::Choice->new($self, -1, wxDefaultPosition, wxDefaultSize,
24 | [ map $_->name, @{$self->{devices}} ]);
25 |
26 | my $main_sizer = Wx::BoxSizer->new(wxVERTICAL);
27 | $main_sizer->Add($text, 1, wxEXPAND | wxALL, 10);
28 | $main_sizer->Add($choice, 1, wxEXPAND | wxALL, 10);
29 | $main_sizer->Add($self->CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND);
30 |
31 | $self->SetSizer($main_sizer);
32 | $self->SetMinSize($self->GetSize);
33 | $main_sizer->SetSizeHints($self);
34 |
35 | # needed to actually free memory
36 | EVT_CLOSE($self, sub {
37 | $self->EndModal(wxID_OK);
38 | $self->Destroy;
39 | });
40 |
41 | return $self;
42 | }
43 |
44 | sub GetValue {
45 | my ($self) = @_;
46 | return $self->{devices}[ $self->{choice}->GetSelection ]->address;
47 | }
48 | sub GetPort {
49 | my ($self) = @_;
50 | return $self->{devices}[ $self->{choice}->GetSelection ]->port;
51 | }
52 |
53 | 1;
54 |
--------------------------------------------------------------------------------
/lib/Slic3r/GUI/Notifier.pm:
--------------------------------------------------------------------------------
1 | # Notify about the end of slicing.
2 | # The notifications are sent out using the Growl protocol if installed, and using DBus XWindow protocol.
3 |
4 | package Slic3r::GUI::Notifier;
5 | use Moo;
6 |
7 | has 'growler' => (is => 'rw');
8 |
9 | my $icon = $Slic3r::var->("Slic3r.png");
10 |
11 | sub BUILD {
12 | my ($self) = @_;
13 |
14 | if (eval 'use Growl::GNTP; 1') {
15 | # register with growl
16 | eval {
17 | $self->growler(Growl::GNTP->new(AppName => 'Slic3r', AppIcon => $icon));
18 | $self->growler->register([{Name => 'SKEIN_DONE', DisplayName => 'Slicing Done'}]);
19 | };
20 | # if register() fails (for example because of a timeout), disable growler at all
21 | $self->growler(undef) if $@;
22 | }
23 | }
24 |
25 | sub notify {
26 | my ($self, $message) = @_;
27 | my $title = 'Slicing Done!';
28 |
29 | eval {
30 | $self->growler->notify(Event => 'SKEIN_DONE', Title => $title, Message => $message)
31 | if $self->growler;
32 | };
33 | # Net::DBus is broken in multithreaded environment
34 | if (0 && eval 'use Net::DBus; 1') {
35 | eval {
36 | my $session = Net::DBus->session;
37 | my $serv = $session->get_service('org.freedesktop.Notifications');
38 | my $notifier = $serv->get_object('/org/freedesktop/Notifications',
39 | 'org.freedesktop.Notifications');
40 | $notifier->Notify('Slic3r', 0, $icon, $title, $message, [], {}, -1);
41 | undef $Net::DBus::bus_session;
42 | };
43 | }
44 | }
45 |
46 | 1;
47 |
--------------------------------------------------------------------------------
/lib/Slic3r/GUI/PresetEditorDialog.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::GUI::PresetEditorDialog;
2 | use strict;
3 | use warnings;
4 | use Wx qw(:dialog :id :misc :sizer :button :icon wxTheApp WXK_ESCAPE);
5 | use Wx::Event qw(EVT_CLOSE EVT_CHAR_HOOK);
6 | use base qw(Wx::Dialog Class::Accessor);
7 | use utf8;
8 |
9 | __PACKAGE__->mk_accessors(qw(preset_editor));
10 |
11 | sub new {
12 | my ($class, $parent) = @_;
13 | my $self = $class->SUPER::new($parent, -1, "Settings", wxDefaultPosition, [900,500],
14 | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxDIALOG_EX_METAL);
15 |
16 | $self->preset_editor($self->preset_editor_class->new($self));
17 | $self->SetTitle($self->preset_editor->title);
18 |
19 | my $sizer = Wx::BoxSizer->new(wxVERTICAL);
20 | $sizer->Add($self->preset_editor, 1, wxEXPAND);
21 |
22 | $self->SetSizer($sizer);
23 | #$sizer->SetSizeHints($self);
24 |
25 | if (0) {
26 | my $buttons = $self->CreateStdDialogButtonSizer(wxCLOSE);
27 | $sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
28 | }
29 |
30 | wxTheApp->restore_window_pos($self, "preset_editor");
31 |
32 | EVT_CLOSE($self, sub {
33 | my (undef, $event) = @_;
34 |
35 | # save window size
36 | wxTheApp->save_window_pos($self, "preset_editor");
37 |
38 | # propagate event
39 | $event->Skip;
40 | });
41 |
42 | EVT_CHAR_HOOK($self, sub {
43 | my (undef, $event) = @_;
44 |
45 | if ($event->GetKeyCode == WXK_ESCAPE) {
46 | $self->Close;
47 | } else {
48 | $event->Skip;
49 | }
50 | });
51 |
52 | return $self;
53 | }
54 |
55 |
56 | package Slic3r::GUI::PresetEditorDialog::Printer;
57 | use base qw(Slic3r::GUI::PresetEditorDialog);
58 |
59 | sub preset_editor_class { "Slic3r::GUI::PresetEditor::Printer" }
60 |
61 |
62 | package Slic3r::GUI::PresetEditorDialog::Filament;
63 | use base qw(Slic3r::GUI::PresetEditorDialog);
64 |
65 | sub preset_editor_class { "Slic3r::GUI::PresetEditor::Filament" }
66 |
67 |
68 | package Slic3r::GUI::PresetEditorDialog::Print;
69 | use base qw(Slic3r::GUI::PresetEditorDialog);
70 |
71 | sub preset_editor_class { "Slic3r::GUI::PresetEditor::Print" }
72 |
73 | 1;
74 |
--------------------------------------------------------------------------------
/lib/Slic3r/Geometry/Clipper.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Geometry::Clipper;
2 | use strict;
3 | use warnings;
4 |
5 | require Exporter;
6 | our @ISA = qw(Exporter);
7 | our @EXPORT_OK = qw(offset offset_ex
8 | diff_ex diff union_ex intersection_ex JT_ROUND JT_MITER
9 | JT_SQUARE is_counter_clockwise union_pt offset2 offset2_ex
10 | intersection intersection_pl diff_pl union CLIPPER_OFFSET_SCALE
11 | union_pt_chained intersection_ppl);
12 |
13 | 1;
14 |
--------------------------------------------------------------------------------
/lib/Slic3r/Layer.pm:
--------------------------------------------------------------------------------
1 | # Extends the C++ class Slic3r::Layer.
2 |
3 | package Slic3r::Layer;
4 | use strict;
5 | use warnings;
6 |
7 | # the following two were previously generated by Moo
8 | sub print {
9 | my $self = shift;
10 | return $self->object->print;
11 | }
12 |
13 | sub config {
14 | my $self = shift;
15 | return $self->object->config;
16 | }
17 |
18 | sub region {
19 | my $self = shift;
20 | my ($region_id) = @_;
21 |
22 | while ($self->region_count <= $region_id) {
23 | $self->add_region($self->object->print->get_region($self->region_count));
24 | }
25 |
26 | return $self->get_region($region_id);
27 | }
28 |
29 | sub regions {
30 | my ($self) = @_;
31 | return [ map $self->get_region($_), 0..($self->region_count-1) ];
32 | }
33 |
34 | package Slic3r::Layer::Support;
35 | our @ISA = qw(Slic3r::Layer);
36 |
37 | 1;
38 |
--------------------------------------------------------------------------------
/lib/Slic3r/Line.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Line;
2 | use strict;
3 | use warnings;
4 |
5 | # a line is a two-points line
6 | use parent 'Slic3r::Polyline';
7 |
8 | sub intersection {
9 | my $self = shift;
10 | my ($line, $require_crossing) = @_;
11 | return Slic3r::Geometry::line_intersection($self, $line, $require_crossing);
12 | }
13 |
14 | sub grow {
15 | my $self = shift;
16 | return Slic3r::Polyline->new(@$self)->grow(@_);
17 | }
18 |
19 | 1;
20 |
--------------------------------------------------------------------------------
/lib/Slic3r/Point.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Point;
2 | use strict;
3 | use warnings;
4 |
5 | sub new_scale {
6 | my $class = shift;
7 | return $class->new(map Slic3r::Geometry::scale($_), @_);
8 | }
9 |
10 | sub dump_perl {
11 | my $self = shift;
12 | return sprintf "[%s,%s]", @$self;
13 | }
14 |
15 | package Slic3r::Point3;
16 | use strict;
17 | use warnings;
18 |
19 | sub new_scale {
20 | my $class = shift;
21 | return $class->new(map Slic3r::Geometry::scale($_), @_);
22 | }
23 |
24 | package Slic3r::Pointf;
25 | use strict;
26 | use warnings;
27 |
28 | sub new_unscale {
29 | my $class = shift;
30 | return $class->new(map Slic3r::Geometry::unscale($_), @_);
31 | }
32 |
33 | package Slic3r::Pointf3;
34 | use strict;
35 | use warnings;
36 |
37 | sub new_unscale {
38 | my $class = shift;
39 | return $class->new(map Slic3r::Geometry::unscale($_), @_);
40 | }
41 |
42 | 1;
43 |
--------------------------------------------------------------------------------
/lib/Slic3r/Polygon.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Polygon;
2 | use strict;
3 | use warnings;
4 |
5 | # a polygon is a closed polyline.
6 | use parent 'Slic3r::Polyline';
7 |
8 | use Slic3r::Geometry qw(PI);
9 |
10 | sub grow {
11 | my $self = shift;
12 | return $self->split_at_first_point->grow(@_);
13 | }
14 |
15 | # this method subdivides the polygon segments to that no one of them
16 | # is longer than the length provided
17 | sub subdivide {
18 | my $self = shift;
19 | my ($max_length) = @_;
20 |
21 | my @points = @$self;
22 | push @points, $points[0]; # append first point as this is a polygon
23 | my @new_points = shift @points;
24 | while (@points) {
25 | while ($new_points[-1]->distance_to($points[0]) > $max_length) {
26 | push @new_points, map Slic3r::Point->new(@$_),
27 | Slic3r::Geometry::point_along_segment($new_points[-1], $points[0], $max_length);
28 | }
29 | push @new_points, shift @points;
30 | }
31 | pop @new_points; # remove last point as it coincides with first one
32 | return Slic3r::Polygon->new(@new_points);
33 | }
34 |
35 | 1;
--------------------------------------------------------------------------------
/lib/Slic3r/Polyline.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Polyline;
2 | use strict;
3 | use warnings;
4 |
5 | use Slic3r::Geometry qw(X Y);
6 |
7 | sub new_scale {
8 | my $class = shift;
9 | my @points = map { ref($_) eq 'Slic3r::Point' ? $_->pp : $_ } @_;
10 | return $class->new(map [ Slic3r::Geometry::scale($_->[X]), Slic3r::Geometry::scale($_->[Y]) ], @points);
11 | }
12 |
13 | sub dump_perl {
14 | my $self = shift;
15 | return sprintf "[%s]", join ',', map "[$_->[0],$_->[1]]", @$self;
16 | }
17 |
18 | 1;
19 |
--------------------------------------------------------------------------------
/lib/Slic3r/Print/State.pm:
--------------------------------------------------------------------------------
1 | # Wraps C++ enums Slic3r::PrintStep and Slic3r::PrintObjectStep
2 | package Slic3r::Print::State;
3 | use strict;
4 | use warnings;
5 |
6 | require Exporter;
7 | our @ISA = qw(Exporter);
8 | our @EXPORT_OK = qw(STEP_LAYERS STEP_SLICE STEP_PERIMETERS STEP_PREPARE_INFILL
9 | STEP_INFILL STEP_SUPPORTMATERIAL STEP_SKIRT STEP_BRIM);
10 | our %EXPORT_TAGS = (steps => \@EXPORT_OK);
11 |
12 | 1;
13 |
--------------------------------------------------------------------------------
/lib/Slic3r/Surface.pm:
--------------------------------------------------------------------------------
1 | package Slic3r::Surface;
2 | use strict;
3 | use warnings;
4 |
5 | require Exporter;
6 | our @ISA = qw(Exporter);
7 | our @EXPORT_OK = qw(S_TYPE_TOP S_TYPE_BOTTOM S_TYPE_BOTTOMBRIDGE S_TYPE_INTERNAL S_TYPE_INTERNALSOLID S_TYPE_INTERNALBRIDGE S_TYPE_INTERNALVOID S_TYPE_TOP_NONPLANAR S_TYPE_INTERNALSOLID_NONPLANAR);
8 | our %EXPORT_TAGS = (types => \@EXPORT_OK);
9 |
10 | sub p {
11 | my $self = shift;
12 | return @{$self->polygons};
13 | }
14 |
15 | 1;
16 |
--------------------------------------------------------------------------------
/package/common/coreperl:
--------------------------------------------------------------------------------
1 | # Core perl modules used in Slic3r
2 | attributes
3 | base
4 | bytes
5 | B
6 | POSIX
7 | FindBin
8 | Unicode::Normalize
9 | Tie::Handle
10 | Time::Local
11 | Math::Trig
12 | IO::Socket
13 | Errno
14 | Storable
15 | lib
16 | overload
17 | warnings
18 | local::lib
19 | strict
20 | utf8
21 | parent
22 |
--------------------------------------------------------------------------------
/package/deploy/bintray.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Prerequistes
3 | # Environment variables:
4 | # BINTRAY_API_KEY - Working API key
5 | # BINTRAY_API_USER - Bintray username.
6 | # Run this from the repository root (required to get slic3r version)
7 |
8 | source $(dirname $0)/common/util.sh
9 | SLIC3R_VERSION=$(grep "VERSION" xs/src/libslic3r/libslic3r.h | awk -F\" '{print $2}')
10 | get_commit
11 | set_build_id
12 | set_branch
13 | set_pr_id
14 | if [ "$current_branch" == "master" ] && [ -z ${PR_ID} ]; then
15 | # If building master, goes in slic3r_dev or slic3r, depending on whether or not this is a tagged build
16 | if [ -z ${TAGGED+x} ]; then
17 | SLIC3R_PKG=slic3r_dev
18 | else
19 | SLIC3R_PKG=slic3r
20 | fi
21 | version=$SLIC3R_BUILD_ID
22 | else
23 | # If building a branch, put the package somewhere else.
24 | echo "Delploying pull request $PR_ID"
25 | SLIC3R_PKG=Slic3r_Branches
26 | version=${SLIC3R_BUILD_ID}-PR${PR_ID}
27 | fi
28 |
29 | file=$1
30 | echo "Deploying $file to $version on Bintray repo $SLIC3R_PKG..."
31 | API=${BINTRAY_API_KEY}
32 | USER=${BINTRAY_API_USER}
33 |
34 | echo "Creating version: $version"
35 | curl -s -X POST -d "{ \"name\": \"$version\", \"released\": \"ISO8601 $(date +%Y-%m-%d'T'%H:%M:%S)\", \"desc\": \"This version...\", \"github_release_notes_file\": \"RELEASE.txt\", \"github_use_tag_release_notes\": true, \"vcs_tag\": \"$version\" }" -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/${SLIC3R_PKG}/versions
36 |
37 | echo "Publishing ${file} to ${version}..."
38 | curl -s -H "X-Bintray-Package: $SLIC3R_PKG" -H "X-Bintray-Version: $version" -H 'X-Bintray-Publish: 1' -H 'X-Bintray-Override: 1' -T $file -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/$(basename $1)
39 | #curl -X POST -u${USER}:${API} https://api.bintray.com/content/lordofhyphens/Slic3r/${SLIC3R_PKG}/$version/publish
40 | # Wait 5s for the server to catch up
41 | #sleep 5
42 | #curl -H 'Content-Type: application/json' -X PUT -d "{ \"list_in_downloads\":true }" -u${USER}:${API} https://api.bintray.com/file_metadata/lordofhyphens/Slic3r/$(basename $1)
43 | exit 0
44 |
--------------------------------------------------------------------------------
/package/deploy/sftp-symlink.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Prerequisites
3 | # Environment Variables:
4 | # UPLOAD_USER - user to upload to sftp server
5 | # KEY is assumed to be path to a ssh key for UPLOAD_USER
6 |
7 | DIR=$1
8 | shift
9 | KEY=$1
10 | shift
11 | EXT=$1
12 | shift
13 | FILES=$*
14 |
15 | source $(dirname $0)/../common/util.sh
16 | set_pr_id
17 | set_branch
18 | if [ ! -z ${PR_ID+x} ] || [ $current_branch != "master" ]; then
19 | DIR=${DIR}/branches
20 | fi
21 |
22 | if [ -s $KEY ]; then
23 | for i in $FILES; do
24 | filepath=$(readlink -f "$i")
25 | filepath=$(basename $filepath)
26 | tmpfile=$(mktemp)
27 |
28 | echo "rm Slic3r-${current_branch}-latest.${EXT}" | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
29 | echo "symlink $filepath Slic3r-${current_branch}-latest.${EXT} " > $tmpfile
30 | sftp -b $tmpfile -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
31 | result=$?
32 | if [ $? -eq 1 ]; then
33 | echo "Error with SFTP symlink"
34 | exit $result;
35 | fi
36 | done
37 | else
38 | echo "$KEY is not available, not symlinking."
39 | fi
40 | exit $result
41 |
--------------------------------------------------------------------------------
/package/deploy/sftp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Prerequisites
3 | # Environment Variables:
4 | # UPLOAD_USER - user to upload to sftp server
5 | # KEY is assumed to be path to a ssh key for UPLOAD_USER
6 |
7 | DIR=$1
8 | shift
9 | KEY=$1
10 | shift
11 | FILES=$*
12 | source $(dirname $0)/../common/util.sh
13 | set_pr_id
14 | set_branch
15 | if [ ! -z ${PR_ID+x} ] || [ $current_branch != "master" ]; then
16 | DIR=${DIR}/branches
17 | fi
18 |
19 | if [ -s $KEY ]; then
20 | for i in $FILES; do
21 | filepath=$(readlink -f "$i")
22 | tmpfile=$(mktemp)
23 | echo put $filepath > $tmpfile
24 | sftp -b $tmpfile -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
25 | result=$?
26 | if [ $? -eq 1 ]; then
27 | echo "Error with SFTP"
28 | exit $result;
29 | fi
30 | done
31 | else
32 | echo "$KEY is not available, not deploying."
33 | fi
34 | exit $result
35 |
--------------------------------------------------------------------------------
/package/deploy/slic3r-upload.ppk.enc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/package/deploy/slic3r-upload.ppk.enc
--------------------------------------------------------------------------------
/package/deploy/slic3r-upload.rsa.enc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/package/deploy/slic3r-upload.rsa.enc
--------------------------------------------------------------------------------
/package/deploy/winscp.ps1:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | # Environment Variables:
3 | # UPLOAD_USER - user to upload to sftp server
4 | # KEY is assumed to be path to a ssh key for UPLOAD_USER
5 |
6 | Param(
7 | [string]$DIR,
8 | [string]$KEY,
9 | [string]$FILE
10 | )
11 | Set-Variable -Name "UUSER" -Value "$env:UPLOAD_USER"
12 | Set-Variable -Name "UPLOAD" -Value "$($FILE | Resolve-Path)"
13 | if (Test-Path $KEY) {
14 | if ($env:APPVEYOR_PULL_REQUEST_NUMBER -Or $env:APPVEYOR_REPO_BRANCH -ne "master" ) {
15 | winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR/branches -hostkey=*" "put $UPLOAD ./$FILE" "exit"
16 | } else {
17 | winscp.com /privatekey=$KEY /command "open sftp://$UUSER@dl.slic3r.org/$DIR -hostkey=*" "put $UPLOAD ./$FILE" "exit"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/package/linux/build_shell.mk:
--------------------------------------------------------------------------------
1 | src=../common/shell.cpp
2 |
3 | # override with environment variable
4 | CXX ?= g++
5 |
6 | # Path to perl header files
7 | INCLUDEDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE
8 |
9 | # path to library files for perl
10 | LIBDIR ?= ${HOME}/perl5/perlbrew/perls/slic3r-perl/lib/5.24.0/x86_64-linux-thread-multi/CORE
11 |
12 | LIBS += -lperl -lpthread -lcrypt
13 |
14 | CXXFLAGS += -std=c++11 -static-libgcc -static-libstdc++ -I${INCLUDEDIR}
15 | LDFLAGS += -L${LIBDIR}
16 |
17 | .PHONY: all clean
18 | all: Slic3r Slic3r-console
19 |
20 | Slic3r: slic3r.o
21 | ${CXX} ${LDFLAGS} -o $@ $< ${LIBS}
22 |
23 | Slic3r-console: slic3r-console.o
24 | ${CXX} ${LDFLAGS} -o $@ $< ${LIBS}
25 | slic3r-console.o: ${src}
26 | ${CXX} -c ${CXXFLAGS} -o $@ $<
27 | slic3r.o: ${src}
28 | ${CXX} -c -DFORCE_GUI ${CXXFLAGS} -o $@ $<
29 |
30 | clean:
31 | rm *.o Slic3r*
32 |
--------------------------------------------------------------------------------
/package/linux/libpaths.appimage.txt:
--------------------------------------------------------------------------------
1 | /usr/lib/x86_64-linux-gnu/libstdc++.so.6 # needed because of ancient distros and slic3r (and perl for perl reasons) needs modern c++.
2 |
--------------------------------------------------------------------------------
/package/linux/libpaths.txt:
--------------------------------------------------------------------------------
1 | /home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_baseu-3.0.so.0
2 | /home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_adv-3.0.so.0
3 | /home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_core-3.0.so.0
4 | /home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_gl-3.0.so.0
5 | /home/travis/builds/alexrj/Slic3r/local-lib/lib/perl5/x86_64-linux-thread-multi/Alien/wxWidgets/gtk_3_0_2_uni/lib/libwx_gtk2u_html-3.0.so.0
6 | /lib/x86_64-linux-gnu/liblzma.so.5
7 | /lib/x86_64-linux-gnu/libpng12.so.0
8 | /usr/lib/x86_64-linux-gnu/libjpeg.so.8
9 | /usr/lib/x86_64-linux-gnu/libjbig.so.0
10 | /usr/lib/x86_64-linux-gnu/libtiff.so.5
11 | /usr/lib/x86_64-linux-gnu/libglut.so.3 # needed for appimage on some systems that don't have glut installed.
12 |
--------------------------------------------------------------------------------
/package/linux/slic3r.desktop.in:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 |
3 | Type=Application
4 |
5 | Name=APPLICATION_NAME
6 |
7 | Comment=Prepare 3D Models for printing
8 |
9 | Icon=slic3r
10 |
11 | Exec=Slic3r
12 |
--------------------------------------------------------------------------------
/package/linux/startup_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | BIN=$(readlink "$0")
4 | DIR=$(dirname "$BIN")
5 | export LD_LIBRARY_PATH="$DIR/bin"
6 | exec "$DIR/perl-local" -I"$DIR/local-lib/lib/perl5" "$DIR/slic3r.pl" $@
7 |
--------------------------------------------------------------------------------
/package/linux/travis-decrypt-key:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Script to only decrypt if it is available
3 |
4 | if [ ! -z ${encrypted_daaf322d08bf_key+x} ]; then
5 | openssl aes-256-cbc -K $encrypted_daaf322d08bf_key -iv $encrypted_daaf322d08bf_iv -in $TRAVIS_BUILD_DIR/package/deploy/slic3r-upload.rsa.enc -out ~/slic3r-upload.rsa -d
6 | chmod 600 ~/slic3r-upload.rsa
7 | fi
8 |
--------------------------------------------------------------------------------
/package/linux/travis-setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Script to configure travis environment prior to build
3 | WXVERSION=302
4 | CACHE=$HOME/cache
5 | mkdir -p $CACHE
6 |
7 | if [ ! -e $CACHE/slic3r-perlbrew-5.24.tar.bz2 ]; then
8 | echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2 => $CACHE/slic3r-perlbrew-5.24.tar.bz2"
9 | curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-perl.524.travis.tar.bz2" -o $CACHE/slic3r-perlbrew-5.24.tar.bz2;
10 | fi
11 |
12 | if [ ! -e $CACHE/boost-compiled.tar.bz2 ]; then
13 | echo "Downloading http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2 => $CACHE/boost-compiled.tar.bz2"
14 | curl -L "http://www.siusgs.com/slic3r/buildserver/boost_1_63_0.built.gcc-4.9.4-buildserver.tar.bz2" -o $CACHE/boost-compiled.tar.bz2
15 | fi
16 |
17 | if [ ! -e $CACHE/local-lib-wx${WXVERSION}.tar.bz2 ]; then
18 | echo "Downloading http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2 => $CACHE/local-lib-wx${WXVERSION}.tar.bz2"
19 | curl -L "http://www.siusgs.com/slic3r/buildserver/slic3r-dependencies.travis-wx${WXVERSION}.tar.bz2" -o $CACHE/local-lib-wx${WXVERSION}.tar.bz2
20 | fi
21 |
22 | if [ ! -e $CACHE/wx${WXVERSION}.tar.bz2 ]; then
23 | echo "Downloading http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2 => $CACHE/wx${WXVERSION}.tar.bz2"
24 | curl -L "http://www.siusgs.com/slic3r/buildserver/wx${WXVERSION}-libs.tar.bz2" -o $CACHE/wx${WXVERSION}.tar.bz2
25 | fi
26 |
27 | tar -C$TRAVIS_BUILD_DIR -xjf $CACHE/local-lib-wx${WXVERSION}.tar.bz2
28 | tar -C$HOME/perl5/perlbrew/perls -xjf $CACHE/slic3r-perlbrew-5.24.tar.bz2
29 | tar -C$HOME -xjf $CACHE/boost-compiled.tar.bz2
30 | tar -C$HOME -xjf $CACHE/wx${WXVERSION}.tar.bz2
31 |
--------------------------------------------------------------------------------
/package/osx/startup_script.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR=$(dirname "$0")
4 | exec "$DIR/perl-local" -I"$DIR/local-lib/lib/perl5" "$DIR/slic3r.pl" $@
5 |
--------------------------------------------------------------------------------
/package/win/appveyor_buildscript.ps1:
--------------------------------------------------------------------------------
1 | if (!(Test-Path "C:\users\appveyor\local-lib-$env:ARCH.7z")) {
2 | wget "https://bintray.com/lordofhyphens/Slic3r/download_file?file_path=local-lib-$env:ARCH.7z" -o "C:\users\appveyor\local-lib-$env:ARCH.7z" | Write-Output
3 | }
4 |
5 | if (Test-Path "C:\users\appveyor\local-lib-$env:ARCH.7z") {
6 | cmd /c "7z x C:\Users\appveyor\local-lib-$env:ARCH.7z -oC:\projects\slic3r" -y | Write-Output
7 | rm -r 'C:\projects\slic3r\local-lib\Slic3r*'
8 | }
9 |
10 | $env:Path = "C:\Strawberry\c\bin;C:\Strawberry\perl\bin;" + $env:Path
11 | cd C:\projects\slic3r
12 |
13 | rm -r 'C:\Program Files (x86)\Microsoft Vis*\bin' -Force
14 |
15 | Add-AppveyorCompilationMessage -Message "Building Slic3r XS"
16 | perl ./Build.pl
17 |
18 | if ($LastExitCode -ne 0) {
19 | Add-AppveyorCompilationMessage -Message "XS Failed to Build" -Category Error
20 | $host.SetShouldExit($LastExitCode)
21 | exit
22 | }
23 |
24 | Add-AppveyorCompilationMessage -Message "Making ZIP package"
25 | cd package/win
26 | ./compile_wrapper.ps1 524 | Write-Output
27 | ./package_win32.ps1 524| Write-Output
28 |
--------------------------------------------------------------------------------
/package/win/appveyor_deploy.ps1:
--------------------------------------------------------------------------------
1 |
2 | Add-AppveyorCompilationMessage -Message "Uploading to server."
3 | & ./package/deploy/winscp.ps1 -DIR win -KEY $env:APPVEYOR_BUILD_FOLDER/package/deploy/slic3r-upload.ppk -FILE *.zip *>> ./sftplog.txt
4 |
--------------------------------------------------------------------------------
/package/win/compile_wrapper.ps1:
--------------------------------------------------------------------------------
1 | # Short Powershell script to build a wrapper exec
2 | Param
3 | (
4 | [string]$perlVersion = "524",
5 | [string]$STRAWBERRY_PATH = "C:\Strawberry",
6 | # Path to C++ compiler, or just name if it is in path
7 | [string]$cxx = "g++"
8 | )
9 |
10 | function Get-ScriptDirectory
11 | {
12 | $Invocation = (Get-Variable MyInvocation -Scope 1).Value
13 | Split-Path $Invocation.MyCommand.Path
14 | }
15 | $scriptDir = Get-ScriptDirectory
16 |
17 | $perllib = "-lperl$perlVersion"
18 | $shell_loc = "${scriptDir}\..\common\shell.cpp"
19 |
20 | # Build the resource file (used to load icon, etc)
21 | windres ${scriptDir}\slic3r.rc -O coff -o ${scriptDir}\slic3r.res
22 |
23 | # Compile an object file that does not have gui forced.
24 | Invoke-Expression "$cxx -c -I'${STRAWBERRY_PATH}\perl\lib\CORE\' $shell_loc -o ${scriptDir}/slic3r.o"
25 |
26 |
27 | # Compile an object file with --gui automatically passed as an argument
28 | Invoke-Expression "$cxx -c -I'${STRAWBERRY_PATH}\perl\lib\CORE\' -DFORCE_GUI $shell_loc -o ${scriptDir}/slic3r-gui.o"
29 |
30 | # Build the EXE for the unforced version as slic3r-console
31 | Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r-console.exe | Write-Host"
32 |
33 | # Build the EXE for the forced GUI
34 | Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -mwindows -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r-gui.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r.exe | Write-Host"
35 |
36 | # Build an extra copy of the GUI version that creates a console window
37 | Invoke-Expression "$cxx -static-libgcc -static-libstdc++ -L'${STRAWBERRY_PATH}\c\lib' -L'${STRAWBERRY_PATH}\perl\bin' -L'${STRAWBERRY_PATH}\perl\lib\CORE\' $perllib ${scriptDir}/slic3r-gui.o ${scriptDir}/slic3r.res -o ${scriptDir}/slic3r-debug-console.exe | Write-Host"
38 |
39 |
--------------------------------------------------------------------------------
/package/win/slic3r.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Slic3r
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/package/win/slic3r.rc:
--------------------------------------------------------------------------------
1 | id ICON "../../var/Slic3r.ico"
2 | 1 VERSIONINFO
3 | FILEVERSION 1,3,0,0
4 | PRODUCTVERSION 1,3,0,0
5 | FILEOS 0x4
6 | FILETYPE 0x1
7 | BEGIN
8 | BLOCK "StringFileInfo"
9 | BEGIN
10 | BLOCK "040904E4"
11 | BEGIN
12 | VALUE "CompanyName", "Slic3r.org"
13 | VALUE "FileDescription", "3D Printer Slicer application"
14 | VALUE "FileVersion", "1.3.0"
15 | VALUE "InternalName", "slic3r.exe"
16 | VALUE "LegalCopyright", "Alessandro Ranellucci"
17 | VALUE "OriginalFilename", "slic3r.exe"
18 | VALUE "ProductName", "Slic3r"
19 | VALUE "ProductVersion", "1.3.0"
20 | END
21 | END
22 | BLOCK "VarFileInfo"
23 | BEGIN
24 | VALUE "Translation", 0x409, 1252
25 | END
26 | END
27 | 1 24 "slic3r.exe.manifest"
28 |
--------------------------------------------------------------------------------
/share/locale/ja/slic3r.mo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/share/locale/ja/slic3r.mo
--------------------------------------------------------------------------------
/src/standalone/config.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/src/standalone/config.h
--------------------------------------------------------------------------------
/src/utils/extrude-tin.cpp:
--------------------------------------------------------------------------------
1 | #include "Config.hpp"
2 | #include "Model.hpp"
3 | #include "IO.hpp"
4 | #include "TriangleMesh.hpp"
5 | #include "libslic3r.h"
6 | #include
7 | #include
8 |
9 | using namespace Slic3r;
10 |
11 | void confess_at(const char *file, int line, const char *func, const char *pat, ...){}
12 |
13 | int
14 | main(int argc, char **argv)
15 | {
16 | // Convert arguments to UTF-8 (needed on Windows).
17 | // argv then points to memory owned by a.
18 | boost::nowide::args a(argc, argv);
19 |
20 | // read config
21 | ConfigDef config_def;
22 | {
23 | ConfigOptionDef* def;
24 |
25 | def = config_def.add("offset", coFloat);
26 | def->label = "Offset from the lowest point (min thickness)";
27 | def->cli = "offset";
28 | def->default_value = new ConfigOptionFloat(1);
29 |
30 | def = config_def.add("output", coString);
31 | def->label = "Output File";
32 | def->tooltip = "The file where the output will be written (if not specified, it will be based on the input file).";
33 | def->cli = "output";
34 | def->default_value = new ConfigOptionString("");
35 | }
36 | DynamicConfig config(&config_def);
37 | t_config_option_keys input_files;
38 | config.read_cli(argc, argv, &input_files);
39 |
40 | for (t_config_option_keys::const_iterator it = input_files.begin(); it != input_files.end(); ++it) {
41 | TriangleMesh mesh;
42 | Slic3r::IO::STL::read(*it, &mesh);
43 | mesh.extrude_tin(config.option("offset", true)->getFloat());
44 |
45 | std::string outfile = config.option("output", true)->getString();
46 | if (outfile.empty()) outfile = *it + "_extruded.stl";
47 |
48 | Slic3r::IO::STL::write(mesh, outfile);
49 | boost::nowide::cout << "Extruded mesh written to " << outfile << std::endl;
50 | }
51 |
52 | return 0;
53 | }
54 |
--------------------------------------------------------------------------------
/src/windows-build.txt:
--------------------------------------------------------------------------------
1 | Install:
2 | mingw
3 | boost
4 | cmake
5 | git
6 |
7 | Assuming boost is in c:\program files\boost\boost_1_61_0 and mingw is in c:\mingw
8 |
9 | start cmd.exe
10 | > cd c:\program files\boost\boost_1_61_0
11 | > set PATH=c:\mingw\bin
12 | > bootstrap gcc
13 | > .\b2 --build-dir=c:\boost-mingw toolset=gcc link=static runtime-link=static variant=release --with-system --with-thread
14 | leave cmd window open
15 |
16 | start git bash
17 | > cd /c
18 | > git clone http://github.com/alexrj/slic3r
19 | > cd slic3r
20 | > git checkout cppsvg
21 | close git bash when done
22 |
23 | make sure c:\mingw\bin is part of the Path system variable, add it otherwise
24 |
25 | start cmake gui
26 | source code: c:\slic3r\src
27 | build directory: c:\slic3r\build
28 | click configure, select "mingw makefiles" from list, select "default native compilers", click finish
29 | click generate
30 | close cmake gui
31 |
32 | alternatively, do it from command line:
33 | cmake ..\src -G "MinGW Makefiles" -DBOOST_ROOT="c:\program files\boost\boost_1_61_0"
34 | (in case cmake can't find the libs, -DBoost_DEBUG=1 and -DBoost_COMPILER=-mgw46 are useful)
35 |
36 | go back to cmd window
37 | > cd c:\slic3r\build
38 | > mingw32-make.exe
39 | might be mingw64 on 64-bit setup, I'm not sure
40 | The resulting slic3r.exe is the target executable, it has no dependencies except windows system libraries (kernel32 and msvcrt)
41 |
--------------------------------------------------------------------------------
/t/avoid_crossing_perimeters.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 1;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use List::Util qw(first sum);
12 | use Slic3r;
13 | use Slic3r::Test;
14 |
15 | {
16 | my $config = Slic3r::Config->new_from_defaults;
17 | $config->set('avoid_crossing_perimeters', 2);
18 | my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 2);
19 | ok my $gcode = Slic3r::Test::gcode($print), "no crash with avoid_crossing_perimeters and multiple objects";
20 | }
21 |
22 | __END__
23 |
--------------------------------------------------------------------------------
/t/config.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 1;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use Slic3r;
12 | use Slic3r::Test;
13 |
14 | {
15 | my $config = Slic3r::Config->new_from_defaults;
16 | $config->set('perimeter_extrusion_width', '250%');
17 | ok $config->validate, 'percent extrusion width is validated';
18 | }
19 |
20 | __END__
21 |
--------------------------------------------------------------------------------
/t/gaps.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 1;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use List::Util qw(first);
12 | use Slic3r;
13 | use Slic3r::Flow ':roles';
14 | use Slic3r::Geometry qw(PI scale unscale convex_hull);
15 | use Slic3r::Geometry::Clipper qw();
16 | use Slic3r::Surface ':types';
17 | use Slic3r::Test;
18 |
19 | {
20 | my $config = Slic3r::Config->new_from_defaults;
21 | $config->set('skirts', 0);
22 | $config->set('perimeter_speed', 66);
23 | $config->set('external_perimeter_speed', 66);
24 | $config->set('small_perimeter_speed', 66);
25 | $config->set('gap_fill_speed', 99);
26 | $config->set('perimeters', 1);
27 | $config->set('cooling', 0); # to prevent speeds from being altered
28 | $config->set('first_layer_speed', '100%'); # to prevent speeds from being altered
29 | $config->set('perimeter_extrusion_width', 0.35);
30 | $config->set('first_layer_extrusion_width', 0.35);
31 |
32 | my $print = Slic3r::Test::init_print('two_hollow_squares', config => $config);
33 | my @perimeter_points = ();
34 | my $last = ''; # perimeter | gap
35 | my $gap_fills_outside_last_perimeters = 0;
36 | Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
37 | my ($self, $cmd, $args, $info) = @_;
38 |
39 | if ($info->{extruding} && $info->{dist_XY} > 0) {
40 | my $F = $args->{F} // $self->F;
41 | my $point = Slic3r::Point->new_scale($info->{new_X}, $info->{new_Y});
42 | if ($F == $config->perimeter_speed*60) {
43 | if ($last eq 'gap') {
44 | @perimeter_points = ();
45 | }
46 | push @perimeter_points, $point;
47 | $last = 'perimeter';
48 | } elsif ($F == $config->gap_fill_speed*60) {
49 | my $convex_hull = convex_hull(\@perimeter_points);
50 | if (!$convex_hull->contains_point($point)) {
51 | $gap_fills_outside_last_perimeters++;
52 | }
53 |
54 | $last = 'gap';
55 | }
56 | }
57 | });
58 | is $gap_fills_outside_last_perimeters, 0, 'gap fills are printed before leaving islands';
59 | }
60 |
61 | __END__
62 |
--------------------------------------------------------------------------------
/t/loops.t:
--------------------------------------------------------------------------------
1 | use Test::More;
2 | use strict;
3 | use warnings;
4 |
5 | plan tests => 4;
6 |
7 | BEGIN {
8 | use FindBin;
9 | use lib "$FindBin::Bin/../lib";
10 | use local::lib "$FindBin::Bin/../local-lib";
11 | }
12 |
13 | use Slic3r;
14 | use Slic3r::Geometry qw(Z epsilon scale);
15 | use Slic3r::Test;
16 |
17 | {
18 | # We want to check what happens when three concentric loops happen
19 | # to be at the same height, the two external ones being ccw and the other being
20 | # a hole, thus cw. So we create three cubes, centered around origin, the internal
21 | # one having reversed normals.
22 | my $mesh1 = Slic3r::Test::mesh('20mm_cube');
23 |
24 | # center around origin
25 | my $bb = $mesh1->bounding_box;
26 | $mesh1->translate(
27 | -($bb->x_min + $bb->size->x/2),
28 | -($bb->y_min + $bb->size->y/2), #//
29 | -($bb->z_min + $bb->size->z/2),
30 | );
31 |
32 | my $mesh2 = $mesh1->clone;
33 | $mesh2->scale(1.2);
34 |
35 | my $mesh3 = $mesh2->clone;
36 | $mesh3->scale(1.2);
37 |
38 | $mesh1->reverse_normals;
39 | ok $mesh1->volume < 0, 'reverse_normals';
40 |
41 | my $all_meshes = Slic3r::TriangleMesh->new;
42 | $all_meshes->merge($_) for $mesh1, $mesh2, $mesh3;
43 |
44 | my $loops = $all_meshes->slice_at(Z, 0);
45 | is scalar(@$loops), 1, 'one expolygon returned';
46 | is scalar(@{$loops->[0]->holes}), 1, 'expolygon has one hole';
47 | ok abs(-$loops->[0]->holes->[0]->area - scale($bb->size->x)*scale($bb->size->y)) < epsilon, #))
48 | 'hole has expected size';
49 | }
50 |
51 | __END__
52 |
--------------------------------------------------------------------------------
/t/pressure.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 1;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use List::Util qw();
12 | use Slic3r;
13 | use Slic3r::Geometry qw(epsilon);
14 | use Slic3r::Test;
15 |
16 | {
17 | my $config = Slic3r::Config->new_from_defaults;
18 | $config->set('pressure_advance', 10);
19 | $config->set('retract_length', [1]);
20 |
21 | my $print = Slic3r::Test::init_print('20mm_cube', config => $config, duplicate => 2);
22 | my $retracted = $config->retract_length->[0];
23 | Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
24 | my ($self, $cmd, $args, $info) = @_;
25 |
26 | if ($info->{extruding} && !$info->{dist_XY}) {
27 | $retracted += $info->{dist_E};
28 | } elsif ($info->{retracting}) {
29 | $retracted += $info->{dist_E};
30 | }
31 | });
32 |
33 | ok abs($retracted) < 0.01, 'all retractions are compensated';
34 | }
35 |
36 |
37 | __END__
38 |
--------------------------------------------------------------------------------
/t/speed.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 2;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use List::Util qw(none);
12 | use Slic3r;
13 | use Slic3r::Geometry qw(epsilon);
14 | use Slic3r::Test;
15 |
16 | {
17 | my $config = Slic3r::Config->new_from_defaults;
18 | my $test = sub {
19 | my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
20 | my %speeds_by_z = (); # z => []
21 | Slic3r::GCode::Reader->new->parse(my $gcode = Slic3r::Test::gcode($print), sub {
22 | my ($self, $cmd, $args, $info) = @_;
23 |
24 | if ($cmd eq 'G1' && $info->{dist_E} > 0 && $info->{dist_XY} > 0) {
25 | $speeds_by_z{$self->Z} //= [];
26 | push @{ $speeds_by_z{$self->Z} }, $self->F/60;
27 | }
28 | });
29 | return %speeds_by_z;
30 | };
31 |
32 | {
33 | $config->set('perimeter_speed', 0);
34 | $config->set('external_perimeter_speed', 0);
35 | $config->set('infill_speed', 0);
36 | $config->set('support_material_speed', 0);
37 | $config->set('solid_infill_speed', 0);
38 | $config->set('first_layer_speed', '50%');
39 | $config->set('first_layer_height', 0.25);
40 | my %speeds_by_z = $test->();
41 | ok !!(none { $_ > $config->max_print_speed/2+&epsilon } @{ $speeds_by_z{$config->first_layer_height} }),
42 | 'percent first_layer_speed is applied over autospeed';
43 | }
44 |
45 | {
46 | $config->set('first_layer_speed', 33);
47 | my %speeds_by_z = $test->();
48 | ok !!(none { $_ > $config->first_layer_speed } @{ $speeds_by_z{$config->first_layer_height} }),
49 | 'absolute first_layer_speed overrides autospeed';
50 | }
51 | }
52 |
53 | __END__
54 |
--------------------------------------------------------------------------------
/t/svg.t:
--------------------------------------------------------------------------------
1 | use Test::More tests => 2;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use Slic3r;
12 | use Slic3r::Test;
13 |
14 | {
15 | my $print = Slic3r::Test::init_print('20mm_cube');
16 | eval {
17 | my $fh = IO::Scalar->new(\my $gcode);
18 | $print->print->export_svg(output_fh => $fh, quiet => 1);
19 | $fh->close;
20 | };
21 | die $@ if $@;
22 | ok !$@, 'successful SVG export';
23 | }
24 |
25 | {
26 | my $print = Slic3r::Test::init_print('two_hollow_squares');
27 | eval {
28 | my $fh = IO::Scalar->new(\my $gcode);
29 | $print->print->export_svg(output_fh => $fh, quiet => 1);
30 | $fh->close;
31 | };
32 | die $@ if $@;
33 | ok !$@, 'successful SVG export of object with two islands';
34 | }
35 |
36 | __END__
37 |
--------------------------------------------------------------------------------
/t/threads.t:
--------------------------------------------------------------------------------
1 | use Test::More;
2 | use strict;
3 | use warnings;
4 |
5 | BEGIN {
6 | use FindBin;
7 | use lib "$FindBin::Bin/../lib";
8 | use local::lib "$FindBin::Bin/../local-lib";
9 | }
10 |
11 | use List::Util qw(first);
12 | use Slic3r;
13 | use Slic3r::Test;
14 |
15 | if (!$Slic3r::have_threads) {
16 | plan skip_all => "this perl is not compiled with threads";
17 | }
18 | plan tests => 2;
19 |
20 | {
21 | my $print = Slic3r::Test::init_print('20mm_cube');
22 | {
23 | my $thread = threads->create(sub { Slic3r::thread_cleanup(); return 1; });
24 | ok $thread->join, "print survives thread spawning";
25 | }
26 | }
27 |
28 | {
29 | my $thread = threads->create(sub {
30 | {
31 | my $print = Slic3r::Test::init_print('20mm_cube');
32 | Slic3r::Test::gcode($print);
33 | }
34 | Slic3r::thread_cleanup();
35 | return 1;
36 | });
37 | ok $thread->join, "process print in a separate thread";
38 | }
39 |
40 | __END__
41 |
--------------------------------------------------------------------------------
/utils/amf-to-stl.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script converts an AMF file to STL
3 |
4 | use strict;
5 | use warnings;
6 |
7 | BEGIN {
8 | use FindBin;
9 | use lib "$FindBin::Bin/../lib";
10 | use local::lib "$FindBin::Bin/../local-lib";
11 | }
12 |
13 | use File::Basename qw(basename);
14 | use Getopt::Long qw(:config no_auto_abbrev);
15 | use Slic3r;
16 | $|++;
17 |
18 | my %opt = ();
19 | {
20 | my %options = (
21 | 'help' => sub { usage() },
22 | 'ascii' => \$opt{ascii},
23 | );
24 | GetOptions(%options) or usage(1);
25 | $ARGV[0] or usage(1);
26 | }
27 |
28 | {
29 | my $model = Slic3r::Model->read_from_file($ARGV[0]);
30 | my $output_file = $ARGV[0];
31 | $output_file =~ s/\.amf(?:\.xml)?$/\.stl/i;
32 |
33 | printf "Writing to %s\n", basename($output_file);
34 | $model->write_stl($output_file, !$opt{ascii});
35 | }
36 |
37 |
38 | sub usage {
39 | my ($exit_code) = @_;
40 |
41 | print <<"EOF";
42 | Usage: amf-to-stl.pl [ OPTIONS ] file.amf
43 |
44 | --help Output this usage screen and exit
45 | --ascii Generate ASCII STL files (default: binary)
46 |
47 | EOF
48 | exit ($exit_code || 0);
49 | }
50 |
51 | __END__
52 |
--------------------------------------------------------------------------------
/utils/config-bundle-to-config.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script extracts a full active config from a config bundle.
3 | # (Often users reporting issues don't attach plain configs, but
4 | # bundles...)
5 |
6 | use strict;
7 | use warnings;
8 |
9 | BEGIN {
10 | use FindBin;
11 | use lib "$FindBin::Bin/../lib";
12 | use local::lib "$FindBin::Bin/../local-lib";
13 | }
14 |
15 | use Getopt::Long qw(:config no_auto_abbrev);
16 | use Slic3r;
17 | use Slic3r::Test;
18 | $|++;
19 |
20 | my %opt = ();
21 | {
22 | my %options = (
23 | 'help' => sub { usage() },
24 | 'output=s' => \$opt{output},
25 | );
26 | GetOptions(%options) or usage(1);
27 | $ARGV[0] or usage(1);
28 | }
29 |
30 | ($ARGV[0] && $opt{output}) or usage(1);
31 |
32 | {
33 | my $bundle_ini = Slic3r::Config->read_ini($ARGV[0])
34 | or die "Failed to read $ARGV[0]\n";
35 |
36 | my $config_ini = { _ => {} };
37 | foreach my $section (qw(print filament printer)) {
38 | my $preset_name = $bundle_ini->{presets}{$section};
39 | $preset_name =~ s/\.ini$//;
40 | my $preset = $bundle_ini->{"$section:$preset_name"}
41 | or die "Failed to find preset $preset_name in bundle\n";
42 | $config_ini->{_}{$_} = $preset->{$_} for keys %$preset;
43 | }
44 |
45 | Slic3r::Config->write_ini($opt{output}, $config_ini);
46 | }
47 |
48 |
49 | sub usage {
50 | my ($exit_code) = @_;
51 |
52 | print <<"EOF";
53 | Usage: config-bundle-to-config.pl --output config.ini bundle.ini
54 | EOF
55 | exit ($exit_code || 0);
56 | }
57 |
58 | __END__
59 |
--------------------------------------------------------------------------------
/utils/dump-stl.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script dumps a STL file into Perl syntax for writing tests
3 | # or dumps a test model into a STL file
4 |
5 | use strict;
6 | use warnings;
7 |
8 | BEGIN {
9 | use FindBin;
10 | use lib "$FindBin::Bin/../lib";
11 | use local::lib "$FindBin::Bin/../local-lib";
12 | }
13 |
14 | use Slic3r;
15 | use Slic3r::Test;
16 | $|++;
17 |
18 | $ARGV[0] or usage(1);
19 |
20 | if (-e $ARGV[0]) {
21 | my $model = Slic3r::Model->read_from_file($ARGV[0]);
22 | $model->objects->[0]->add_instance(offset => Slic3r::Pointf->new(0,0));
23 | my $mesh = $model->mesh;
24 | $mesh->repair;
25 | printf "VERTICES = %s\n", join ',', map "[$_->[0],$_->[1],$_->[2]]", @{$mesh->vertices};
26 | printf "FACETS = %s\n", join ',', map "[$_->[0],$_->[1],$_->[2]]", @{$mesh->facets};
27 | exit 0;
28 | } elsif ((my $model = Slic3r::Test::model($ARGV[0]))) {
29 | $ARGV[1] or die "Missing writeable destination as second argument\n";
30 | $model->write_stl($ARGV[1]);
31 | printf "Model $ARGV[0] written to $ARGV[1]\n";
32 | exit 0;
33 | } else {
34 | die "No such model exists\n";
35 | }
36 |
37 |
38 | sub usage {
39 | my ($exit_code) = @_;
40 |
41 | print <<"EOF";
42 | Usage: dump-stl.pl file.stl
43 | dump-stl.pl modelname file.stl
44 | EOF
45 | exit ($exit_code || 0);
46 | }
47 |
48 | __END__
49 |
--------------------------------------------------------------------------------
/utils/estimate-gcode-time.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 |
3 | use strict;
4 | use warnings;
5 |
6 | BEGIN {
7 | use FindBin;
8 | use lib "$FindBin::Bin/../lib";
9 | use local::lib "$FindBin::Bin/../local-lib";
10 | }
11 |
12 | use Slic3r;
13 |
14 | die "Usage: estimate-gcode-time.pl FILE\n"
15 | if @ARGV != 1;
16 |
17 | my $estimator = Slic3r::GCode::TimeEstimator->new;
18 | $estimator->parse_file($ARGV[0]);
19 | printf "Time: %d minutes and %d seconds\n", int($estimator->time / 60), $estimator->time % 60;
20 |
21 | __END__
22 |
--------------------------------------------------------------------------------
/utils/modifier_helpers/layer_generator.jscad:
--------------------------------------------------------------------------------
1 | // title: Layer_generator
2 | // written by: Joseph Lenox
3 | // Used for generating cubes oriented about the center
4 | // for making simple modifier meshes.
5 |
6 | var width = 100;
7 | var layer_height = 0.3;
8 | var z = 30;
9 | function main() {
10 |
11 | return cube(size=[width,width,layer_height], center=true).translate([0,0,z]);
12 | }
13 | function getParameterDefinitions() {
14 | return [
15 | { name: 'width', type: 'float', initial: 100, caption: "Width of the cube:" },
16 | { name: 'layer_height', type: 'float', initial: 0.3, caption: "Layer height used:" },
17 | { name: 'z', type: 'float', initial: 0, caption: "Z:" }
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/utils/modifier_helpers/solid_layers.scad:
--------------------------------------------------------------------------------
1 | // Used to generate a modifier mesh to do something every few layers.
2 | // Load into OpenSCAD, tweak the variables below, export as STL and load as
3 | // a modifier mesh. Then change settings for the modifier mesh.
4 |
5 | // Written by Joseph Lenox; in public domain.
6 |
7 | layer_height = 0.3; // set to layer height in slic3r for "best" results.
8 | number_of_solid_layers = 2;
9 | N = 4; // N > number_of_solid_layers or else the whole thing will be solid
10 | model_height = 300.0;
11 | model_width = 300.0; // these two should be at least as big as the model
12 | model_depth = 300.0; // but bigger isn't a problem
13 | initial_offset=0; // don't generate below this
14 |
15 | position_on_bed=[0,0,0]; // in case you need to move it around
16 |
17 | // don't touch below unless you know what you are doing.
18 | simple_layers = round(model_height/layer_height);
19 | translate(position_on_bed)
20 | for (i = [initial_offset:N:simple_layers]) {
21 | translate([0,0,i*layer_height])
22 | translate([0,0,(layer_height*number_of_solid_layers)/2])
23 | cube([model_width,model_depth,layer_height*number_of_solid_layers], center=true);
24 | }
25 |
--------------------------------------------------------------------------------
/utils/post-processing/decimate.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -i~
2 |
3 | use strict;
4 | use warnings;
5 |
6 | my %lastpos = (X => 10000, Y => 10000, Z => 10000, E => 10000, F => 10000);
7 | my %pos = (X => 0, Y => 0, Z => 0, E => 0, F => 0);
8 |
9 | my $mindist = 0.33;
10 |
11 | my $mindistz = 0.005;
12 |
13 | my $mindistsq = $mindist * $mindist;
14 |
15 | sub dist {
16 | my $sq = 0;
17 | for (qw/X Y Z E/) {
18 | $sq += ($pos{$_} - $lastpos{$_}) ** 2;
19 | }
20 | return $sq;
21 | }
22 |
23 | while (<>) {
24 | if (m#\bG[01]\b#) {
25 | while (m#([XYZEF])(\d+(\.\d+)?)#gi) {
26 | $pos{uc $1} = $2;
27 | }
28 | if (
29 | (
30 | /X/ &&
31 | /Y/ &&
32 | (dist() >= $mindistsq)
33 | ) ||
34 | (abs($pos{Z} - $lastpos{Z}) > $mindistz) ||
35 | (!/X/ || !/Y/)
36 | ) {
37 | print;
38 | %lastpos = %pos;
39 | }
40 | elsif (($pos{F} - $lastpos{F}) != 0) {
41 | printf "G1 F%s\n", $pos{F};
42 | $lastpos{F} = $pos{F};
43 | }
44 | }
45 | else {
46 | if (m#\bG92\b#) {
47 | while (m#([XYZEF])(\d+(\.\d+)?)#gi) {
48 | $lastpos{uc $1} = $2;
49 | }
50 | }
51 | print;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/utils/post-processing/fan_kickstart.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | import sys
3 | import re
4 |
5 | sea = re.compile("M106 S[1-9]+[0-9]*")
6 | rep = re.compile("M106 S255\n\g<0>")
7 | out = open(sys.argv[1]+"_fixed", 'w')
8 | with open(sys.argv[1]) as f:
9 | for r in f:
10 | if re.search(sea, r) is not None:
11 | out.write(re.sub(sea,"M106 S255\n\g<0>",r))
12 | else:
13 | out.write(r)
14 |
--------------------------------------------------------------------------------
/utils/post-processing/filament-weight.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -i
2 | #
3 | # Post-processing script for adding weight and cost of required
4 | # filament to G-code output.
5 |
6 | use strict;
7 | use warnings;
8 |
9 | # example densities, adjust according to filament specifications
10 | use constant PLA_P => 1.25; # g/cm3
11 | use constant ABS_P => 1.05; # g/cm3
12 |
13 | # example costs, adjust according to filament prices
14 | use constant PLA_PRICE => 0.05; # EUR/g
15 | use constant ABS_PRICE => 0.02; # EUR/g
16 | use constant CURRENCY => "EUR";
17 |
18 | while (<>) {
19 | if (/^(;\s+filament\s+used\s+=\s.*\((\d+(?:\.\d+)?)cm3)\)/) {
20 | my $pla_weight = $2 * PLA_P;
21 | my $abs_weight = $2 * ABS_P;
22 |
23 | my $pla_costs = $pla_weight * PLA_PRICE;
24 | my $abs_costs = $abs_weight * ABS_PRICE;
25 |
26 | printf "%s or %.2fg PLA/%.2fg ABS)\n", $1, $pla_weight, $abs_weight;
27 | printf "; costs = %s %.2f (PLA), %s %.2f (ABS)\n", CURRENCY, $pla_costs, CURRENCY, $abs_costs;
28 | } else {
29 | print;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/utils/post-processing/flowrate.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -i
2 |
3 | #
4 | # Post-processing script for calculating flow rate for each move
5 |
6 | use strict;
7 | use warnings;
8 |
9 | use constant PI => 3.141592653589793238;
10 | my @filament_diameter = split /,/, $ENV{SLIC3R_FILAMENT_DIAMETER};
11 |
12 | my $E = 0;
13 | my $T = 0;
14 | my ($X, $Y, $F);
15 | while (<>) {
16 | if (/^G1.*? F([0-9.]+)/) {
17 | $F = $1;
18 | }
19 | if (/^G1 X([0-9.-]+) Y([0-9.-]+).*? E([0-9.-]+)/) {
20 | my ($x, $y, $e) = ($1, $2, $3);
21 | my $e_length = $e - $E;
22 | if ($e_length > 0 && defined $X && defined $Y) {
23 | my $dist = sqrt( (($x-$X)**2) + (($y-$Y)**2) );
24 | if ($dist > 0) {
25 | my $mm_per_mm = $e_length / $dist; # dE/dXY
26 | my $mm3_per_mm = (($filament_diameter[$T] // 0) ** 2) * PI/4 * $mm_per_mm;
27 | my $vol_speed = $F/60 * $mm3_per_mm;
28 | my $comment = sprintf ' ; dXY = %.3fmm ; dE = %.5fmm ; dE/XY = %.5fmm/mm; volspeed = %.5fmm^3/sec',
29 | $dist, $e_length, $mm_per_mm, $vol_speed;
30 | s/(\R+)/$comment$1/;
31 | }
32 | }
33 | $E = $e;
34 | $X = $x;
35 | $Y = $y;
36 | }
37 | if (/^G1 X([0-9.]+) Y([0-9.]+)/) {
38 | $X = $1;
39 | $Y = $2;
40 | }
41 | if (/^G1.*? E([0-9.]+)/) {
42 | $E = $1;
43 | }
44 | if (/^G92 E0/) {
45 | $E = 0;
46 | }
47 | if (/^T(\d+)/) {
48 | $T = $1;
49 | }
50 | print;
51 | }
52 |
53 | __END__
54 |
--------------------------------------------------------------------------------
/utils/post-processing/prowl-notification.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | #
3 | # Example post-processing script for sending a Prowl notification upon
4 | # completion. See http://www.prowlapp.com/ for more info.
5 |
6 | use strict;
7 | use warnings;
8 |
9 | use File::Basename qw(basename);
10 | use WebService::Prowl;
11 |
12 | # set your Prowl API key here
13 | my $apikey = '';
14 |
15 | my $file = basename $ARGV[0];
16 | my $prowl = WebService::Prowl->new(apikey => $apikey);
17 | my %options = (application => 'Slic3r',
18 | event =>'Slicing Done!',
19 | description => "$file was successfully generated");
20 | printf STDERR "Error sending Prowl notification: %s\n", $prowl->error
21 | unless $prowl->add(%options);
22 |
--------------------------------------------------------------------------------
/utils/post-processing/strip-toolchange.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -i
2 | #
3 | # Remove all toolchange commands (and T# arguments) from gcode.
4 |
5 | use strict;
6 | use warnings;
7 |
8 | # read stdin and any/all files passed as parameters one line at a time
9 | while (<>) {
10 | if (not /^T[0-9]/) {
11 | s/\s*(T[0-9])//;
12 | print;
13 | } else {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/utils/post-processing/z-every-line.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl -i
2 |
3 | use strict;
4 | use warnings;
5 |
6 | my $z = 0;
7 |
8 | # read stdin and any/all files passed as parameters one line at a time
9 | while (<>) {
10 | # if we find a Z word, save it
11 | $z = $1 if /Z\s*(\d+(\.\d+)?)/;
12 |
13 | # if we don't have Z, but we do have X and Y
14 | if (!/Z/ && /X/ && /Y/ && $z > 0) {
15 | # chop off the end of the line (incl. comments), saving chopped section in $1
16 | s/\s*([\r\n\;\(].*)/" Z$z $1"/es;
17 | # print start of line, insert our Z value then re-add the chopped end of line
18 | # print "$_ Z$z $1";
19 | }
20 | #else {
21 | # nothing interesting, print line as-is
22 | print or die $!;
23 | #}
24 | }
25 |
--------------------------------------------------------------------------------
/utils/send-gcode.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env perl
2 |
3 | use strict;
4 | use warnings;
5 |
6 | BEGIN {
7 | use FindBin;
8 | use lib "$FindBin::Bin/../lib";
9 | use local::lib "$FindBin::Bin/../local-lib";
10 | }
11 |
12 | use Slic3r;
13 |
14 | die "Usage: send-gcode.pl SERIALPORT BAUDRATE GCODE_FILE\n"
15 | if @ARGV != 3;
16 |
17 | my $serial = Slic3r::GCode::Sender->new;
18 | $serial->connect($ARGV[0], $ARGV[1]);
19 | 1 until $serial->is_connected;
20 | print "Connected to printer\n";
21 |
22 | {
23 | local $/ = "\n";
24 | Slic3r::open(\my $fh, '<', $ARGV[2])
25 | or die "Unable to open $ARGV[2]: $!\n";
26 | binmode $fh, ':utf8';
27 | while (<$fh>) {
28 | $serial->send($_);
29 | }
30 | close $fh;
31 | }
32 |
33 | while ((my $queue_size = $serial->queue_size) > 0) {
34 | printf "Queue size: %d\n", $queue_size;
35 | }
36 | $serial->disconnect;
37 |
38 | __END__
39 |
--------------------------------------------------------------------------------
/utils/split_stl.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script splits a STL plate into individual files
3 |
4 | use strict;
5 | use warnings;
6 |
7 | BEGIN {
8 | use FindBin;
9 | use lib "$FindBin::Bin/../lib";
10 | use local::lib "$FindBin::Bin/../local-lib";
11 | }
12 |
13 | use File::Basename qw(basename);
14 | use Getopt::Long qw(:config no_auto_abbrev);
15 | use Slic3r;
16 | $|++;
17 |
18 | my %opt = ();
19 | {
20 | my %options = (
21 | 'help' => sub { usage() },
22 | 'ascii' => \$opt{ascii},
23 | );
24 | GetOptions(%options) or usage(1);
25 | $ARGV[0] or usage(1);
26 | }
27 |
28 | {
29 | my $model = Slic3r::Model->read_from_file($ARGV[0]);
30 | my $basename = $ARGV[0];
31 | $basename =~ s/\.stl$//i;
32 |
33 | my $part_count = 0;
34 | my $mesh = $model->objects->[0]->volumes->[0]->mesh;
35 | foreach my $new_mesh (@{$mesh->split}) {
36 | $new_mesh->repair;
37 |
38 | my $new_model = Slic3r::Model->new;
39 | $new_model
40 | ->add_object()
41 | ->add_volume(mesh => $new_mesh);
42 |
43 | $new_model->add_default_instances;
44 |
45 | my $output_file = sprintf '%s_%02d.stl', $basename, ++$part_count;
46 | printf "Writing to %s\n", basename($output_file);
47 | $new_model->write_stl($output_file, !$opt{ascii});
48 | }
49 | }
50 |
51 |
52 | sub usage {
53 | my ($exit_code) = @_;
54 |
55 | print <<"EOF";
56 | Usage: split_stl.pl [ OPTIONS ] file.stl
57 |
58 | --help Output this usage screen and exit
59 | --ascii Generate ASCII STL files (default: binary)
60 |
61 | EOF
62 | exit ($exit_code || 0);
63 | }
64 |
65 | __END__
66 |
--------------------------------------------------------------------------------
/utils/stl-to-amf.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script converts a STL file to AMF
3 |
4 | use strict;
5 | use warnings;
6 |
7 | BEGIN {
8 | use FindBin;
9 | use lib "$FindBin::Bin/../lib";
10 | use local::lib "$FindBin::Bin/../local-lib";
11 | }
12 |
13 | use File::Basename qw(basename);
14 | use Getopt::Long qw(:config no_auto_abbrev);
15 | use Slic3r;
16 | $|++;
17 |
18 | my %opt = ();
19 | {
20 | my %options = (
21 | 'help' => sub { usage() },
22 | 'distinct-materials' => \$opt{distinct_materials},
23 | );
24 | GetOptions(%options) or usage(1);
25 | $ARGV[0] or usage(1);
26 | }
27 |
28 | {
29 | my @models = map Slic3r::Model->read_from_file($_), @ARGV;
30 | my $output_file = $ARGV[0];
31 | $output_file =~ s/\.stl$/.amf.xml/i;
32 |
33 | my $new_model = Slic3r::Model->new;
34 |
35 | if ($opt{distinct_materials} && @models > 1) {
36 | my $new_object = $new_model->add_object;
37 | for my $m (0 .. $#models) {
38 | my $model = $models[$m];
39 | $new_model->set_material($m, { Name => basename($ARGV[$m]) });
40 | $new_object->add_volume(
41 | material_id => $m,
42 | facets => $model->objects->[0]->volumes->[0]->facets,
43 | vertices => $model->objects->[0]->vertices,
44 | );
45 | }
46 | } else {
47 | foreach my $model (@models) {
48 | $new_model->add_object(
49 | vertices => $model->objects->[0]->vertices,
50 | )->add_volume(
51 | facets => $model->objects->[0]->volumes->[0]->facets,
52 | );
53 | }
54 | }
55 |
56 | printf "Writing to %s\n", basename($output_file);
57 | $new_model->write_amf($output_file);
58 | }
59 |
60 |
61 | sub usage {
62 | my ($exit_code) = @_;
63 |
64 | print <<"EOF";
65 | Usage: amf-to-stl.pl [ OPTIONS ] file.stl [ file2.stl [ file3.stl ] ]
66 |
67 | --help Output this usage screen and exit
68 | --distinct-materials Assign each STL file to a different material
69 |
70 | EOF
71 | exit ($exit_code || 0);
72 | }
73 |
74 | __END__
75 |
--------------------------------------------------------------------------------
/utils/view-mesh.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 | # This script displays 3D preview of a mesh
3 |
4 | use strict;
5 | use warnings;
6 |
7 | BEGIN {
8 | use FindBin;
9 | use lib "$FindBin::Bin/../lib";
10 | use local::lib "$FindBin::Bin/../local-lib";
11 | }
12 |
13 | use Getopt::Long qw(:config no_auto_abbrev);
14 | use Slic3r;
15 | use Slic3r::Geometry qw(Z);
16 | use Slic3r::GUI;
17 | use Slic3r::GUI::3DScene;
18 | $|++;
19 |
20 | my %opt = ();
21 | {
22 | my %options = (
23 | 'help' => sub { usage() },
24 | 'cut=f' => \$opt{cut},
25 | 'enable-moving' => \$opt{enable_moving},
26 | );
27 | GetOptions(%options) or usage(1);
28 | $ARGV[0] or usage(1);
29 | }
30 |
31 | {
32 | my $model = Slic3r::Model->read_from_file($ARGV[0]);
33 |
34 | # make sure all objects have at least one defined instance
35 | $model->add_default_instances;
36 | $_->center_around_origin for @{$model->objects}; # and align to Z = 0
37 |
38 | my $app = Slic3r::ViewMesh->new;
39 | $app->{canvas}->enable_picking(1);
40 | $app->{canvas}->enable_moving($opt{enable_moving});
41 | $app->{canvas}->load_object($model, 0);
42 | $app->{canvas}->set_auto_bed_shape;
43 | $app->{canvas}->zoom_to_volumes;
44 | $app->{canvas}->SetCuttingPlane(Z, $opt{cut}) if defined $opt{cut};
45 | $app->MainLoop;
46 | }
47 |
48 |
49 | sub usage {
50 | my ($exit_code) = @_;
51 |
52 | print <<"EOF";
53 | Usage: view-mesh.pl [ OPTIONS ] file.stl
54 |
55 | --help Output this usage screen and exit
56 | --cut Z Display the cutting plane at the given Z
57 |
58 | EOF
59 | exit ($exit_code || 0);
60 | }
61 |
62 | package Slic3r::ViewMesh;
63 | use Wx qw(:sizer);
64 | use base qw(Wx::App);
65 |
66 | sub OnInit {
67 | my $self = shift;
68 |
69 | my $frame = Wx::Frame->new(undef, -1, 'Mesh Viewer', [-1, -1], [500, 400]);
70 | my $panel = Wx::Panel->new($frame, -1);
71 |
72 | $self->{canvas} = Slic3r::GUI::3DScene->new($panel);
73 |
74 | my $sizer = Wx::BoxSizer->new(wxVERTICAL);
75 | $sizer->Add($self->{canvas}, 1, wxEXPAND, 0);
76 | $panel->SetSizer($sizer);
77 | $sizer->SetSizeHints($panel);
78 |
79 | $frame->Show(1);
80 | }
81 |
82 | __END__
83 |
--------------------------------------------------------------------------------
/utils/zsh/README.markdown:
--------------------------------------------------------------------------------
1 | # ZSH Completions for Slic3r
2 |
3 | To enable zsh(1) completions for Slic3r, add the following to your
4 | ``~/.zshrc`` file, replacing ``/path/to/Slic3r/`` with the actual path
5 | to your Slic3r directory:
6 |
7 | typeset -U fpath
8 |
9 | if [[ -d /path/to/Slic3r/utils/zsh/functions ]]; then
10 | fpath=(/path/to/Slic3r/utils/zsh/functions $fpath)
11 | fi
12 |
13 | autoload -Uz compinit
14 | compinit
15 | zstyle ':completion:*' verbose true
16 | zstyle ':completion:*:descriptions' format '%B%d%b'
17 | zstyle ':completion:*:messages' format '%d'
18 | zstyle ':completion:*:warnings' format 'No matches for %d'
19 | zstyle ':completion:*' group-name '%d'
20 |
21 | See the zshcompsys(1) man page for further details.
22 |
--------------------------------------------------------------------------------
/var/Slic3r.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r.icns
--------------------------------------------------------------------------------
/var/Slic3r.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r.ico
--------------------------------------------------------------------------------
/var/Slic3r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r.png
--------------------------------------------------------------------------------
/var/Slic3r_128px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r_128px.png
--------------------------------------------------------------------------------
/var/Slic3r_192px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r_192px.png
--------------------------------------------------------------------------------
/var/Slic3r_192px_transparent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/Slic3r_192px_transparent.png
--------------------------------------------------------------------------------
/var/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/add.png
--------------------------------------------------------------------------------
/var/application_view_tile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/application_view_tile.png
--------------------------------------------------------------------------------
/var/arrow_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_down.png
--------------------------------------------------------------------------------
/var/arrow_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_in.png
--------------------------------------------------------------------------------
/var/arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_left.png
--------------------------------------------------------------------------------
/var/arrow_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_out.png
--------------------------------------------------------------------------------
/var/arrow_redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_redo.png
--------------------------------------------------------------------------------
/var/arrow_refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_refresh.png
--------------------------------------------------------------------------------
/var/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_right.png
--------------------------------------------------------------------------------
/var/arrow_rotate_anticlockwise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_rotate_anticlockwise.png
--------------------------------------------------------------------------------
/var/arrow_rotate_clockwise.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_rotate_clockwise.png
--------------------------------------------------------------------------------
/var/arrow_undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_undo.png
--------------------------------------------------------------------------------
/var/arrow_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/arrow_up.png
--------------------------------------------------------------------------------
/var/box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/box.png
--------------------------------------------------------------------------------
/var/brick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/brick.png
--------------------------------------------------------------------------------
/var/brick_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/brick_add.png
--------------------------------------------------------------------------------
/var/brick_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/brick_delete.png
--------------------------------------------------------------------------------
/var/brick_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/brick_go.png
--------------------------------------------------------------------------------
/var/bricks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bricks.png
--------------------------------------------------------------------------------
/var/building.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/building.png
--------------------------------------------------------------------------------
/var/bullet_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bullet_black.png
--------------------------------------------------------------------------------
/var/bullet_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bullet_blue.png
--------------------------------------------------------------------------------
/var/bullet_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bullet_green.png
--------------------------------------------------------------------------------
/var/bullet_red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bullet_red.png
--------------------------------------------------------------------------------
/var/bullet_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/bullet_white.png
--------------------------------------------------------------------------------
/var/cog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/cog.png
--------------------------------------------------------------------------------
/var/cog_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/cog_go.png
--------------------------------------------------------------------------------
/var/control_pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_pause.png
--------------------------------------------------------------------------------
/var/control_pause_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_pause_blue.png
--------------------------------------------------------------------------------
/var/control_play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_play.png
--------------------------------------------------------------------------------
/var/control_play_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_play_blue.png
--------------------------------------------------------------------------------
/var/control_stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_stop.png
--------------------------------------------------------------------------------
/var/control_stop_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/control_stop_blue.png
--------------------------------------------------------------------------------
/var/cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/cross.png
--------------------------------------------------------------------------------
/var/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/delete.png
--------------------------------------------------------------------------------
/var/disk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/disk.png
--------------------------------------------------------------------------------
/var/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/error.png
--------------------------------------------------------------------------------
/var/film.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/film.png
--------------------------------------------------------------------------------
/var/funnel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/funnel.png
--------------------------------------------------------------------------------
/var/hourglass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/hourglass.png
--------------------------------------------------------------------------------
/var/house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/house.png
--------------------------------------------------------------------------------
/var/infill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/infill.png
--------------------------------------------------------------------------------
/var/joystick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/joystick.png
--------------------------------------------------------------------------------
/var/layers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/layers.png
--------------------------------------------------------------------------------
/var/lorry_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/lorry_add.png
--------------------------------------------------------------------------------
/var/lorry_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/lorry_go.png
--------------------------------------------------------------------------------
/var/lorry_import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/lorry_import.png
--------------------------------------------------------------------------------
/var/map_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/map_add.png
--------------------------------------------------------------------------------
/var/note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/note.png
--------------------------------------------------------------------------------
/var/package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/package.png
--------------------------------------------------------------------------------
/var/package_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/package_green.png
--------------------------------------------------------------------------------
/var/page_white_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/page_white_go.png
--------------------------------------------------------------------------------
/var/plugin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/plugin.png
--------------------------------------------------------------------------------
/var/plugin_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/plugin_add.png
--------------------------------------------------------------------------------
/var/plugin_go.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/plugin_go.png
--------------------------------------------------------------------------------
/var/printer_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/printer_empty.png
--------------------------------------------------------------------------------
/var/script.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/script.png
--------------------------------------------------------------------------------
/var/shape_flip_horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/shape_flip_horizontal.png
--------------------------------------------------------------------------------
/var/shape_handles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/shape_handles.png
--------------------------------------------------------------------------------
/var/shape_ungroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/shape_ungroup.png
--------------------------------------------------------------------------------
/var/spool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/spool.png
--------------------------------------------------------------------------------
/var/tag_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/tag_blue.png
--------------------------------------------------------------------------------
/var/textfield.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/textfield.png
--------------------------------------------------------------------------------
/var/tick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/tick.png
--------------------------------------------------------------------------------
/var/time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/time.png
--------------------------------------------------------------------------------
/var/variable_layer_height.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/variable_layer_height.png
--------------------------------------------------------------------------------
/var/wand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/wand.png
--------------------------------------------------------------------------------
/var/wrench.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/wrench.png
--------------------------------------------------------------------------------
/var/zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/zoom.png
--------------------------------------------------------------------------------
/var/zoom_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/zoom_in.png
--------------------------------------------------------------------------------
/var/zoom_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/var/zoom_out.png
--------------------------------------------------------------------------------
/xs/MANIFEST.SKIP:
--------------------------------------------------------------------------------
1 |
2 | #!start included /Library/Perl/Updates/5.12.4/ExtUtils/MANIFEST.SKIP
3 | # Avoid version control files.
4 | \bRCS\b
5 | \bCVS\b
6 | \bSCCS\b
7 | ,v$
8 | \B\.svn\b
9 | \B\.git\b
10 | \B\.gitignore\b
11 | \b_darcs\b
12 | \B\.cvsignore$
13 |
14 | # Avoid VMS specific MakeMaker generated files
15 | \bDescrip.MMS$
16 | \bDESCRIP.MMS$
17 | \bdescrip.mms$
18 |
19 | # Avoid Makemaker generated and utility files.
20 | \bMANIFEST\.bak
21 | \bMakefile$
22 | \bblib/
23 | \bMakeMaker-\d
24 | \bpm_to_blib\.ts$
25 | \bpm_to_blib$
26 | \bblibdirs\.ts$ # 6.18 through 6.25 generated this
27 |
28 | # Avoid Module::Build generated and utility files.
29 | \bBuild$
30 | \b_build/
31 | \bBuild.bat$
32 | \bBuild.COM$
33 | \bBUILD.COM$
34 | \bbuild.com$
35 |
36 | # Avoid temp and backup files.
37 | ~$
38 | \.old$
39 | \#$
40 | \b\.#
41 | \.bak$
42 | \.tmp$
43 | \.#
44 | \.rej$
45 |
46 | # Avoid OS-specific files/dirs
47 | # Mac OSX metadata
48 | \B\.DS_Store
49 | # Mac OSX SMB mount metadata files
50 | \B\._
51 |
52 | # Avoid Devel::Cover and Devel::CoverX::Covered files.
53 | \bcover_db\b
54 | \bcovered\b
55 |
56 | # Avoid MYMETA files
57 | ^MYMETA\.
58 | #!end included /Library/Perl/Updates/5.12.4/ExtUtils/MANIFEST.SKIP
59 |
60 | # Avoid configuration metadata file
61 | ^MYMETA\.
62 |
63 | # Avoid Module::Build generated and utility files.
64 | \bBuild$
65 | \bBuild.bat$
66 | \b_build
67 | \bBuild.COM$
68 | \bBUILD.COM$
69 | \bbuild.com$
70 | ^MANIFEST\.SKIP
71 |
72 | # Avoid archives of this distribution
73 | \bSlic3r-XS-[\d\.\_]+
74 |
75 | ^assertlib
76 |
--------------------------------------------------------------------------------
/xs/src/BSpline/COPYRIGHT:
--------------------------------------------------------------------------------
1 | Copyright (c) 1998-2009,2015
2 | University Corporation for Atmospheric Research, UCAR
3 | All rights reserved.
4 |
5 | This software is licensed with the standard BSD license:
6 |
7 | http://www.opensource.org/licenses/bsd-license.html
8 |
9 | When citing this software, here is a suggested reference:
10 |
11 | This software is written by Gary Granger of the National Center for
12 | Atmospheric Research (NCAR), sponsored by the National Science Foundation
13 | (NSF). The algorithm is based on the cubic spline described by Katsuyuki
14 | Ooyama in Montly Weather Review, Vol 115, October 1987. This
15 | implementation has benefited from comparisons with a previous FORTRAN
16 | implementation by James L. Franklin, NOAA/Hurricane Research Division.
17 |
18 | The text of the license is reproduced below:
19 |
20 | Redistribution and use in source and binary forms, with or without
21 | modification, are permitted provided that the following conditions are met:
22 |
23 | * Redistributions of source code must retain the above copyright
24 | notice, this list of conditions and the following disclaimer.
25 |
26 | * Redistributions in binary form must reproduce the above copyright
27 | notice, this list of conditions and the following disclaimer in the
28 | documentation and/or other materials provided with the distribution.
29 |
30 | * Neither the name of the UCAR nor the names of its contributors may be
31 | used to endorse or promote products derived from this software
32 | without specific prior written permission.
33 |
34 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
35 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
37 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
38 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
41 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
42 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
43 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
44 | POSSIBILITY OF SUCH DAMAGE.
45 |
--------------------------------------------------------------------------------
/xs/src/Zip/ZipArchive.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ZipArchive.hpp"
3 |
4 | namespace Slic3r {
5 |
6 | ZipArchive::ZipArchive (std::string zip_archive_name, char zip_mode) : archive(mz_zip_archive()), zip_name(zip_archive_name), mode(zip_mode), stats(0), finalized(false)
7 | {
8 | // Initialize the miniz zip archive struct.
9 | memset(&archive, 0, sizeof(archive));
10 |
11 | if( mode == 'W'){
12 | stats = mz_zip_writer_init_file(&archive, zip_name.c_str(), 0);
13 | } else if (mode == 'R') {
14 | stats = mz_zip_reader_init_file(&archive, zip_name.c_str(), 0);
15 | } else {
16 | std::cout << "Error:: Unknown zip mode" << std::endl;
17 | }
18 | }
19 |
20 | mz_bool
21 | ZipArchive::z_stats()
22 | {
23 | return stats;
24 | }
25 |
26 | mz_bool
27 | ZipArchive::add_entry (std::string entry_path, std::string file_path)
28 | {
29 | stats = 0;
30 | // Check if it's in the write mode.
31 | if(mode != 'W')
32 | return stats;
33 | stats = mz_zip_writer_add_file(&archive, entry_path.c_str(), file_path.c_str(), nullptr, 0, ZIP_DEFLATE_COMPRESSION);
34 | return stats;
35 | }
36 |
37 | mz_bool
38 | ZipArchive::extract_entry (std::string entry_path, std::string file_path)
39 | {
40 | stats = 0;
41 | // Check if it's in the read mode.
42 | if (mode != 'R')
43 | return stats;
44 | stats = mz_zip_reader_extract_file_to_file(&archive, entry_path.c_str(), file_path.c_str(), 0);
45 | return stats;
46 | }
47 |
48 | mz_bool
49 | ZipArchive::finalize()
50 | {
51 | stats = 0;
52 | // Finalize the archive and end writing if it's in the write mode.
53 | if(mode == 'W') {
54 | stats = mz_zip_writer_finalize_archive(&archive);
55 | stats |= mz_zip_writer_end(&archive);
56 | } else if (mode == 'R'){
57 | stats = mz_zip_reader_end(&archive);
58 | }
59 | if(stats)
60 | finalized = true;
61 | return stats;
62 | }
63 |
64 | ZipArchive::~ZipArchive() {
65 | if(!finalized)
66 | this->finalize();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/xs/src/Zip/ZipArchive.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SLIC3R_ZIPARCHIVE_H
2 | #define SLIC3R_ZIPARCHIVE_H
3 |
4 | #define MINIZ_HEADER_FILE_ONLY
5 | #define ZIP_DEFLATE_COMPRESSION 8
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | namespace Slic3r {
12 |
13 | /// A zip wrapper for Miniz lib.
14 | class ZipArchive
15 | {
16 | public:
17 |
18 | /// Create a zip archive.
19 | /// \param zip_archive_name string the name of the zip file.
20 | /// \param zip_mode char the zip archive mode ('R' means read mode, 'W' means write mode). you cannot change the mode for the current object.
21 | ZipArchive(std::string zip_archive_name, char zip_mode);
22 |
23 | /// Get the status of the previous operation applied on the zip_archive.
24 | /// \return mz_bool 0: failure 1: success.
25 | mz_bool z_stats();
26 |
27 | /// Add a file to the current zip archive.
28 | /// \param entry_path string the path of the entry in the zip archive.
29 | /// \param file_path string the path of the file in the disk.
30 | /// \return mz_bool 0: failure 1: success.
31 | mz_bool add_entry (std::string entry_path, std::string file_path);
32 |
33 | /// Extract a zip entry to a file on the disk.
34 | /// \param entry_path string the path of the entry in the zip archive.
35 | /// \param file_path string the path of the file in the disk.
36 | /// \return mz_bool 0: failure 1: success.
37 | mz_bool extract_entry (std::string entry_path, std::string file_path);
38 |
39 | /// Finalize the archive and free any allocated memory.
40 | /// \return mz_bool 0: failure 1: success.
41 | mz_bool finalize();
42 |
43 | ~ZipArchive();
44 |
45 | private:
46 | mz_zip_archive archive; ///< Miniz zip archive struct.
47 | const std::string zip_name; ///< The zip file name.
48 | const char mode; ///< The zip mode either read or write.
49 | mz_bool stats; ///< The status of the recently executed operation on the zip archive.
50 | bool finalized; ///< Whether the zip archive is finalized or not. Used during the destructor of the object.
51 |
52 | };
53 |
54 | }
55 |
56 | #endif //SLIC3R_ZIPARCHIVE_H
57 |
--------------------------------------------------------------------------------
/xs/src/boost/nowide/config.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 | //
4 | // Distributed under the Boost Software License, Version 1.0. (See
5 | // accompanying file LICENSE_1_0.txt or copy at
6 | // http://www.boost.org/LICENSE_1_0.txt)
7 | //
8 | #ifndef BOOST_NOWIDE_CONFIG_HPP_INCLUDED
9 | #define BOOST_NOWIDE_CONFIG_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #ifndef BOOST_SYMBOL_VISIBLE
14 | # define BOOST_SYMBOL_VISIBLE
15 | #endif
16 |
17 | #ifdef BOOST_HAS_DECLSPEC
18 | # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
19 | # ifdef BOOST_NOWIDE_SOURCE
20 | # define BOOST_NOWIDE_DECL BOOST_SYMBOL_EXPORT
21 | # else
22 | # define BOOST_NOWIDE_DECL BOOST_SYMBOL_IMPORT
23 | # endif // BOOST_NOWIDE_SOURCE
24 | # endif // DYN_LINK
25 | #endif // BOOST_HAS_DECLSPEC
26 |
27 | #ifndef BOOST_NOWIDE_DECL
28 | # define BOOST_NOWIDE_DECL
29 | #endif
30 |
31 | //
32 | // Automatically link to the correct build variant where possible.
33 | //
34 | #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_NOWIDE_NO_LIB) && !defined(BOOST_NOWIDE_SOURCE)
35 | //
36 | // Set the name of our library, this will get undef'ed by auto_link.hpp
37 | // once it's done with it:
38 | //
39 | #define BOOST_LIB_NAME boost_nowide
40 | //
41 | // If we're importing code from a dll, then tell auto_link.hpp about it:
42 | //
43 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
44 | # define BOOST_DYN_LINK
45 | #endif
46 | //
47 | // And include the header that does the work:
48 | //
49 | #include
50 | #endif // auto-linking disabled
51 |
52 |
53 | #endif // boost/nowide/config.hpp
54 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
--------------------------------------------------------------------------------
/xs/src/boost/nowide/cstdlib.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 | //
4 | // Distributed under the Boost Software License, Version 1.0. (See
5 | // accompanying file LICENSE_1_0.txt or copy at
6 | // http://www.boost.org/LICENSE_1_0.txt)
7 | //
8 | #ifndef BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
9 | #define BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
10 |
11 | #include
12 | #include
13 |
14 | #endif
15 | ///
16 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
17 |
--------------------------------------------------------------------------------
/xs/src/boost/nowide/integration/filesystem.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 | //
4 | // Distributed under the Boost Software License, Version 1.0. (See
5 | // accompanying file LICENSE_1_0.txt or copy at
6 | // http://www.boost.org/LICENSE_1_0.txt)
7 | //
8 | #ifndef BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
9 | #define BOOST_NOWIDE_INTEGRATION_FILESYSTEM_HPP_INCLUDED
10 |
11 | #include
12 | #include
13 | namespace boost {
14 | namespace nowide {
15 | ///
16 | /// Instal utf8_codecvt facet into boost::filesystem::path such all char strings are interpreted as utf-8 strings
17 | ///
18 | inline void nowide_filesystem()
19 | {
20 | std::locale tmp = std::locale(std::locale(),new boost::nowide::utf8_codecvt());
21 | boost::filesystem::path::imbue(tmp);
22 | }
23 | } // nowide
24 | } // boost
25 |
26 | #endif
27 | ///
28 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
29 |
--------------------------------------------------------------------------------
/xs/src/boost/nowide/system.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 | //
4 | // Distributed under the Boost Software License, Version 1.0. (See
5 | // accompanying file LICENSE_1_0.txt or copy at
6 | // http://www.boost.org/LICENSE_1_0.txt)
7 | //
8 | #ifndef BOOST_NOWIDE_CSTDLIB_HPP
9 | #define BOOST_NOWIDE_CSTDLIB_HPP
10 |
11 | #include
12 | #include
13 | #include
14 | namespace boost {
15 | namespace nowide {
16 |
17 | #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
18 |
19 | using ::system;
20 |
21 | #else // Windows
22 |
23 | ///
24 | /// Same as std::system but cmd is UTF-8.
25 | ///
26 | /// If the input is not valid UTF-8, -1 returned and errno set to EINVAL
27 | ///
28 | inline int system(char const *cmd)
29 | {
30 | if(!cmd)
31 | return _wsystem(0);
32 | wstackstring wcmd;
33 | if(!wcmd.convert(cmd)) {
34 | errno = EINVAL;
35 | return -1;
36 | }
37 | return _wsystem(wcmd.c_str());
38 | }
39 |
40 | #endif
41 | } // nowide
42 | } // namespace boost
43 |
44 | #endif
45 | ///
46 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
47 |
--------------------------------------------------------------------------------
/xs/src/boost/nowide/windows.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2012 Artyom Beilis (Tonkikh)
3 | //
4 | // Distributed under the Boost Software License, Version 1.0. (See
5 | // accompanying file LICENSE_1_0.txt or copy at
6 | // http://www.boost.org/LICENSE_1_0.txt)
7 | //
8 | #ifndef BOOST_NOWIDE_WINDOWS_HPP_INCLUDED
9 | #define BOOST_NOWIDE_WINDOWS_HPP_INCLUDED
10 |
11 | #include
12 |
13 | #ifdef BOOST_NOWIDE_USE_WINDOWS_H
14 | #include
15 | #else
16 |
17 | //
18 | // These are function prototypes... Allow to to include windows.h
19 | //
20 | extern "C" {
21 |
22 | __declspec(dllimport) wchar_t* __stdcall GetEnvironmentStringsW(void);
23 | __declspec(dllimport) int __stdcall FreeEnvironmentStringsW(wchar_t *);
24 | __declspec(dllimport) wchar_t* __stdcall GetCommandLineW(void);
25 | __declspec(dllimport) wchar_t** __stdcall CommandLineToArgvW(wchar_t const *,int *);
26 | __declspec(dllimport) unsigned long __stdcall GetLastError();
27 | __declspec(dllimport) void* __stdcall LocalFree(void *);
28 | __declspec(dllimport) int __stdcall SetEnvironmentVariableW(wchar_t const *,wchar_t const *);
29 | __declspec(dllimport) unsigned long __stdcall GetEnvironmentVariableW(wchar_t const *,wchar_t *,unsigned long);
30 |
31 | }
32 |
33 | #endif
34 |
35 |
36 |
37 | #endif
38 | ///
39 | // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
40 |
--------------------------------------------------------------------------------
/xs/src/clipper.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Zip-o-mat/Slic3r/f898061a448f00545ccef24e8ac8b037e1d44867/xs/src/clipper.cpp
--------------------------------------------------------------------------------
/xs/src/expat/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
2 | Copyright (c) 2001-2016 Expat maintainers
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the
6 | "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish,
8 | distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included
13 | in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/xs/src/expat/ascii.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 | See the file COPYING for copying permission.
3 | */
4 |
5 | #define ASCII_A 0x41
6 | #define ASCII_B 0x42
7 | #define ASCII_C 0x43
8 | #define ASCII_D 0x44
9 | #define ASCII_E 0x45
10 | #define ASCII_F 0x46
11 | #define ASCII_G 0x47
12 | #define ASCII_H 0x48
13 | #define ASCII_I 0x49
14 | #define ASCII_J 0x4A
15 | #define ASCII_K 0x4B
16 | #define ASCII_L 0x4C
17 | #define ASCII_M 0x4D
18 | #define ASCII_N 0x4E
19 | #define ASCII_O 0x4F
20 | #define ASCII_P 0x50
21 | #define ASCII_Q 0x51
22 | #define ASCII_R 0x52
23 | #define ASCII_S 0x53
24 | #define ASCII_T 0x54
25 | #define ASCII_U 0x55
26 | #define ASCII_V 0x56
27 | #define ASCII_W 0x57
28 | #define ASCII_X 0x58
29 | #define ASCII_Y 0x59
30 | #define ASCII_Z 0x5A
31 |
32 | #define ASCII_a 0x61
33 | #define ASCII_b 0x62
34 | #define ASCII_c 0x63
35 | #define ASCII_d 0x64
36 | #define ASCII_e 0x65
37 | #define ASCII_f 0x66
38 | #define ASCII_g 0x67
39 | #define ASCII_h 0x68
40 | #define ASCII_i 0x69
41 | #define ASCII_j 0x6A
42 | #define ASCII_k 0x6B
43 | #define ASCII_l 0x6C
44 | #define ASCII_m 0x6D
45 | #define ASCII_n 0x6E
46 | #define ASCII_o 0x6F
47 | #define ASCII_p 0x70
48 | #define ASCII_q 0x71
49 | #define ASCII_r 0x72
50 | #define ASCII_s 0x73
51 | #define ASCII_t 0x74
52 | #define ASCII_u 0x75
53 | #define ASCII_v 0x76
54 | #define ASCII_w 0x77
55 | #define ASCII_x 0x78
56 | #define ASCII_y 0x79
57 | #define ASCII_z 0x7A
58 |
59 | #define ASCII_0 0x30
60 | #define ASCII_1 0x31
61 | #define ASCII_2 0x32
62 | #define ASCII_3 0x33
63 | #define ASCII_4 0x34
64 | #define ASCII_5 0x35
65 | #define ASCII_6 0x36
66 | #define ASCII_7 0x37
67 | #define ASCII_8 0x38
68 | #define ASCII_9 0x39
69 |
70 | #define ASCII_TAB 0x09
71 | #define ASCII_SPACE 0x20
72 | #define ASCII_EXCL 0x21
73 | #define ASCII_QUOT 0x22
74 | #define ASCII_AMP 0x26
75 | #define ASCII_APOS 0x27
76 | #define ASCII_MINUS 0x2D
77 | #define ASCII_PERIOD 0x2E
78 | #define ASCII_COLON 0x3A
79 | #define ASCII_SEMI 0x3B
80 | #define ASCII_LT 0x3C
81 | #define ASCII_EQUALS 0x3D
82 | #define ASCII_GT 0x3E
83 | #define ASCII_LSQB 0x5B
84 | #define ASCII_RSQB 0x5D
85 | #define ASCII_UNDERSCORE 0x5F
86 | #define ASCII_LPAREN 0x28
87 | #define ASCII_RPAREN 0x29
88 | #define ASCII_FF 0x0C
89 | #define ASCII_SLASH 0x2F
90 | #define ASCII_HASH 0x23
91 | #define ASCII_PIPE 0x7C
92 | #define ASCII_COMMA 0x2C
93 |
--------------------------------------------------------------------------------
/xs/src/expat/asciitab.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 | See the file COPYING for copying permission.
3 | */
4 |
5 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
6 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
7 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
8 | /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
9 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
10 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
11 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
12 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
13 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
14 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
15 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
16 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
17 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
18 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
19 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
20 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
21 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
22 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
23 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
24 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
25 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
26 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
27 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
28 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
29 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
30 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
31 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
32 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
33 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
34 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
35 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
36 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
37 |
--------------------------------------------------------------------------------
/xs/src/expat/expat_config.h:
--------------------------------------------------------------------------------
1 | /*================================================================
2 | ** Copyright 2000, Clark Cooper
3 | ** All rights reserved.
4 | **
5 | ** This is free software. You are permitted to copy, distribute, or modify
6 | ** it under the terms of the MIT/X license (contained in the COPYING file
7 | ** with this distribution.)
8 | */
9 |
10 | #ifndef EXPATCONFIG_H
11 | #define EXPATCONFIG_H
12 |
13 | #include
14 | #include
15 |
16 | #define XML_NS 1
17 | #define XML_DTD 1
18 | #define XML_CONTEXT_BYTES 1024
19 |
20 | /* we will assume all Windows platforms are little endian */
21 | #define BYTEORDER 1234
22 |
23 | /* Windows has memmove() available. */
24 | #define HAVE_MEMMOVE
25 |
26 | #ifdef WIN32
27 | #define WIN32_LEAN_AND_MEAN
28 | #include
29 | #undef WIN32_LEAN_AND_MEAN
30 | #else
31 | #endif
32 |
33 | #endif /* ifndef EXPATCONFIG_H */
34 |
--------------------------------------------------------------------------------
/xs/src/expat/iasciitab.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 | See the file COPYING for copying permission.
3 | */
4 |
5 | /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
6 | /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
7 | /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
8 | /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
9 | /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
10 | /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
11 | /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
12 | /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
13 | /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
14 | /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
15 | /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
16 | /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
17 | /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
18 | /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
19 | /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
20 | /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
21 | /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
22 | /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
23 | /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
24 | /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
25 | /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
26 | /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
27 | /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
28 | /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
29 | /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
30 | /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
31 | /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
32 | /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
33 | /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
34 | /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
35 | /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
36 | /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
37 | /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
38 |
--------------------------------------------------------------------------------
/xs/src/expat/latin1tab.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 | See the file COPYING for copying permission.
3 | */
4 |
5 | /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
6 | /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
7 | /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
8 | /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
9 | /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
10 | /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
11 | /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
12 | /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
13 | /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
14 | /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
15 | /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
16 | /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
17 | /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
18 | /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
19 | /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
20 | /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
21 | /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
22 | /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
23 | /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
24 | /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
25 | /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
26 | /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
27 | /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
28 | /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
29 | /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
30 | /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
31 | /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
32 | /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
33 | /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
34 | /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
35 | /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
36 | /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
37 |
--------------------------------------------------------------------------------
/xs/src/expat/utf8tab.h:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
2 | See the file COPYING for copying permission.
3 | */
4 |
5 |
6 | /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
7 | /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
8 | /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
9 | /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
10 | /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
11 | /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
12 | /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
13 | /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
14 | /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
15 | /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
16 | /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
17 | /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
18 | /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
19 | /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
20 | /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
21 | /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
22 | /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
23 | /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
24 | /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
25 | /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
26 | /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
27 | /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
28 | /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
29 | /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
30 | /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
31 | /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
32 | /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
33 | /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
34 | /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
35 | /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
36 | /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
37 | /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
38 |
--------------------------------------------------------------------------------
/xs/src/expat/xmltok_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
3 | See the file COPYING for copying permission.
4 | */
5 |
6 | enum {
7 | BT_NONXML,
8 | BT_MALFORM,
9 | BT_LT,
10 | BT_AMP,
11 | BT_RSQB,
12 | BT_LEAD2,
13 | BT_LEAD3,
14 | BT_LEAD4,
15 | BT_TRAIL,
16 | BT_CR,
17 | BT_LF,
18 | BT_GT,
19 | BT_QUOT,
20 | BT_APOS,
21 | BT_EQUALS,
22 | BT_QUEST,
23 | BT_EXCL,
24 | BT_SOL,
25 | BT_SEMI,
26 | BT_NUM,
27 | BT_LSQB,
28 | BT_S,
29 | BT_NMSTRT,
30 | BT_COLON,
31 | BT_HEX,
32 | BT_DIGIT,
33 | BT_NAME,
34 | BT_MINUS,
35 | BT_OTHER, /* known not to be a name or name start character */
36 | BT_NONASCII, /* might be a name or name start character */
37 | BT_PERCNT,
38 | BT_LPAR,
39 | BT_RPAR,
40 | BT_AST,
41 | BT_PLUS,
42 | BT_COMMA,
43 | BT_VERBAR
44 | };
45 |
46 | #include
47 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/BridgeDetector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef slic3r_BridgeDetector_hpp_
2 | #define slic3r_BridgeDetector_hpp_
3 |
4 | #include "libslic3r.h"
5 | #include "ExPolygon.hpp"
6 | #include "ExPolygonCollection.hpp"
7 | #include
8 |
9 | namespace Slic3r {
10 |
11 | class BridgeDetector {
12 | public:
13 | /// The non-grown hole.
14 | ExPolygon expolygon;
15 | /// Lower slices, all regions.
16 | ExPolygonCollection lower_slices;
17 | /// Scaled extrusion width of the infill.
18 | coord_t extrusion_width;
19 | /// Angle resolution for the brute force search of the best bridging angle.
20 | double resolution;
21 | /// The final optimal angle.
22 | double angle;
23 |
24 | BridgeDetector(const ExPolygon &_expolygon, const ExPolygonCollection &_lower_slices, coord_t _extrusion_width);
25 | bool detect_angle();
26 | Polygons coverage() const;
27 | Polygons coverage(double angle) const;
28 |
29 | /// Return the bridge edges that are not currently supported but would permit use of the supplied
30 | /// bridge angle if it was supported.
31 | Polylines unsupported_edges(double angle = -1) const;
32 |
33 | private:
34 | /// Open lines representing the supporting edges.
35 | Polylines _edges;
36 | /// Closed polygons representing the supporting areas.
37 | ExPolygons _anchors;
38 |
39 | class BridgeDirection {
40 | public:
41 | BridgeDirection(double a = -1.) : angle(a), coverage(0.), max_length(0.) {}
42 | /// the best direction is the one causing most lines to be bridged (thus most coverage)
43 | bool operator<(const BridgeDirection &other) const {
44 | // Initial sort by coverage only - comparator must obey strict weak ordering
45 | return this->coverage > other.coverage;
46 | };
47 | double angle;
48 | double coverage;
49 | double max_length;
50 | };
51 | };
52 |
53 | }
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/ConditionalGCode.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | * https://github.com/alexrj/Slic3r/wiki/Conditional-Gcode-Syntax-Spec
3 | *
4 | */
5 |
6 | #ifndef slic3r_ConditionalGcode_hpp_
7 | #define slic3r_ConditionalGcode_hpp_
8 |
9 | #include
10 | #include
11 | #include
12 |
13 |
14 | // Valid start tokens
15 | // {, {if
16 | //
17 | // Valid end tokens
18 | // }
19 | //
20 | // Special case:
21 | //
22 | // {if is special, it indicates that the rest of the line is dropped (ignored) if
23 | // it evaluates to False/0.
24 |
25 | namespace Slic3r {
26 |
27 | /// Recursive expression parser. Offloads mathematics to exprtk.
28 | /// Precondition: All strings inside {} are able to be understood by exprtk (and thus parsed to a number).
29 | /// Starts from the end of the string and works from the inside out.
30 | /// Any statements that resolve to {if0} will remove everything on the same line.
31 | std::string expression(const std::string& input, const int depth = 0);
32 |
33 | /// External access function to begin replac
34 | std::string apply_math(const std::string& input);
35 |
36 | }
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/ExPolygonCollection.hpp:
--------------------------------------------------------------------------------
1 | #ifndef slic3r_ExPolygonCollection_hpp_
2 | #define slic3r_ExPolygonCollection_hpp_
3 |
4 | #include "libslic3r.h"
5 | #include "ExPolygon.hpp"
6 | #include "Line.hpp"
7 | #include "Polyline.hpp"
8 |
9 | namespace Slic3r {
10 |
11 | class ExPolygonCollection;
12 | typedef std::vector ExPolygonCollections;
13 |
14 | class ExPolygonCollection
15 | {
16 | public:
17 | ExPolygons expolygons;
18 |
19 | ExPolygonCollection() {};
20 | ExPolygonCollection(const ExPolygon &expolygon);
21 | ExPolygonCollection(const ExPolygons &expolygons) : expolygons(expolygons) {};
22 | operator Points() const;
23 | operator Polygons() const;
24 | operator ExPolygons&();
25 | void scale(double factor);
26 | void translate(double x, double y);
27 | void rotate(double angle, const Point ¢er);
28 | template bool contains(const T &item) const;
29 | bool contains_b(const Point &point) const;
30 | void simplify(double tolerance);
31 | Polygon convex_hull() const;
32 | Lines lines() const;
33 | Polygons contours() const;
34 | Polygons holes() const;
35 | void append(const ExPolygons &expolygons);
36 | };
37 |
38 | inline ExPolygonCollection&
39 | operator <<(ExPolygonCollection &coll, const ExPolygons &expolygons) {
40 | coll.append(expolygons);
41 | return coll;
42 | };
43 |
44 | }
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/Extruder.hpp:
--------------------------------------------------------------------------------
1 | #ifndef slic3r_Extruder_hpp_
2 | #define slic3r_Extruder_hpp_
3 |
4 | #include "libslic3r.h"
5 | #include "Point.hpp"
6 | #include "PrintConfig.hpp"
7 |
8 | namespace Slic3r {
9 |
10 | class Extruder
11 | {
12 | public:
13 | /// ID of current object.
14 | unsigned int id;
15 | double E;
16 | double absolute_E;
17 | double retracted;
18 | double restart_extra;
19 | double e_per_mm3;
20 | double retract_speed_mm_min;
21 |
22 | Extruder(unsigned int id, GCodeConfig *config);
23 | virtual ~Extruder() {}
24 | void reset();
25 | /// Calculate the amount extruded for relative or absolute moves.
26 | double extrude(double dE);
27 | double retract(double length, double restart_extra);
28 | double unretract();
29 | double e_per_mm(double mm3_per_mm) const;
30 | double extruded_volume() const;
31 |
32 | /// Calculate amount of filament used for current Extruder object.
33 | double used_filament() const;
34 |
35 | /// Retrieve the filament diameter for this Extruder from config.
36 | double filament_diameter() const;
37 | /// Retrieve the filament density for this Extruder from config.
38 | double filament_density() const;
39 | /// Retrieve the filament cost for this Extruder from config.
40 | double filament_cost() const;
41 | /// Retrieve the extrustion multiplier for this Extruder from config.
42 | double extrusion_multiplier() const;
43 | double retract_length() const;
44 | double retract_lift() const;
45 | int retract_speed() const;
46 | double retract_restart_extra() const;
47 | double retract_length_toolchange() const;
48 | double retract_restart_extra_toolchange() const;
49 |
50 | private:
51 | GCodeConfig *config;
52 | };
53 |
54 | }
55 |
56 | #endif
57 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/ExtrusionEntityCollection.hpp:
--------------------------------------------------------------------------------
1 | #ifndef slic3r_ExtrusionEntityCollection_hpp_
2 | #define slic3r_ExtrusionEntityCollection_hpp_
3 |
4 | #include "libslic3r.h"
5 | #include "ExtrusionEntity.hpp"
6 | #include "Polyline.hpp"
7 |
8 | namespace Slic3r {
9 |
10 | class ExtrusionEntityCollection : public ExtrusionEntity
11 | {
12 | public:
13 | ExtrusionEntityCollection* clone() const;
14 | ExtrusionEntitiesPtr entities; // we own these entities
15 | std::vector orig_indices; // handy for XS
16 | bool no_sort;
17 | ExtrusionEntityCollection(): no_sort(false) {};
18 | ExtrusionEntityCollection(const ExtrusionEntityCollection &collection);
19 | ExtrusionEntityCollection(const ExtrusionPaths &paths);
20 | ExtrusionEntityCollection& operator= (const ExtrusionEntityCollection &other);
21 | ~ExtrusionEntityCollection();
22 | operator ExtrusionPaths() const;
23 |
24 | bool is_collection() const {
25 | return true;
26 | };
27 | bool can_reverse() const {
28 | return !this->no_sort;
29 | };
30 | bool empty() const {
31 | return this->entities.empty();
32 | };
33 | void clear();
34 | void swap (ExtrusionEntityCollection &c);
35 | void append(const ExtrusionEntity &entity);
36 | void append(const ExtrusionEntitiesPtr &entities);
37 | void append(const ExtrusionPaths &paths);
38 | void append(const Polylines &polylines, const ExtrusionPath &templ);
39 | void replace(size_t i, const ExtrusionEntity &entity);
40 | void remove(size_t i);
41 | ExtrusionEntityCollection chained_path(bool no_reverse = false, std::vector* orig_indices = NULL) const;
42 | void chained_path(ExtrusionEntityCollection* retval, bool no_reverse = false, std::vector* orig_indices = NULL) const;
43 | void chained_path_from(Point start_near, ExtrusionEntityCollection* retval, bool no_reverse = false, std::vector* orig_indices = NULL) const;
44 | void reverse();
45 | Point first_point() const;
46 | Point last_point() const;
47 | Polygons grow() const;
48 | size_t items_count() const;
49 | void flatten(ExtrusionEntityCollection* retval) const;
50 | ExtrusionEntityCollection flatten() const;
51 | double min_mm3_per_mm() const;
52 | Polyline as_polyline() const {
53 | CONFESS("Calling as_polyline() on a ExtrusionEntityCollection");
54 | return Polyline();
55 | };
56 | };
57 |
58 | }
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/xs/src/libslic3r/Fill/Fill3DHoneycomb.hpp:
--------------------------------------------------------------------------------
1 | #ifndef slic3r_Fill3DHoneycomb_hpp_
2 | #define slic3r_Fill3DHoneycomb_hpp_
3 |
4 | #include