OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
3mf.cpp File Reference
#include "../libslic3r.h"
#include "../Exception.hpp"
#include "../Model.hpp"
#include "../Utils.hpp"
#include "../LocalesUtils.hpp"
#include "../Geometry.hpp"
#include "../GCode/ThumbnailData.hpp"
#include "../Semver.hpp"
#include "../I18N.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/Slicing.hpp"
#include "libslic3r/SLA/SupportPoint.hpp"
#include "libslic3r/SLA/Hollowing.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r_version.h"
#include "libslic3r/PrintConfig.hpp"
#include "3mf.hpp"
#include <cstring>
#include <boost/spirit/home/qi/parse.hpp>
#include <boost/spirit/home/qi/numeric/int.hpp>
#include <cstdlib>
#include <boost/algorithm/string/constants.hpp>
#include <cstddef>
#include <boost/optional/optional.hpp>
#include <cassert>
#include <algorithm>
#include <exception>
#include <cstdio>
#include <iomanip>
#include <cstdint>
#include <boost/spirit/home/karma/generate.hpp>
#include <boost/spirit/home/support/common_terminals.hpp>
#include <boost/spirit/home/karma.hpp>
#include <limits>
#include <miniz.h>
#include <map>
#include <sstream>
#include <stdexcept>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/spirit/include/karma.hpp>
#include <boost/spirit/include/qi_int.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include <string>
#include <vector>
#include <utility>
#include <expat.h>
#include <Eigen/Dense>
#include "miniz_extension.hpp"
#include <fast_float/fast_float.h>

Go to the source code of this file.

Classes

class  version_error
class  Slic3r::_3MF_Base
class  Slic3r::_3MF_Importer
struct  Slic3r::_3MF_Importer::Component
struct  Slic3r::_3MF_Importer::Geometry
struct  Slic3r::_3MF_Importer::CurrentObject
struct  Slic3r::_3MF_Importer::CurrentConfig
struct  Slic3r::_3MF_Importer::Instance
class  Slic3r::_3MF_Exporter
struct  Slic3r::_3MF_Exporter::BuildItem
struct  Slic3r::_3MF_Exporter::Offsets
struct  Slic3r::_3MF_Exporter::ObjectData

Namespaces

namespace  Slic3r
 |/ Copyright (c) Prusa Research 2020 - 2023 Enrico Turri @enricoturri1966 |/ |/ PrusaSlicer is released under the terms of the AGPLv3 or higher |/

Macros

#define EXPORT_3MF_USE_SPIRIT_KARMA_FP   0
#define L(s)
 macro used to mark string used at localization, return same string
#define _(s)

Functions

const char * get_attribute_value_charptr (const char **attributes, unsigned int attributes_size, const char *attribute_key)
std::string get_attribute_value_string (const char **attributes, unsigned int attributes_size, const char *attribute_key)
float get_attribute_value_float (const char **attributes, unsigned int attributes_size, const char *attribute_key)
int get_attribute_value_int (const char **attributes, unsigned int attributes_size, const char *attribute_key)
bool get_attribute_value_bool (const char **attributes, unsigned int attributes_size, const char *attribute_key)
Slic3r::Transform3d get_transform_from_3mf_specs_string (const std::string &mat_str)
float get_unit_factor (const std::string &unit)
bool is_valid_object_type (const std::string &type)
ModelVolumeType Slic3r::type_from_string (const std::string &s)
static void Slic3r::check_painting_version (unsigned int loaded_version, unsigned int highest_supported_version, const std::string &error_msg)
static void Slic3r::reset_stream (std::stringstream &stream)
static void Slic3r::handle_legacy_project_loaded (unsigned int version_project_file, DynamicPrintConfig &config)
bool Slic3r::load_3mf (const char *path, DynamicPrintConfig &config, ConfigSubstitutionContext &config_substitutions, Model *model, bool check_version)
bool Slic3r::store_3mf (const char *path, Model *model, const DynamicPrintConfig *config, bool fullpath_sources, const ThumbnailData *thumbnail_data, bool zip64)

Variables

