216 Commits

Author SHA1 Message Date
Joseph Lenox
548ce534ad added another couple tests to catch a few more expressions according to spec. 2018-04-12 20:23:47 -05:00
Joseph Lenox
7b8369d00e Adding a simple test to show that changing the skirt count invalidates the skirt step. 2018-04-03 23:04:44 -05:00
Joseph Lenox
19ea7a596a
Long retract support in marlin and repetier for FW retract. (#4108)
* For reprap (really Marlin) or Repetier flavors and a toolchange retract, produce G10 S1 instead of G10.

Also refactored comments (were getting eaten by fw retract)

* Fixed tests to check for correct retract gcode output.

* Better reference to scalar.

* Added config checks for if fw tool retracts are in place and firmware is repetier/marlin, disable the advanced option.

* Disable z lift if firmware retraction is enabled.

* With gcode comments on, indicates which extruder Slic3r thinks it is retracting/unretracting.
2018-01-08 15:08:30 -06:00
Joseph Lenox
8ca6171a0a Fix test and really emit {} on parse failure. 2017-11-06 22:03:27 -06:00
Joseph Lenox
f7e6d53e06 Allow the use of escaped open/close brackets so that brackets may be emitted in the output (does not permit use of {} inside evaluations).
Fixes behavior to emit brackets on failure.

Fixes #4180
2017-11-06 22:00:21 -06:00
Joseph Lenox
f366700b44 Emit original string on failure to parse. 2017-11-06 21:11:17 -06:00
Joseph Lenox
202a90ff90 Math evaluation in gcode (#4157)
* Prototype gcode infix math, very basic.

* Adding exprtk math parser library, header only.
@ArashPartow
https://github.com/ArashPartow/exprtk@4e1315a87dcc99a1ccad21fae1def0c2d4913c0f

* Now evaluating strings with exprtk, only support no variables in input
strings.

* Moved executable code to cpp file, stubbed out xsp and let the testing begin...

* Added conditional gcode parser into export path, added tests.

* Added one more test to ensure that {if0} only removes up to newlines.

* Test failure to parse

* Add some compiler flags to compile out stuff from exprtk

* Fix debug messages to be more specific, don't use deleted stringstream = method.

* Trade expression speed for apparently around 50MB of object size.

* Removed an extra trim that was breaking existing tests.

* fix test

Fixes #3390
2017-10-20 21:40:05 -05:00
Ahmed Samir
5cd9ecbe57 [GSoC 2017] Support 3MF Format Read/Write. (#4046)
* Include Miniz library in xs/src/miniz  and update CMakeLists.txt in /src

* Save porgress before merging from Slic3r upstream

* Add CLI --export-3mf option.

* Create the TMF Class.

* call IO::TMF:write function with the read model and the output file in slic3r.cpp
Fix miniz.c error:
 * Miniz source functions were included more than once (once during TMF.cpp and once during compiling miniz.c in /xs/src/miniz.
 * Miniz is a header file library.
 * Solution was to add #define MINIZ_HEADER_FILE_ONLY to include the header part of the single header library miniz.c.

* - Create a Zip archive contating a 3dmodel.model file conatining a basic string.
- Remove #define #define MINIZ_HEADER_FILE_ONLY in the previous commit ( It's not the solution)

* Write Model metadata element to the 3MF zip file.

* Renaming miniz.c to miniz.h,  if you want to include it in other file use #define MINIZ_HEADER_FILE_ONLY before including it.

* Adding zip lib as a wrapper

* Adding zip lib files

* Fix CMakeLists.txt zip library error:
Add zip lib to target_link_libraries.

* Add 3MF Read/Write Structure.
I think this makes TMF read/write more modular.

* Fix some errors in TMF.cpp

* Write ModelMaterial according to 3MF core specification.
fix some typos and variable names.

* Add 3MF Types and OPC relationships.
* Write types in "[Content_Types].xml" at /
* Create "_rels" folder at /

* Write for each Object its mesh vertices element in 3MF Document.

* Write Model Volumes of each object in the 3MF Document.
* write <triangles> element representing the volumes of each object.

* * Refactoring removed Camel Case style.
* Adding ModelObject part number attribute (Specific to the new 3MF format).

* Write 3MF Relationships in the zip archive.

* * Remove the first extension from the exported file name.

* Add partnumber to the constructor.

* Fix ContentTypes.xml file causing 3D Builder not to load the file.
* xmlns schema link added to < Types > element.

* * Write Slic3r metadata version.
* Write ModelMaterials custom config data.

* * Write ModelObject Slic3r custom configs data.
* Some Refactoring.

* * Write ModelVolume Sli3r custom configs to the 3MF Document.

* * Write ModelInstances to the 3MF Document and small refactoring

* * Fix ModelInstance transformation matrix in < build > element. The problem was that 3MF 3d matrices were row major matrices.

* Some Refactoring:
* Add namspaces as constant map<string, string> carrying name of namspace and the link to the namespace.

* *Fix std::map namespaces. I was using [] operator to access the map values but according to c++11 I must use .at(key) to compile.

* * Write colorgroup elements in Material Extension to 3MF core specs:
	* Created color_group attribute in Model class.
	* Created material_group attribute in ModelMaterial class. It's by default 0 whuch means basematerial or AMF read material.

* * Fix CMakeLists.txt zip target link libraries.

* Add data structure for 3MF Material Extension.

* Fix slic3r.cpp whitespace issues.

* Split TMFEditor class into TMF.hpp and TMF.cpp files

* Remove color groups attribute and put all material groups in the 3MF extension into one structure.

* Fix temprory Zip lib.
Modify TMFEditor class pivate and public memebers.

* Some Refactoring.
Make remove any extension not just the last one.

* Add a unit test case for write function.
Some refactoring

* Fix some issues found in the basic 3mf unit test case for TMF::write.

* Forget to change 2 lines in 23_3mf.t

* Some Refactoring

* Remove basename function in zip.c hoping the build pass.
Refactoring in the 23_3mf.t

* Add another test case for wrting a model containing  materials.

* Add SplitPyramid.amf test file in xs/t/amf

* Add basic TMFParserContext struct for reading 3MF XML model file.

* Add Expat handlers.

* Add member functions to TMFParserContext struc: startElement, endElement, characters and stop.

* Add 3mf extension to Model::read_from_file function
Ajust comments according to Doxygen syntax

* * ad model metadata
* Extract the 3dmodel.model file to disc.
* Read the extracted file using Expat XML er.

* Read basematerials found in the 3MF core specifications.
Fix some errors in reading metadata.
Add TMFEditor::read_model() function.

* Change material data structure to include all 3MF materials including (basematerials, m:colorgroups, etc)

* Read Object vertices.
Fix errors during reading basematerial.

* Read object mesh.

* Some Refactoring in TMFParserContext and TMF::Editor

* Read Objects (Objects with meshes, and objects containing other objects -components-)

* Read Build items (ModelInstances) without applying transformations yet.

* * Read scale and translations values from the transformation affine matrix found in the component tag.
* Some refactoring

* Get the rotaion Euler angles from the transformation matrix.

* Fix to get_transformation

* Fix metadata lost due to not copying them in the copy constructor.

* Read Slic3r custom config keys for ModelObjects.
Modify write Slic3r custom configs for ModelObject

* Read Slic3r custom configs of ModelVolumes.

* Refactor applying tranformation matri

* Fix in  reading 3mf format where wrong objects are deleted from the model

* Fix in 3MF read: When reading component tags.
When adding a component to the current object we first copy the object refered by objectid in component tag, then apply transformation to the copied object
then get the mesh of that object and finally delete this object copy and add that mesh to the current object.

* Write model metadata in descending order to make title appear first.

* Refactoring: Remove all assertions in 3MF read and replace it with TMFParserContext::stop() as if assertion fails the extracted 3dmodel.model file won't be deleted.

* Read basematerials in the original model materials map.
Remove the added model material groups.

* Fix fatal error in adding volume when reading 3MF model file.
The end offset should be equal to the size of facets minus one.

* Read color groups.

* some refactoring

* * Some fixes.

* Add model instance x, y rotations and (x,y,z) scaling.(Still working on them).

* Add translation z in the model instance.
Add x, y rotation to the model instance copy constructor.

* Fixes in writing slicer:volume tag

* Remove some todos.

* Improve write materials to adopt groups

* Some Fixes

* Some Fixes

* Read Slic3r materials custom print configs.

* Add basic test for 3mf read.

* Add another test for TMF::read().

* Revert change in slic3r.pl file and removed .DS_store files

* Use initialize list in TMFEditor constructor.
Add a new line in the end of slic3r.cpp

* Add partnumber to ModelObject::swap() function called by assignment operator.

* Deleted xs/t/3mf/.DS_Store

* Removed appling 3mf translation in the z_axis to the model instances.

* Add X&Y rotations, z_translation in 3D, 3D previews and layers plater. To be applied when duplicating objects, etc.

* Add the parent object part number to the split objects.

* Initialize Model metadata.
Add 2 STL test files.
Add all 3d model test files in xs/models folder.

* Add 3mf test (convert from/to STL).
Add partnumber in Model.xsp

* Changed material groups enum to scoped enums.
Fix a typo in 23_3mf.t

* Fix in 23_3mf.test.

* Include X&Y rotation angles, scaling vector in the transformation matrix in item tag.

* Add 3MF file extension to GUI.

* Fix reading slic3r:volume tag in 3mf document.

* Add X&Y rotations, scaling vecotr in the 2D platter. Those 3mf transformation parameters are applied in 2D, 3D, 3D preview and 2D toolpaths platters.

* Remove support for 3MF materials. The materials in 3mf are found at the object level and at the triangle level but not found at the volume level. They are not really useful in our case.

* Remove some warnings and add transformation matrix test.

* Remove headers included for IDE suggestions

* Some enhancements

* Some enhancements

* Fix a bug.

* Remove hardcoded Slic3r version & some enhancements.

* Add another test to 3mf and some enhancements.

* Remove models which became not used in 3mf tests.

* Small change in apply_transformation for model instance in tmf.cpp.

* Some Refactoring to TMF.cpp

* Remove size_t in for loops and use const auto ModelObject or ModelVolume in TMFEditor::write()
Some refactoring.

* Use nullptr instead of NULL in TMFEditor.

* Initialize  TMFParserContext data memebers instead of calling std::vector clear() function.

* Fix a typo caused by refactoring

* Add Export plate with modifiers as 3MF and Export object with modifiers as 3MF options to Slic3r GUI.

* * Remove zip library.
* Add Slic3r::ZipArchive class to handle creating zip files.

* Add extract_entry function to ZipArchive class

* * Modify TMF::write to adapt the new zip wrapper.
* Improvements in ZipArchive.

* * Improve TMFEditor:write by removing to_string template function aw we are using now ofstream.

* * Split ZipArchive class to .cpp and .hpp
* Add Doxygen documentation to ZipArchive class.
* Update MANIFEST file/
* Update CMakeLists.txt file

* * Some improvements to ZipArchive.

* Fix the failing 3MF test on windows.The problem was the end line is manipulated on windows as \r\n

* Add 3mf test files to MANIFEST file.
2017-09-04 21:40:50 +02:00
Alessandro Ranellucci
8e26332867 Add a serialize/unserialize roundtrip in test. #3921 2017-05-01 20:02:46 +02:00
Joseph Lenox
840cd2eda0 put the exception test back to the way it was (and it PASSES :D) 2017-03-27 20:16:24 -05:00
Alessandro Ranellucci
b755e2424f Removed warning 2017-03-23 14:26:56 +01:00
Alessandro Ranellucci
90395f9394 Complete implementation of read_cli() 2017-03-18 00:48:24 +01:00
Joseph Lenox
5d10d4c02b Added a timeout to the exception test to (hopefully) fail test on broken perl instead of waiting forever. 2017-03-11 09:42:44 -06:00
Alessandro Ranellucci
69202aeeb9 Merged xs/t/*_config.t into one single .t file 2017-03-05 14:13:21 +01:00
Alessandro Ranellucci
27e456039c New --cut-grid command for cutting a mesh in multiple tiles according to a XY grid 2016-12-17 20:30:40 +01:00
Alessandro Ranellucci
f58d1d1fc5 Minor fixes to the new rectilinear implementation 2016-12-12 11:25:04 +01:00
bubnikv
4773987b0f Added "Notes" page to the filament configuration.
Added "filament_max_volumetric_speed", a cap on the maximum volumetric
extrusion role, filament specific. This is very useful when mixing
rigid filament with a soft filament.

Extended the import / export of multi-string values into configuration
values, including the test cases. Multi-line strings will be enclosed
into quotes, quotes escaped using a C-style escape sequences. Single
word strings could still be stored without quotes.

Conflicts:

	xs/src/libslic3r/Config.hpp
2016-11-24 15:58:06 +01:00
Alessandro Ranellucci
c87659fdc2 Update MANIFEST and rename t/22_config to t/23_config because we already have a 22 2016-11-23 21:12:01 +01:00
Joseph Lenox
1e37195af1 Unit test to verify whether Slic3r would hang when croaking from
a C++ exception handler. This is an unfortunate error in some
Strawberry Perl distributions.

Conflicts:
	xs/xsp/XS.xsp
2016-11-08 10:23:30 -06:00
Joseph Lenox
6736ff5fa6 Catch exception thrown when loading config files.
Thrown exception has been changed to be std::runtime_error, includes regression test (program does not crash when loading unknown keys).
Sends error/diagnostic message to std::cerr.

Addresses #3430
2016-07-19 00:31:10 -05:00
Alessandro Ranellucci
660b56acb5 Fixed type error 2016-03-26 12:21:54 +01:00
Alessandro Ranellucci
1a286fc906 Fixes and improvements to MotionPlanner, much smarter now 2015-12-21 14:46:35 +01:00
Alessandro Ranellucci
934bd43e35 More refactoring on Config XS bindings 2015-12-16 12:58:06 +01:00
Alessandro Ranellucci
3fac8cd77e Large refactoring of the Config classes 2015-12-07 19:39:49 +01:00
Alessandro Ranellucci
1bebe6097b Make test happy 2015-12-02 19:39:16 +01:00
Alessandro Ranellucci
61f0a9e4da Replace the flip word with mirror. #3060 2015-11-04 23:11:30 +01:00
Alessandro Ranellucci
b4019bb438 Ported more Slic3r::GCode methods to XS 2015-07-01 23:00:52 +02:00
Alessandro Ranellucci
ab858f320d Updated test 2015-07-01 21:02:36 +02:00
Alessandro Ranellucci
70ec433e67 Faster (but less precise) implementation of simplify_by_visibility(), since it was the bottleneck of avoid_crossing_perimeters. #2777 2015-05-18 19:28:59 +02:00
Alessandro Ranellucci
97211f35e7 More robust medial axis pruning. #2800 2015-05-13 20:50:30 +02:00
Alessandro Ranellucci
d6d7880507 Ported Slic3r::Geometry::arrange() to C++/XS 2015-04-29 19:19:07 +02:00
Alessandro Ranellucci
6cab5668e3 Restore correct ordering of concentric infill loops, preventing them from being reordered during G-code generation 2015-03-09 18:28:07 +01:00
Alessandro Ranellucci
2eca094170 Added failing test case for Clipper regression causing extra points in polyline intersection, thus crash with circular bed shape 2015-02-22 17:03:23 +01:00
Alessandro Ranellucci
edbc11477c Update to Clipper 6.2.9. Fixes #2639 2015-02-22 15:13:52 +01:00
Alessandro Ranellucci
1180a6d83f Merge pull request #2508 from strahlex/machinekit-gcode
added support Machinekit flavour GCode
2015-02-15 17:00:08 +01:00
Alessandro Ranellucci
8851dc7f23 Added failing test case for upstream Clipper issue 126 (our #2639) 2015-02-15 16:47:55 +01:00
Alessandro Ranellucci
32b8eb489c Updated Clipper to 6.2.8. This fixes several minor issues, including infill paths not being trimmed correctly. #2448 2015-02-15 16:10:04 +01:00
Alexander Rössler
d35226b889 added support Machinekit flavour GCode 2015-02-06 18:48:46 +01:00
Alessandro Ranellucci
b1f1893481 Bugfix: tangent horizontal mesh surfaces were not included in slices under rare circumstances, generating almost invalid polygons that confused Clipper and caused skipped layers. Includes regression test 2015-01-28 13:00:38 +01:00
Alessandro Ranellucci
357f10732a Added test case for a Clipper bug 2015-01-18 01:07:23 +01:00
Alessandro Ranellucci
e749f6040f New +Line::intersection_infinite() method 2015-01-16 16:25:39 +01:00
Alessandro Ranellucci
8f4cbefd0d Lots of improvements to MotionPlanner/avoid_crossing_perimeters. Smoother paths and several edge cases now handled better 2015-01-06 20:52:36 +01:00
Alessandro Ranellucci
6776d6bc00 Bugfix: a bug in Polyline::split_at() caused random loss of perimeter segments. #2495 2015-01-05 15:51:57 +01:00
Alessandro Ranellucci
d8be67c28b Bugfix: Douglas-Peucker used perpendicular distance instead of shortest distance, thus clipping more than it should. #2474 2015-01-03 15:03:53 +01:00
Alessandro Ranellucci
91bc4d8157 Bugfix: a typo caused wrong loop splitting, thus wrong ordering of perimeters having bridging parts. Includes regression test. #2258 2014-12-24 00:11:29 +01:00
Alessandro Ranellucci
9264db7ecd Removed useless thing added in e79aa2e81c3087d44c46d0fcb65cd81a42f0585d 2014-12-17 00:52:01 +01:00
Alessandro Ranellucci
e79aa2e81c New --solid-infill-extruder option. Includes a refactoring of the strategy used to order layer extrusions according to their extruder and island; toolchanges and travel moves should be more optimized now. #618 2014-12-17 00:34:00 +01:00
Alessandro Ranellucci
360dee862b Keep model objects aligned to Z = 0 in plater 2014-12-12 22:43:56 +01:00
Alessandro Ranellucci
b69caff93c Ported LayerRegion::make_slices() to XS 2014-11-09 16:24:07 +01:00
Alessandro Ranellucci
a4eef93950 Fixed minor regression 2014-11-04 21:07:18 +01:00