mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-13 19:01:21 +00:00
* Add orca-translations Claude skill and PO tool
Add a .claude skill that guides translation passes over the localization/i18n gettext catalogs. It covers the workflow: run gettext, settle new glossary terms, translate in batches, verify, and report.
Includes translation-rules.md, which condenses the placeholder, line-break and glossary rules plus the guidance on review notes.
Also adds scripts/po_tool.py (standard library only). It lists pending entries with glossary hints, validates and applies translations, adding '# AI Translated' and '# Needs human review' comments, and rewrites only the entries it changes. It can also check catalogs, look up existing translations, suggest glossary candidates and update the wiki glossary TSV.
* Let po_tool apply translations by entry id
pending now gives each entry a short id, so a translation file can name
entries by id instead of repeating the English msgid. apply accepts either.
A "review": "" item clears an earlier review note when overwriting an
entry, and check gives each msgfmt run its own temporary output file so
parallel checks do not collide.
* Fill all empty translations
Regenerate the template with run_gettext --full and translate every empty
entry in the 22 catalogs (7,089 entries) with the orca-translations skill,
following the localization glossary, including the new belt printer,
IDEX/IQEX and plugin terms. Every new entry is marked "# AI Translated";
122 also carry "# Needs human review" with what to check.
* Show entry ids in po_tool lookup and search translations
lookup now prints each entry's id, so an entry found there can be
rewritten with apply --overwrite without repeating the English, and
--msgstr searches the translations instead of the msgids, which finds
every entry that still uses a term being changed.
SKILL.md describes how to change an established term: check the
catalog's usage first, update the glossary cell, then rewrite only the
entries where the term has that meaning.
* Fix mistranslated terms and align catalogs with the glossary
Correct labels that the glossary had copied, and the entries that used
them:
- ca: Raft was rendered as the Brim term; it is now "Rai". Exhaust fan,
Monotonic line, Unretract, Slice, Lateral Honeycomb and PA Tower
labels fixed.
- cs: Lightning infill is "Blesk", not "Osvětlení" (illumination).
- sv: Retraction is "Retraktion", not "Reduktion"; Unretract,
Lagerhöjd, Delkylningsfläkt, Utsugsfläkt, Aligned Rectilinear and the
Preset label fixed.
- de: Brim is "Rand" and Skirt is "Umrandung", as most entries already
had them.
- lt: brim entries used the Skirt word "apvadas"; they now use "kraštas".
- es: Sparse infill is "relleno de baja densidad", the catalog majority.
- eu: nozzle wipe is "garbiketa", not purge.
- th: the project plate is "เพลต", distinct from the bed.
- uk: Quarter Cubic, Latin "PA" in PA Tower, and Belt purge tower.
- pl: Cross Hatch, Tri-hexagon, Volumetric speed and Raft labels.
- zh_TW: Brim stays "Brim", as the existing labels have it.
- tr: "Prime Tower" read "Prime Minister Tower".
- ko: the plugin "Capabilities" label read "performance".
- Build Volume labels fixed in tr, de, cs and eu.
All 242 rewritten entries are marked "# AI Translated".
* Make more UI text translatable and fix pluralization and context
Audit the sources for text that translators could not translate
correctly and fix it.
Mark text that reached users in English only: IDEX/IQEX role names,
plugin permission prompts and errors, 3MF/preset loading errors, G-code
placeholder parser errors, calibration and device messages, notification
texts, file dialog filters, and the config validation messages.
Replace sentences built from translated fragments, such as the prime
tower warnings, "left"/"right" nozzle names, and "Filament " + number,
with single msgids that have placeholders, so translators can reorder
and inflect them.
Use plural forms for texts with a count ("%1% mixed filaments",
"%d objects", "%1% triangles") instead of "(s)" and mismatched verbs.
Fix the swapped singular/plural pair in "The following presets inherit
this preset".
Add translation contexts where one English word has several meanings
(Subscribed/Local, Standard, Pause, View, Step, Model, Camera, Flow,
Filter, Others, Prepare, the Design tools). Show "Size" instead of
"Build Volume" in the Cut tool, which displays the object size.
Fix code that compared translated text with English (the Edit G-code
dialog group, the plugin registration failure check), and add the
bundled web pages' missing string-table entries. Use the single
character for degrees Celsius, say "G-code", and describe the head
filament map without internal jargon.
Install the libslic3r translate callback before the presets load, so
their load errors are translated, and list the 28 source files that had
marked strings but were never extracted into localization/i18n/list.txt.
* Suggest earlier translations and list fuzzy entries in po_tool pending
pending now attaches the closest earlier translation of a similar
English text (from obsolete or translated entries), so a reworded or
split string keeps its wording, and it lists fuzzy entries by default,
since users never see them. A fuzzy entry also carries its stale
translation as previous_translation.
* Fix wording of the non-boolean operands error
The logical operation error said "operators" where it means the
operands the operation was applied to.
* Translate the newly translatable strings in all languages
Regenerate the template after the translatability changes and fill every
new or changed entry in the 22 catalogs (about 12,800 entries): the
strings that became translatable, the plural forms, the entries split by
context, and the previously fuzzy singular entries that became plurals.
Every new entry is marked "# AI Translated", and about 360 also carry a
"# Needs human review" note saying what to check. Terms follow the
localization glossary. Earlier translations of reworded strings were
reused where the meaning was unchanged. Existing entries were not
changed, and obsolete entries are kept.
* Document the source translatability audit in the orca-translations skill
Add a reference describing how strings reach translators, what to look
for (untranslated text, spliced sentences, missing plurals, ambiguous
words), what not to translate, where a context cannot be carried, and
what to do after the edits, plus a scanner that lists untranslated
user-facing string literals.
* Document how to write translatable strings in AGENTS.md
Tell developers to keep each message complete in one msgid: use
placeholders instead of concatenating translated fragments, plural forms
for counts, and contexts for ambiguous words, and to list new source
files in localization/i18n/list.txt. Add a matching code review item.
* Translate the strings added since the rebase
Regenerate the template against the current main and translate the 26
new entries per language: the Fix Model commands and messages, and the
texture displacement image adjustment panel. Each new entry is marked
"# AI Translated"; existing entries are unchanged.
* tidy
409 lines
15 KiB
C++
409 lines
15 KiB
C++
#include "libslic3r/Point.hpp"
|
|
#include "libslic3r/Format/STEP.hpp"
|
|
#include "libslic3r/ClipperUtils.hpp"
|
|
#include "../libslic3r.h"
|
|
#include "../Model.hpp"
|
|
#include "../TriangleMesh.hpp"
|
|
#include "../I18N.hpp"
|
|
|
|
#include "svg.hpp"
|
|
#include "nanosvg/nanosvg.h"
|
|
|
|
#include <cstdlib>
|
|
#include <cstddef>
|
|
#include <TopAbs_ShapeEnum.hxx>
|
|
#include <TopLoc_Location.hxx>
|
|
#include <Standard_Handle.hxx>
|
|
#include <Poly_Triangulation.hxx>
|
|
#include <BRep_Tool.hxx>
|
|
#include <cstdint>
|
|
#include <Standard_TypeDef.hxx>
|
|
#include <gp_Trsf.hxx>
|
|
#include <TopAbs_Orientation.hxx>
|
|
#include <Poly_Triangle.hxx>
|
|
#include <string>
|
|
|
|
#include <boost/log/trivial.hpp>
|
|
#include <vector>
|
|
#include <utility>
|
|
|
|
#include "BRepBuilderAPI_MakeWire.hxx"
|
|
#include "BRepBuilderAPI_MakeEdge.hxx"
|
|
#include "BRepBuilderAPI_MakeFace.hxx"
|
|
#include "BRepPrimAPI_MakePrism.hxx"
|
|
#include "BRepBuilderAPI_Transform.hxx"
|
|
#include "BRepMesh_IncrementalMesh.hxx"
|
|
#include "TopoDS_Face.hxx"
|
|
#include "TopExp_Explorer.hxx"
|
|
#include "TopoDS.hxx"
|
|
#include "BRepExtrema_SelfIntersection.hxx"
|
|
#include "libslic3r/Polygon.hpp"
|
|
#include "libslic3r/Polyline.hpp"
|
|
|
|
namespace Slic3r {
|
|
const double STEP_TRANS_CHORD_ERROR = 0.005;
|
|
const double STEP_TRANS_ANGLE_RES = 1;
|
|
|
|
struct Element_Info
|
|
{
|
|
std::string name;
|
|
unsigned int color;
|
|
TopoDS_Shape shape;
|
|
};
|
|
|
|
bool is_same_points(gp_Pnt pt1, gp_Pnt pt2) {
|
|
return abs(pt1.X() - pt2.X()) < 0.001
|
|
&& abs(pt1.Y() - pt2.Y()) < 0.001
|
|
&& abs(pt1.Z() - pt2.Z()) < 0.001;
|
|
}
|
|
|
|
struct Point_2D
|
|
{
|
|
Point_2D(float in_x, float in_y) : x(in_x), y(in_y) {}
|
|
float x;
|
|
float y;
|
|
};
|
|
|
|
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t)
|
|
{
|
|
const float s = 1.0f - t;
|
|
|
|
r[0] = s * a[0] + t * b[0];
|
|
r[1] = s * a[1] + t * b[1];
|
|
}
|
|
|
|
void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float u)
|
|
{
|
|
float q0[2], q1[2], q2[2], r0[2], r1[2];
|
|
|
|
interp_v2_v2v2(q0, v1, v2, u);
|
|
interp_v2_v2v2(q1, v2, v3, u);
|
|
interp_v2_v2v2(q2, v3, v4, u);
|
|
|
|
interp_v2_v2v2(r0, q0, q1, u);
|
|
interp_v2_v2v2(r1, q1, q2, u);
|
|
|
|
interp_v2_v2v2(p, r0, r1, u);
|
|
}
|
|
|
|
bool is_two_lines_interaction(gp_Pnt pL1, gp_Pnt pL2, gp_Pnt pR1, gp_Pnt pR2) {
|
|
Vec3d point1(pL1.X(), pL1.Y(), 0);
|
|
Vec3d point2(pL2.X(), pL2.Y(), 0);
|
|
Vec3d point3(pR1.X(), pR1.Y(), 0);
|
|
Vec3d point4(pR2.X(), pR2.Y(), 0);
|
|
|
|
Vec3d line1 = point2 - point1;
|
|
Vec3d line2 = point4 - point3;
|
|
|
|
Vec3d line_pos1 = point1 - point3;
|
|
Vec3d line_pos2 = point2 - point3;
|
|
|
|
Vec3d line_pos3 = point3 - point1;
|
|
Vec3d line_pos4 = point4 - point1;
|
|
|
|
Vec3d cross_1 = line2.cross(line_pos1);
|
|
Vec3d cross_2 = line2.cross(line_pos2);
|
|
|
|
Vec3d cross_3 = line1.cross(line_pos3);
|
|
Vec3d cross_4 = line1.cross(line_pos4);
|
|
|
|
return (cross_1.dot(cross_2) < 0) && (cross_3.dot(cross_4) < 0);
|
|
}
|
|
|
|
bool is_profile_self_interaction(std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_points)
|
|
{
|
|
for (int i = 0; i < profile_line_points.size(); ++i) {
|
|
for (int j = i + 2; j < profile_line_points.size(); ++j)
|
|
if (is_two_lines_interaction(profile_line_points[i].first, profile_line_points[i].second, profile_line_points[j].first, profile_line_points[j].second))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
double get_profile_area(std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_points)
|
|
{
|
|
double min_x = 0;
|
|
for (auto line_points : profile_line_points) {
|
|
if (line_points.first.X() < min_x) min_x = line_points.first.X();
|
|
}
|
|
|
|
double area = 0;
|
|
for (auto line_points : profile_line_points) {
|
|
bool flag = true;
|
|
if (line_points.second.Y() < line_points.first.Y()) flag = false;
|
|
|
|
area += (line_points.second.X() + line_points.first.X() - 2 * min_x) * (line_points.second.Y() - line_points.first.Y()) / 2;
|
|
}
|
|
|
|
return abs(area);
|
|
}
|
|
|
|
bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos, std::string& message)
|
|
{
|
|
NSVGimage *svg_data = nullptr;
|
|
svg_data = nsvgParseFromFile(path, "mm", 96.0f);
|
|
if (svg_data == nullptr) {
|
|
message = _u8L("import svg failed: could not open svg.");
|
|
return false;
|
|
}
|
|
if (svg_data->shapes == nullptr) {
|
|
message = _u8L("import svg failed: could not parse imported svg data.");
|
|
return false;
|
|
}
|
|
|
|
int name_index = 1;
|
|
for (NSVGshape *shape = svg_data->shapes; shape; shape = shape->next) {
|
|
char * id = shape->id;
|
|
|
|
int interpolation_precision = 10; // Number of interpolation points
|
|
float step = 1.0f / float(interpolation_precision - 1);
|
|
|
|
// get the path point
|
|
std::vector<std::vector<std::vector<Point_2D>>> all_path_points; // paths<profiles<curves<points>>>
|
|
for (NSVGpath *path = shape->paths; path; path = path->next) {
|
|
std::vector<std::vector<Point_2D>> profile_points;
|
|
int index = 0;
|
|
for (int i = 0; i < path->npts - 1; i += 3) {
|
|
float * p = &path->pts[i * 2];
|
|
float a = 0.0f;
|
|
std::vector<Point_2D> curve_points; // points on a curve
|
|
for (int v = 0; v < interpolation_precision; v++) {
|
|
float pt[2];
|
|
|
|
// get interpolation points of Bezier curve
|
|
interp_v2_v2v2v2v2_cubic(pt, &p[0], &p[2], &p[4], &p[6], a);
|
|
|
|
Point_2D point(pt[0], -pt[1]);
|
|
curve_points.push_back(point);
|
|
a += step;
|
|
}
|
|
|
|
profile_points.push_back(curve_points);
|
|
|
|
// keep the adjacent curves end-to-end
|
|
if (profile_points.size() > 1) {
|
|
profile_points[index - 1].back() = profile_points[index].front();
|
|
}
|
|
|
|
index++;
|
|
}
|
|
|
|
if (!profile_points.empty())
|
|
all_path_points.push_back(profile_points);
|
|
}
|
|
|
|
// remove duplicate points and ensure the profile is closed
|
|
std::vector<std::vector<std::pair<gp_Pnt, gp_Pnt>>> path_line_points;
|
|
for (auto profile_points : all_path_points) {
|
|
std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_points;
|
|
for (int i = 0; i < profile_points.size(); ++i) {
|
|
for (int j = 0; j + 1 < profile_points[i].size(); j++) {
|
|
gp_Pnt pt1(profile_points[i][j].x, profile_points[i][j].y, 0);
|
|
gp_Pnt pt2(profile_points[i][j + 1].x, profile_points[i][j + 1].y, 0);
|
|
if (is_same_points(pt1, pt2))
|
|
continue;
|
|
|
|
profile_line_points.push_back({pt1, pt2});
|
|
}
|
|
}
|
|
|
|
if (profile_line_points.empty())
|
|
continue;
|
|
|
|
// keep the start and end points of profile connected
|
|
if (shape->fill.gradient != nullptr)
|
|
profile_line_points.back().second = profile_line_points[0].first;
|
|
|
|
if (is_profile_self_interaction(profile_line_points))
|
|
BOOST_LOG_TRIVIAL(warning) << "the profile is self interaction.";
|
|
|
|
path_line_points.push_back(profile_line_points);
|
|
}
|
|
|
|
if (shape->fill.gradient == nullptr) {
|
|
double scale_size = 1e6;
|
|
std::vector<std::vector<std::pair<gp_Pnt, gp_Pnt>>> new_path_line_points;
|
|
float stroke_width = shape->strokeWidth * scale_size;
|
|
Polygons polygons;
|
|
bool close_polygon = false;
|
|
for (int i = 0; i < path_line_points.size(); ++i) {
|
|
Polyline pt_path;
|
|
for (auto line_point : path_line_points[i]) {
|
|
pt_path.points.push_back(Point(line_point.first.X() * scale_size, line_point.first.Y() * scale_size));
|
|
}
|
|
pt_path.points.push_back(Point(path_line_points[i].back().second.X() * scale_size, path_line_points[i].back().second.Y() * scale_size));
|
|
|
|
close_polygon = pt_path.points.front() == pt_path.points.back();
|
|
if (stroke_width > 0)
|
|
append(polygons, offset(pt_path, stroke_width / 2, jtMiter, 2., close_polygon ? etClosedLine : etOpenSquare));
|
|
}
|
|
|
|
if (!close_polygon)
|
|
polygons = union_(polygons);
|
|
|
|
std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_points;
|
|
for (auto polygon : polygons) {
|
|
profile_line_points.clear();
|
|
for (int i = 0; i < polygon.size() - 1; ++i) {
|
|
gp_Pnt pt1(double(polygon[i][0] / scale_size), double(polygon[i][1] / scale_size), 0);
|
|
gp_Pnt pt2(double(polygon[i + 1][0] / scale_size), double(polygon[i + 1][1] / scale_size), 0);
|
|
profile_line_points.push_back({pt1, pt2});
|
|
}
|
|
gp_Pnt pt1(double(polygon.back()[0] / scale_size), double(polygon.back()[1] / scale_size), 0);
|
|
gp_Pnt pt2(double(polygon.front()[0] / scale_size), double(polygon.front()[1] / scale_size), 0);
|
|
profile_line_points.push_back({pt1, pt2});
|
|
|
|
new_path_line_points.push_back(profile_line_points);
|
|
}
|
|
|
|
path_line_points = new_path_line_points;
|
|
}
|
|
|
|
// generate all profile curves
|
|
std::vector<TopoDS_Wire> wires;
|
|
int index = 0;
|
|
double max_area = 0;
|
|
for (int i = 0; i < path_line_points.size(); ++i) {
|
|
BRepBuilderAPI_MakeWire wire_build;
|
|
for (auto point_item : path_line_points[i]) {
|
|
TopoDS_Edge edge_build = BRepBuilderAPI_MakeEdge(point_item.first, point_item.second);
|
|
wire_build.Add(edge_build);
|
|
}
|
|
TopoDS_Wire wire = wire_build.Wire();
|
|
double profile_area = get_profile_area(path_line_points[i]);
|
|
if (profile_area > max_area) {
|
|
max_area = profile_area;
|
|
index = i;
|
|
}
|
|
wires.emplace_back(wire);
|
|
}
|
|
|
|
if (wires.empty())
|
|
continue;
|
|
|
|
gp_Vec dir(0, 0, 10);
|
|
BRepBuilderAPI_MakeFace face_make(wires[index]);
|
|
for (int i = 0; i < wires.size(); ++i) {
|
|
if (index == i)
|
|
continue;
|
|
face_make.Add(wires[i]);
|
|
}
|
|
|
|
TopoDS_Face face = face_make.Face();
|
|
TopoDS_Shape element_shape = BRepPrimAPI_MakePrism(face, dir, false, false).Shape();
|
|
|
|
Element_Info element_info;
|
|
element_info.name = "part_" + std::to_string(name_index);
|
|
element_info.color = shape->fill.color;
|
|
element_info.shape = element_shape;
|
|
element_infos.push_back(element_info);
|
|
|
|
name_index++;
|
|
}
|
|
|
|
nsvgDelete(svg_data);
|
|
return true;
|
|
}
|
|
|
|
bool load_svg(const char *path, Model *model, std::string &message)
|
|
{
|
|
std::vector<Element_Info> namedSolids;
|
|
if (!get_svg_profile(path, namedSolids, message))
|
|
return false;
|
|
|
|
std::vector<stl_file> stl;
|
|
stl.resize(namedSolids.size());
|
|
// todo: zhimin, Can be accelerated in parallel with tbb
|
|
for (size_t i = 0 ; i < namedSolids.size(); i++) {
|
|
BRepMesh_IncrementalMesh mesh(namedSolids[i].shape, STEP_TRANS_CHORD_ERROR, false, STEP_TRANS_ANGLE_RES, true);
|
|
// BBS: calculate total number of the nodes and triangles
|
|
int aNbNodes = 0;
|
|
int aNbTriangles = 0;
|
|
for (TopExp_Explorer anExpSF(namedSolids[i].shape, TopAbs_FACE); anExpSF.More(); anExpSF.Next()) {
|
|
TopLoc_Location aLoc;
|
|
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(TopoDS::Face(anExpSF.Current()), aLoc);
|
|
if (!aTriangulation.IsNull()) {
|
|
aNbNodes += aTriangulation->NbNodes();
|
|
aNbTriangles += aTriangulation->NbTriangles();
|
|
}
|
|
}
|
|
|
|
if (aNbTriangles == 0 || aNbNodes == 0)
|
|
// BBS: No triangulation on the shape.
|
|
continue;
|
|
|
|
stl[i].stats.type = inmemory;
|
|
stl[i].stats.number_of_facets = (uint32_t) aNbTriangles;
|
|
stl[i].stats.original_num_facets = stl[i].stats.number_of_facets;
|
|
stl_allocate(&stl[i]);
|
|
|
|
std::vector<Vec3f> points;
|
|
points.reserve(aNbNodes);
|
|
// BBS: count faces missing triangulation
|
|
int aNbFacesNoTri = 0;
|
|
// BBS: fill temporary triangulation
|
|
int aNodeOffset = 0;
|
|
int aTriangleOffet = 0;
|
|
for (TopExp_Explorer anExpSF(namedSolids[i].shape, TopAbs_FACE); anExpSF.More(); anExpSF.Next()) {
|
|
const TopoDS_Shape &aFace = anExpSF.Current();
|
|
TopLoc_Location aLoc;
|
|
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation(TopoDS::Face(aFace), aLoc);
|
|
if (aTriangulation.IsNull()) {
|
|
++aNbFacesNoTri;
|
|
continue;
|
|
}
|
|
// BBS: copy nodes
|
|
gp_Trsf aTrsf = aLoc.Transformation();
|
|
for (int aNodeIter = 1; aNodeIter <= aTriangulation->NbNodes(); ++aNodeIter) {
|
|
gp_Pnt aPnt = aTriangulation->Node(aNodeIter);
|
|
aPnt.Transform(aTrsf);
|
|
points.emplace_back(Vec3f(aPnt.X(), aPnt.Y(), aPnt.Z()));
|
|
}
|
|
// BBS: copy triangles
|
|
const TopAbs_Orientation anOrientation = anExpSF.Current().Orientation();
|
|
int anId[3];
|
|
for (int aTriIter = 1; aTriIter <= aTriangulation->NbTriangles(); ++aTriIter) {
|
|
Poly_Triangle aTri = aTriangulation->Triangle(aTriIter);
|
|
|
|
aTri.Get(anId[0], anId[1], anId[2]);
|
|
if (anOrientation == TopAbs_REVERSED) std::swap(anId[1], anId[2]);
|
|
// BBS: save triangles facets
|
|
stl_facet facet;
|
|
facet.vertex[0] = points[anId[0] + aNodeOffset - 1].cast<float>();
|
|
facet.vertex[1] = points[anId[1] + aNodeOffset - 1].cast<float>();
|
|
facet.vertex[2] = points[anId[2] + aNodeOffset - 1].cast<float>();
|
|
facet.extra[0] = 0;
|
|
facet.extra[1] = 0;
|
|
stl_normal normal;
|
|
stl_calculate_normal(normal, &facet);
|
|
stl_normalize_vector(normal);
|
|
facet.normal = normal;
|
|
stl[i].facet_start[aTriangleOffet + aTriIter - 1] = facet;
|
|
}
|
|
|
|
aNodeOffset += aTriangulation->NbNodes();
|
|
aTriangleOffet += aTriangulation->NbTriangles();
|
|
}
|
|
}
|
|
|
|
ModelObject *new_object = model->add_object();
|
|
// new_object->name ?
|
|
new_object->input_file = path;
|
|
auto stage_unit3 = stl.size() / LOAD_STEP_STAGE_UNIT_NUM + 1;
|
|
for (size_t i = 0; i < stl.size(); i++) {
|
|
// BBS: maybe mesh is empty from step file. Don't add
|
|
if (stl[i].stats.number_of_facets > 0) {
|
|
TriangleMesh triangle_mesh;
|
|
triangle_mesh.from_stl(stl[i]);
|
|
ModelVolume *new_volume = new_object->add_volume(std::move(triangle_mesh));
|
|
new_volume->name = namedSolids[i].name;
|
|
new_volume->source.input_file = path;
|
|
new_volume->source.object_idx = (int) model->objects.size() - 1;
|
|
new_volume->source.volume_idx = (int) new_object->volumes.size() - 1;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
} // namespace Slic3r
|