const unsigned int VERSION_3MF = 1
const unsigned int VERSION_3MF_COMPATIBLE = 2
const char * SLIC3RPE_3MF_VERSION = "slic3rpe:Version3mf"
const unsigned int FDM_SUPPORTS_PAINTING_VERSION = 1
const unsigned int SEAM_PAINTING_VERSION = 1
const unsigned int MM_PAINTING_VERSION = 1
const std::string SLIC3RPE_FDM_SUPPORTS_PAINTING_VERSION = "slic3rpe:FdmSupportsPaintingVersion"
const std::string SLIC3RPE_SEAM_PAINTING_VERSION = "slic3rpe:SeamPaintingVersion"
const std::string SLIC3RPE_MM_PAINTING_VERSION = "slic3rpe:MmPaintingVersion"
const std::string MODEL_FOLDER = "3D/"
const std::string MODEL_EXTENSION = ".model"
const std::string MODEL_FILE = "3D/3dmodel.model"
const std::string CONTENT_TYPES_FILE = "[Content_Types].xml"
const std::string RELATIONSHIPS_FILE = "_rels/.rels"
const std::string THUMBNAIL_FILE = "Metadata/thumbnail.png"
const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config"
const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config"
const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt"
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml"
const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt"
const std::string SLA_DRAIN_HOLES_FILE = "Metadata/Slic3r_PE_sla_drain_holes.txt"
const std::string CUSTOM_GCODE_PER_PRINT_Z_FILE = "Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml"
static constexpr const char * MODEL_TAG = "model"
static constexpr const char * RESOURCES_TAG = "resources"
static constexpr const char * OBJECT_TAG = "object"
static constexpr const char * MESH_TAG = "mesh"
static constexpr const char * VERTICES_TAG = "vertices"
static constexpr const char * VERTEX_TAG = "vertex"
static constexpr const char * TRIANGLES_TAG = "triangles"
static constexpr const char * TRIANGLE_TAG = "triangle"
static constexpr const char * COMPONENTS_TAG = "components"
static constexpr const char * COMPONENT_TAG = "component"
static constexpr const char * BUILD_TAG = "build"
static constexpr const char * ITEM_TAG = "item"
static constexpr const char * METADATA_TAG = "metadata"
static constexpr const char * CONFIG_TAG = "config"
static constexpr const char * VOLUME_TAG = "volume"
static constexpr const char * UNIT_ATTR = "unit"
static constexpr const char * NAME_ATTR = "name"
static constexpr const char * TYPE_ATTR = "type"
static constexpr const char * ID_ATTR = "id"
static constexpr const char * X_ATTR = "x"
static constexpr const char * Y_ATTR = "y"
static constexpr const char * Z_ATTR = "z"
static constexpr const char * V1_ATTR = "v1"
static constexpr const char * V2_ATTR = "v2"
static constexpr const char * V3_ATTR = "v3"
static constexpr const char * OBJECTID_ATTR = "objectid"
static constexpr const char * TRANSFORM_ATTR = "transform"
static constexpr const char * PRINTABLE_ATTR = "printable"
static constexpr const char * INSTANCESCOUNT_ATTR = "instances_count"
static constexpr const char * CUSTOM_SUPPORTS_ATTR = "slic3rpe:custom_supports"
static constexpr const char * CUSTOM_SEAM_ATTR = "slic3rpe:custom_seam"
static constexpr const char * MMU_SEGMENTATION_ATTR = "slic3rpe:mmu_segmentation"
static constexpr const char * FUZZY_SKIN_ATTR = "slic3rpe:fuzzy_skin"
static constexpr const char * KEY_ATTR = "key"
static constexpr const char * VALUE_ATTR = "value"
static constexpr const char * FIRST_TRIANGLE_ID_ATTR = "firstid"
static constexpr const char * LAST_TRIANGLE_ID_ATTR = "lastid"
static constexpr const char * OBJECT_TYPE = "object"
static constexpr const char * VOLUME_TYPE = "volume"
static constexpr const char * NAME_KEY = "name"
static constexpr const char * MODIFIER_KEY = "modifier"
static constexpr const char * VOLUME_TYPE_KEY = "volume_type"
static constexpr const char * PRECISE_SEAM_TYPE_KEY = "precise_seam_type"
static constexpr char PRECISE_SEAM_CONFIG_PREFIX [] = "precise_seam_config:"
static constexpr const char * MATRIX_KEY = "matrix"
static constexpr const char * SOURCE_FILE_KEY = "source_file"
static constexpr const char * SOURCE_OBJECT_ID_KEY = "source_object_id"
static constexpr const char * SOURCE_VOLUME_ID_KEY = "source_volume_id"
static constexpr const char * SOURCE_OFFSET_X_KEY = "source_offset_x"
static constexpr const char * SOURCE_OFFSET_Y_KEY = "source_offset_y"
static constexpr const char * SOURCE_OFFSET_Z_KEY = "source_offset_z"
static constexpr const char * SOURCE_IN_INCHES = "source_in_inches"
static constexpr const char * SOURCE_IN_METERS = "source_in_meters"
static constexpr const char * MESH_STAT_EDGES_FIXED = "edges_fixed"
static constexpr const char * MESH_STAT_DEGENERATED_FACETS = "degenerate_facets"
static constexpr const char * MESH_STAT_FACETS_REMOVED = "facets_removed"
static constexpr const char * MESH_STAT_FACETS_RESERVED = "facets_reversed"
static constexpr const char * MESH_STAT_BACKWARDS_EDGES = "backwards_edges"
const unsigned int VALID_OBJECT_TYPES_COUNT = 1
const char * VALID_OBJECT_TYPES []
const char * INVALID_OBJECT_TYPES []

