82 Commits

Author SHA1 Message Date
Michael Kirsch
794b3a1419 move matrix decomposition to instance class 2019-12-01 23:52:36 -06:00
Michael Kirsch
5bce2597e7 add internal trafo for undo stack 2019-12-01 23:52:36 -06:00
Michael Kirsch
1bd679dcba add public trafo to instance 2019-12-01 23:52:36 -06:00
Michael Kirsch
098d428bb0 reinstate model volume transformations 2019-12-01 23:52:36 -06:00
Michael Kirsch
ea156dab02 wrap every object transforming function to work from the centers 2019-12-01 23:52:36 -06:00
Michael Kirsch
4e00c34f45 trafo probably won't be necessary here 2019-12-01 23:52:36 -06:00
Michael Kirsch
d7c1f8bad8 add function to center around bb 2019-12-01 23:52:36 -06:00
Michael Kirsch
8b17156f1d call the now valid functions 2019-12-01 23:52:36 -06:00
Michael Kirsch
e08eaef02f remove unneeded perl binding stuff 2019-12-01 23:52:36 -06:00
Michael Kirsch
ff201b5802 make instance's trafo function use the new class 2019-12-01 23:52:36 -06:00
Michael Kirsch
8928678085 change / rewrite volume and object function 2019-12-01 23:52:36 -06:00
Michael Kirsch
63ac0a1d0c apply to trafo functions to volume, add vec to vec rotation for object 2019-12-01 23:52:36 -06:00
Michael Kirsch
c2021aa1df change some parameters from float to double 2019-12-01 23:52:36 -06:00
Michael Kirsch
6a11cf9aac remove debug prints 2019-12-01 23:52:36 -06:00
Michael Kirsch
53ed1cd992 fix some remaining bounding box calls 2019-12-01 23:52:36 -06:00
Michael Kirsch
810bff9d00 change bb-related transform functions 2019-12-01 23:52:36 -06:00
Michael Kirsch
3fedb9b37f nullptr is now default value 2019-12-01 23:52:36 -06:00
Michael Kirsch
68de2ba4b8 adapt mesh function calls 2019-12-01 23:52:36 -06:00
Michael Kirsch
b55b220efc apply function call 2019-12-01 23:52:36 -06:00
Michael Kirsch
dfee4477b3 debug prints 2019-12-01 23:52:36 -06:00
Michael Kirsch
eca35851c4 remove unused variable 2019-12-01 23:52:36 -06:00
Michael Kirsch
545aa3c57f feeble attempts to get perl working 2019-12-01 23:52:36 -06:00
Michael Kirsch
e8452befd3 make xs compilable 2019-12-01 23:52:36 -06:00
Michael Kirsch
51edd87d45 fix get mesh function 2019-12-01 23:52:36 -06:00
Michael Kirsch
3c05edd170 change object's mesh functions to get trafo'd meshes 2019-12-01 23:52:36 -06:00
Michael Kirsch
bf464572a0 change geometric operations to alter trafo 2019-12-01 23:52:36 -06:00
Michael Kirsch
44d6a7ff2b move transform function to volume class 2019-12-01 23:52:36 -06:00
Michael Kirsch
91f12b5574 implement returning trafo matrix 2019-12-01 23:52:36 -06:00
Michael Kirsch
287948a2f8 remove references to 3mf specific instance variables 2019-12-01 23:52:36 -06:00
Michael Kirsch
dd3c83b01c comment out 3mf only properties 2019-12-01 23:52:36 -06:00
Michael Kirsch
e10fd143da add trafo matrix to volumes 2019-12-01 23:52:36 -06:00
Alessandro Ranellucci
ea67f8ca4f Bugfix: Model::add_default_instances() was always return true 2018-11-25 11:55:57 -06:00
Alessandro Ranellucci
945bbc030c Fix --center, --dont-arrange, --export-* and other things 2018-11-25 11:55:57 -06:00
Alessandro Ranellucci
bb29661a90 Redesigned C++ CLI 2018-11-25 11:55:57 -06:00
Joseph Lenox
7822802550 Rearrange initializer list in constructors to match the class order. 2018-04-25 18:22:52 -05:00
Oekn5w
72db3392c8 "Reload from disk" - UI function overhaul (#4388)
* C++ backend work to support reloading modifier files

* UI update preserving configs and volumes of modifiers (those are not reloaded)

* clarifying variable names

* Setting up variables in the GUI enviroment

* Implementation of added variables in (new ModelVolume(*)) funcion

* Implementation of new reload function

* Overhaul of the reload function, also renaming of some variables

* Rewriting the main loop of the reload function, explicitly differentiating between the original file and later added parts and modifiers pointing to other files

* Whitespace cleanup

* Added dialog to choose from different reload behaviors, added hide and default option in preferences, copied volumes are matched the new object's origin translation
2018-04-23 12:04:47 -05:00
Joseph Lenox
e6c715cad2 Merge branch 'adaptive-slicing' into merge-adaptive
# Conflicts:
#	xs/src/libslic3r/Model.cpp
#	xs/src/libslic3r/Model.hpp
2017-09-24 13:39:28 -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
Florens Wasserfall
c0dfffe0ff Merge branch 'master' into adaptive-slicing 2017-06-21 15:49:24 +02:00
Samir55
1e8cd3f199 Model.hpp Doxygen Documentation (#3958)
* Documenting Model Class (Still un finished functions)

* Add Model Material Documentation

* Documenting ModelInstance

* Documenting ModelVolume

* Documenting the ModelObject Class

* Applying some enhancement to Model.hpp Documentation

* Removed some todos in the code

* Remove Todos in Model.hpp

* Fix some functions dcumentation.

* Removed todo found in Model.hpp

* Update Model.hpp

* Update Model.cpp

Put back align_instances_to_origin. Not sure why this was removed to start with.

* Update Model.xsp

put back removed function (this should be a doc-only change)

* Update Model.hpp

Re-added function that should have not been removed in a doc-only change (re: scope)
2017-06-15 21:17:20 -05:00
Joseph Lenox
9f0335b4b8 Replaced throwing strings with exception objects. Fixes #3433 2017-06-04 09:05:41 -05:00
Florens Wasserfall
57826c9262 Merge branch 'master' into adaptive-slicing 2017-04-19 09:29:23 +02:00
Florens Wasserfall
614f4d9ca4 After opening the adaptive layer dialog, trigger reslicing only if necessary 2017-04-18 08:44:18 +02:00
Alessandro Ranellucci
8f66d88320 Bugfix: inconsistent scaling when object had multiple copies in plater. #3798 2017-04-04 19:18:18 +02:00
Florens Wasserfall
f43e004f44 Merge branch 'master' into adaptive-slicing-spline
and added Spline variable to ModelObject
2017-04-03 18:01:06 +02:00
Alessandro Ranellucci
3ee628c29f Ported couple Model methods to C++ 2017-03-23 14:23:28 +01:00
Alessandro Ranellucci
bd2117d346 Align objects imported from AMF to ground. #3785 2017-03-23 14:10:41 +01:00
Alessandro Ranellucci
8560655372 Only reload the selected object and not all the objects of the input file. #3786 2017-03-21 17:34:30 +01:00
Alessandro Ranellucci
a49d82691e Only use the supplied bounding box (bed shape) as a hint when auto arranging, and revert to unconstrained arrangement on failure (still better than no arranging at all). #2725 2017-03-13 13:37:25 +01:00
Alessandro Ranellucci
22ba87c3b3 Finished porting importers and read_from_file() to C++ 2017-03-01 22:19:30 +01:00