Class Documentation

◆ Slic3r::_3MF_Importer::CurrentConfig

struct Slic3r::_3MF_Importer::CurrentConfig
Class Members
int object_id
int volume_id

◆ Slic3r::_3MF_Importer::ObjectMetadata

struct Slic3r::_3MF_Importer::ObjectMetadata
Collaboration diagram for Slic3r::_3MF_Importer::ObjectMetadata:
Class Members
typedef vector< VolumeMetadata > VolumeMetadataList
Class Members
MetadataList metadata
VolumeMetadataList volumes

Macro Definition Documentation

◆ _

#define _ ( s)
Value:
std::string translate(const std::string &s)
Definition I18N.hpp:18

Referenced by AuxiliaryList::AuxiliaryList(), Slic3r::BBLStatusBar::BBLStatusBar(), Slic3r::GUI::BedShapeDialog::BedShapeDialog(), Slic3r::BonjourDialog::BonjourDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::ErrorDialog::ErrorDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::IPListDialog::IPListDialog(), Slic3r::GUI::Line::Line(), Slic3r::GUI::MsgDataIncompatible::MsgDataIncompatible(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MsgUpdateSlic3r::MsgUpdateSlic3r(), Slic3r::GUI::ObjectDataViewModelNode::ObjectDataViewModelNode(), Slic3r::GUI::ObjectDataViewModelNode::ObjectDataViewModelNode(), Slic3r::GUI::ObjectDataViewModelNode::ObjectDataViewModelNode(), Slic3r::GUI::ObjectSettings::ObjectSettings(), Slic3r::GUI::PageFirmware::PageFirmware(), Slic3r::GUI::PartSkipDialog::PartSkipDialog(), Slic3r::ProgressStatusBar::ProgressStatusBar(), RammingDialog::RammingDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SLAImportDialog::SLAImportDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::TabFilament::TabFilament(), Slic3r::GUI::TabPrint::TabPrint(), Slic3r::GUI::TabSLAMaterial::TabSLAMaterial(), Slic3r::GUI::TabSLAPrint::TabSLAPrint(), WipingDialog::WipingDialog(), Slic3r::GCode::_do_export(), Slic3r::_3MF_Importer::_handle_end_metadata(), Slic3r::Print::_make_skirt(), Slic3r::GUI::OptionsGroup::activate(), Slic3r::GUI::Page::activate(), Slic3r::GUI::OptionsGroup::activate_line(), Slic3r::GUI::add_config_substitutions(), Slic3r::GUI::TabFilament::add_filament_overrides_page(), Slic3r::GUI::EditGCodeDialog::add_presets_placeholders(), Slic3r::GUI::ObjectDataViewModel::AddLayersChild(), Slic3r::GCode::append_full_config(), Slic3r::GUI::OptionsGroup::append_line(), Slic3r::GUI::MenuFactory::append_menu_item_precise_seam_submenu(), Slic3r::GUI::MenuFactory::append_menu_item_settings(), Slic3r::GUI::append_menu_itemm_add_(), Slic3r::GUI::MenuFactory::append_menu_items_add_volume(), Slic3r::Search::SettingsIndex::append_options(), Slic3r::GUI::MenuFactory::append_submenu_add_handy_model(), Slic3r::GUI::KBShortcutsDialog::apply_bindings(), apply_extruder_selector(), Slic3r::PresetBundle::apply_vendor_config(), Slic3r::BOOST_PP_SEQ_FOR_EACH(), Slic3r::GUI::Choice::BUILD(), Slic3r::GUI::PublishSettingsDialog::build_option_model(), Slic3r::GUI::Tab::build_preset_description_line(), Slic3r::GUI::TabPrinter::build_unregular_pages(), Slic3r::GUI::ConfigManipulation::check_filament_ironing_spacing(), Slic3r::GUI::ConfigManipulation::check_filament_max_volumetric_speed(), Slic3r::GUI::ObjectList::check_last_selection(), Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_initial_layer_range(), Slic3r::GUI::ConfigManipulation::check_nozzle_temperature_range(), Slic3r::GCode::check_placeholder_parser_failed(), Slic3r::GUI::GUI_App::check_print_host_queue(), Slic3r::GCode::collect_layers_to_print(), Slic3r::GUI::Tab::compatible_widget_create(), Slic3r::GUI::TabPrinter::create_bed_shape_widget(), Slic3r::GUI::create_freq_settings_popupmenu(), Slic3r::GUI::KBShortcutsDialog::create_page(), Slic3r::GUI::Tab::create_preset_tab(), Slic3r::GUI::create_settings_popupmenu(), Slic3r::GUI::OptionsGroup::create_single_option_line(), Slic3r::CadDocument::detect_mate_conflicts(), Slic3r::Flashforge::discover_printers(), Slic3r::GCode::do_export(), Chart::draw(), Slic3r::GUI::KBShortcutsDialog::edit_shortcut(), Slic3r::evaluate_variables(), Slic3r::Flashforge::fetch_material_slots(), Slic3r::GUI::ArrangeJob::finalize(), Slic3r::GUI::SLAImportJob::finalize(), Slic3r::GUI::ObjectList::fix_multiselection_conflicts(), Slic3r::GUI::ObjectList::fix_through_cgal(), Slic3r::GUI::GLTexture::generate_texture_from_text(), Slic3r::GUI::ConfigOptionsGroup::get_config_value(), Slic3r::GUI::get_formatted_tooltip_text(), Slic3r::GUI::BedShape::get_full_name_with_params(), Slic3r::GUI::OG_CustomCtrl::get_pos(), Slic3r::AstroBox::get_test_ok_msg(), Slic3r::CrealityPrint::get_test_ok_msg(), Slic3r::Duet::get_test_ok_msg(), Slic3r::ESP3D::get_test_ok_msg(), Slic3r::FlashAir::get_test_ok_msg(), Slic3r::Flashforge::get_test_ok_msg(), Slic3r::MKS::get_test_ok_msg(), Slic3r::Moonraker::get_test_ok_msg(), Slic3r::Obico::get_test_ok_msg(), Slic3r::OctoPrint::get_test_ok_msg(), Slic3r::PrusaConnect::get_test_ok_msg(), Slic3r::PrusaLink::get_test_ok_msg(), Slic3r::Repetier::get_test_ok_msg(), Slic3r::SimplyPrint::get_test_ok_msg(), Slic3r::SL1Host::get_test_ok_msg(), Slic3r::GUI::Choice::get_value(), Slic3r::GUI::Field::get_value_by_opt_type(), Slic3r::GUI::TroubleshootDialog::GetProfilesOverview(), Slic3r::GUI::BedShapePanel::init_model_panel(), Slic3r::GUI::BedShapePanel::init_texture_panel(), Slic3r::WipeTowerIntegration::is_empty_wipe_tower_gcode(), Slic3r::GUI::DesignPanel::kernel_error_text(), Slic3r::GUI::ConfigManipulation::layer_height_out_of_range_dialog(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::ObjectList::load_generic_subobject(), Slic3r::GUI::HintDatabase::load_hints_from_file(), Slic3r::GUI::ObjectList::load_shape_object(), Slic3r::make_brim(), Slic3r::Search::make_option(), Slic3r::GUI::Choice::msw_rescale(), Slic3r::GUI::Tab::on_value_change(), Slic3r::GUI::FilamentMapManualPanel::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::pad_combo_value_for_config(), Slic3r::ElegooLink::print(), Slic3r::GCode::process_layers(), Slic3r::GUI::ShortcutCaptureDialog::record(), Slic3r::GUI::PrinterAgentChoice::reload_rows(), Slic3r::GUI::ObjectList::rename_item(), Slic3r::GUI::GLCanvas3D::Labels::render(), Slic3r::GUI::OG_CustomCtrl::CtrlLine::render(), Slic3r::GUI::KBShortcutsDialog::reset_shortcut(), Slic3r::ToolOrdering::resolve_mixed_filaments(), Slic3r::GUI::EditGCodeDialog::selection_changed(), Slic3r::GUI::PresetComboBox::separator(), Slic3r::Print::sequential_print_clearance_valid(), Slic3r::GUI::Line::set_label(), Slic3r::GUI::ObjectList::set_tooltip_for_item(), Slic3r::GUI::Tab::set_tooltips_text(), Slic3r::GUI::TextCtrl::set_value(), Slic3r::GUI::ObjectList::set_volume_type(), Slic3r::GUI::ObjectDataViewModelNode::SetValue(), Slic3r::GUI::anonymous_namespace{KBShortcutsDialog.cpp}::shortcut_names(), Slic3r::GUI::ConfigManipulation::show_spiral_mode_settings_dialog(), Slic3r::GUI::Tab::show_timelapse_warning_dialog(), Slic3r::GUI::ObjectList::split(), Slic3r::GUI::support_combo_value_for_config(), Slic3r::GUI::KBShortcutsDialog::take_chord_from(), Slic3r::FlashAir::test(), Slic3r::GUI::PlateSettingsDialog::to_bed_type_name(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::TabPrinter::toggle_options(), Slic3r::WipeTowerIntegration::tool_change(), Slic3r::GUI::Tab::translate_category(), Slic3r::GUI::PhysicalPrinterDialog::update_host_type(), Slic3r::GUI::GizmoObjectManipulation::update_if_dirty(), Slic3r::GUI::TabPrinter::update_input_shaper_menu(), Slic3r::GUI::Tab::update_preset_description_line(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), Slic3r::GUI::GLCanvas3D::update_sequential_clearance(), Slic3r::GUI::ObjectDataViewModelNode::update_settings_digest(), Slic3r::GUI::ObjectSettings::update_settings_list(), Slic3r::GUI::ObjectTableSettings::update_settings_list(), Slic3r::DoExport::validate_custom_gcode(), Slic3r::GUI::Tab::validate_custom_gcode(), Slic3r::GUI::Tab::validate_filament_temperature_pairs(), and Slic3r::anonymous_namespace{Flashforge.cpp}::validate_local_api_response().

◆ EXPORT_3MF_USE_SPIRIT_KARMA_FP

#define EXPORT_3MF_USE_SPIRIT_KARMA_FP   0

◆ L

#define L ( s)
Value:
(s)

macro used to mark string used at localization, return same string

Referenced by Slic3r::_3MF_Importer::_handle_end_metadata().

Function Documentation

◆ get_attribute_value_bool()

bool get_attribute_value_bool ( const char ** attributes,
unsigned int attributes_size,
const char * attribute_key )
234{
235 const char* text = get_attribute_value_charptr(attributes, attributes_size, attribute_key);
236 return (text != nullptr) ? (bool)::atoi(text) : true;
237}
const char * get_attribute_value_charptr(const char **attributes, unsigned int attributes_size, const char *attribute_key)
Definition 3mf.cpp:198

References get_attribute_value_charptr().

Referenced by Slic3r::_3MF_Importer::_handle_start_item().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_attribute_value_charptr()

const char * get_attribute_value_charptr ( const char ** attributes,
unsigned int attributes_size,
const char * attribute_key )
199{
200 if ((attributes == nullptr) || (attributes_size == 0) || (attributes_size % 2 != 0) || (attribute_key == nullptr))
201 return nullptr;
202
203 for (unsigned int a = 0; a < attributes_size; a += 2) {
204 if (::strcmp(attributes[a], attribute_key) == 0)
205 return attributes[a + 1];
206 }
207
208 return nullptr;
209}

Referenced by get_attribute_value_bool(), get_attribute_value_float(), get_attribute_value_int(), and get_attribute_value_string().

Here is the caller graph for this function:

◆ get_attribute_value_float()

float get_attribute_value_float ( const char ** attributes,
unsigned int attributes_size,
const char * attribute_key )
218{
219 float value = 0.0f;
220 if (const char *text = get_attribute_value_charptr(attributes, attributes_size, attribute_key); text != nullptr)
221 fast_float::from_chars(text, text + strlen(text), value);
222 return value;
223}

References get_attribute_value_charptr().

Referenced by Slic3r::_3MF_Importer::_handle_start_vertex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_attribute_value_int()

int get_attribute_value_int ( const char ** attributes,
unsigned int attributes_size,
const char * attribute_key )
226{
227 int value = 0;
228 if (const char *text = get_attribute_value_charptr(attributes, attributes_size, attribute_key); text != nullptr)
229 boost::spirit::qi::parse(text, text + strlen(text), boost::spirit::qi::int_, value);
230 return value;
231}

References get_attribute_value_charptr().

Referenced by Slic3r::_3MF_Importer::_handle_start_component(), Slic3r::_3MF_Importer::_handle_start_config_object(), Slic3r::_3MF_Importer::_handle_start_config_volume(), Slic3r::_3MF_Importer::_handle_start_config_volume_mesh(), Slic3r::_3MF_Importer::_handle_start_item(), Slic3r::_3MF_Importer::_handle_start_object(), and Slic3r::_3MF_Importer::_handle_start_triangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_attribute_value_string()

std::string get_attribute_value_string ( const char ** attributes,
unsigned int attributes_size,
const char * attribute_key )
212{
213 const char* text = get_attribute_value_charptr(attributes, attributes_size, attribute_key);
214 return (text != nullptr) ? text : "";
215}

References get_attribute_value_charptr().

Referenced by Slic3r::_3MF_Importer::_handle_start_component(), Slic3r::_3MF_Importer::_handle_start_config_metadata(), Slic3r::_3MF_Importer::_handle_start_item(), Slic3r::_3MF_Importer::_handle_start_metadata(), Slic3r::_3MF_Importer::_handle_start_model(), Slic3r::_3MF_Importer::_handle_start_object(), and Slic3r::_3MF_Importer::_handle_start_triangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_transform_from_3mf_specs_string()

Slic3r::Transform3d get_transform_from_3mf_specs_string ( const std::string & mat_str)
240{
241 // check: https://3mf.io/3d-manufacturing-format/ or https://github.com/3MFConsortium/spec_core/blob/master/3MF%20Core%20Specification.md
242 // to see how matrices are stored inside 3mf according to specifications
243 Slic3r::Transform3d ret = Slic3r::Transform3d::Identity();
244
245 if (mat_str.empty())
246 // empty string means default identity matrix
247 return ret;
248
249 std::vector<std::string> mat_elements_str;
250 boost::split(mat_elements_str, mat_str, boost::is_any_of(" "), boost::token_compress_on);
251
252 unsigned int size = (unsigned int)mat_elements_str.size();
253 if (size != 12)
254 // invalid data, return identity matrix
255 return ret;
256
257 unsigned int i = 0;
258 // matrices are stored into 3mf files as 4x3
259 // we need to transpose them
260 for (unsigned int c = 0; c < 4; ++c) {
261 for (unsigned int r = 0; r < 3; ++r) {
262 ret(r, c) = ::atof(mat_elements_str[i++].c_str());
263 }
264 }
265 return ret;
266}
Eigen::Transform< double, 3, Eigen::Affine, Eigen::DontAlign > Transform3d
Definition Point.hpp:96

Referenced by Slic3r::_3MF_Importer::_handle_start_component(), and Slic3r::_3MF_Importer::_handle_start_item().

Here is the caller graph for this function:

◆ get_unit_factor()

float get_unit_factor ( const std::string & unit)
269{
270 const char* text = unit.c_str();
271
272 if (::strcmp(text, "micron") == 0)
273 return 0.001f;
274 else if (::strcmp(text, "centimeter") == 0)
275 return 10.0f;
276 else if (::strcmp(text, "inch") == 0)
277 return 25.4f;
278 else if (::strcmp(text, "foot") == 0)
279 return 304.8f;
280 else if (::strcmp(text, "meter") == 0)
281 return 1000.0f;
282 else
283 // default "millimeters" (see specification)
284 return 1.0f;
285}

Referenced by Slic3r::_3MF_Importer::_handle_start_model().

Here is the caller graph for this function:

◆ is_valid_object_type()

bool is_valid_object_type ( const std::string & type)
288{
289 // if the type is empty defaults to "model" (see specification)
290 if (type.empty())
291 return true;
292
293 for (unsigned int i = 0; i < VALID_OBJECT_TYPES_COUNT; ++i) {
294 if (::strcmp(type.c_str(), VALID_OBJECT_TYPES[i]) == 0)
295 return true;
296 }
297
298 return false;
299}
const unsigned int VALID_OBJECT_TYPES_COUNT
Definition 3mf.cpp:177
const char * VALID_OBJECT_TYPES[]
Definition 3mf.cpp:178

References VALID_OBJECT_TYPES, and VALID_OBJECT_TYPES_COUNT.

Referenced by Slic3r::_3MF_Importer::_handle_start_object().

Here is the caller graph for this function:

Variable Documentation

◆ BUILD_TAG

◆ COMPONENT_TAG

◆ COMPONENTS_TAG

◆ CONFIG_TAG

◆ CONTENT_TYPES_FILE

const std::string CONTENT_TYPES_FILE = "[Content_Types].xml"

◆ CUSTOM_GCODE_PER_PRINT_Z_FILE

const std::string CUSTOM_GCODE_PER_PRINT_Z_FILE = "Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml"

◆ CUSTOM_SEAM_ATTR

◆ CUSTOM_SUPPORTS_ATTR

◆ FDM_SUPPORTS_PAINTING_VERSION

const unsigned int FDM_SUPPORTS_PAINTING_VERSION = 1

◆ FIRST_TRIANGLE_ID_ATTR

◆ FUZZY_SKIN_ATTR

const char* FUZZY_SKIN_ATTR = "slic3rpe:fuzzy_skin"
staticconstexpr

◆ ID_ATTR

◆ INSTANCESCOUNT_ATTR

const char* INSTANCESCOUNT_ATTR = "instances_count"
staticconstexpr

◆ INVALID_OBJECT_TYPES

const char* INVALID_OBJECT_TYPES[]
Initial value:
=
{
"solidsupport",
"support",
"surface",
"other"
}
184{
185 "solidsupport",
186 "support",
187 "surface",
188 "other"
189};

◆ ITEM_TAG

◆ KEY_ATTR

◆ LAST_TRIANGLE_ID_ATTR

◆ LAYER_CONFIG_RANGES_FILE

const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml"

◆ LAYER_HEIGHTS_PROFILE_FILE

const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt"

◆ MATRIX_KEY

◆ MESH_STAT_BACKWARDS_EDGES

◆ MESH_STAT_DEGENERATED_FACETS

◆ MESH_STAT_EDGES_FIXED

◆ MESH_STAT_FACETS_REMOVED

◆ MESH_STAT_FACETS_RESERVED

◆ MESH_TAG

◆ METADATA_TAG

◆ MM_PAINTING_VERSION

const unsigned int MM_PAINTING_VERSION = 1

◆ MMU_SEGMENTATION_ATTR

◆ MODEL_CONFIG_FILE

const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config"

◆ MODEL_EXTENSION

const std::string MODEL_EXTENSION = ".model"

◆ MODEL_FILE

◆ MODEL_FOLDER

const std::string MODEL_FOLDER = "3D/"

◆ MODEL_TAG

◆ MODIFIER_KEY

const char* MODIFIER_KEY = "modifier"
staticconstexpr

◆ NAME_ATTR

◆ NAME_KEY

◆ OBJECT_TAG

◆ OBJECT_TYPE

◆ OBJECTID_ATTR

◆ PRECISE_SEAM_CONFIG_PREFIX

◆ PRECISE_SEAM_TYPE_KEY

◆ PRINT_CONFIG_FILE

const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config"

◆ PRINTABLE_ATTR

◆ RELATIONSHIPS_FILE

◆ RESOURCES_TAG

◆ SEAM_PAINTING_VERSION

const unsigned int SEAM_PAINTING_VERSION = 1

◆ SLA_DRAIN_HOLES_FILE

const std::string SLA_DRAIN_HOLES_FILE = "Metadata/Slic3r_PE_sla_drain_holes.txt"

◆ SLA_SUPPORT_POINTS_FILE

const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt"

◆ SLIC3RPE_3MF_VERSION

const char* SLIC3RPE_3MF_VERSION = "slic3rpe:Version3mf"

◆ SLIC3RPE_FDM_SUPPORTS_PAINTING_VERSION

const std::string SLIC3RPE_FDM_SUPPORTS_PAINTING_VERSION = "slic3rpe:FdmSupportsPaintingVersion"

◆ SLIC3RPE_MM_PAINTING_VERSION

const std::string SLIC3RPE_MM_PAINTING_VERSION = "slic3rpe:MmPaintingVersion"

◆ SLIC3RPE_SEAM_PAINTING_VERSION

const std::string SLIC3RPE_SEAM_PAINTING_VERSION = "slic3rpe:SeamPaintingVersion"

◆ SOURCE_FILE_KEY

◆ SOURCE_IN_INCHES

◆ SOURCE_IN_METERS

◆ SOURCE_OBJECT_ID_KEY

◆ SOURCE_OFFSET_X_KEY

◆ SOURCE_OFFSET_Y_KEY

◆ SOURCE_OFFSET_Z_KEY

◆ SOURCE_VOLUME_ID_KEY

◆ THUMBNAIL_FILE

◆ TRANSFORM_ATTR

◆ TRIANGLE_TAG

◆ TRIANGLES_TAG

◆ TYPE_ATTR

◆ UNIT_ATTR

◆ V1_ATTR

◆ V2_ATTR

◆ V3_ATTR

◆ VALID_OBJECT_TYPES

const char* VALID_OBJECT_TYPES[]
Initial value:
=
{
"model"
}
179{
180 "model"
181};

Referenced by is_valid_object_type().

◆ VALID_OBJECT_TYPES_COUNT

const unsigned int VALID_OBJECT_TYPES_COUNT = 1

Referenced by is_valid_object_type().

◆ VALUE_ATTR

◆ VERSION_3MF

const unsigned int VERSION_3MF = 1

◆ VERSION_3MF_COMPATIBLE

const unsigned int VERSION_3MF_COMPATIBLE = 2

◆ VERTEX_TAG

◆ VERTICES_TAG

◆ VOLUME_TAG

◆ VOLUME_TYPE

◆ VOLUME_TYPE_KEY

◆ X_ATTR

◆ Y_ATTR

◆ Z_ATTR