mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-28 03:01:17 -06:00
Merge remote-tracking branch 'origin/ys_imperial_unit'
This commit is contained in:
commit
504066e64b
8 changed files with 165 additions and 27 deletions
|
|
@ -448,6 +448,31 @@ void Model::convert_multipart_object(unsigned int max_extruders)
|
|||
this->objects.push_back(object);
|
||||
}
|
||||
|
||||
bool Model::looks_like_imperial_units() const
|
||||
{
|
||||
if (this->objects.size() == 0)
|
||||
return false;
|
||||
|
||||
stl_vertex size = this->objects[0]->get_object_stl_stats().size;
|
||||
|
||||
for (ModelObject* o : this->objects) {
|
||||
auto sz = o->get_object_stl_stats().size;
|
||||
|
||||
if (size[0] < sz[0]) size[0] = sz[0];
|
||||
if (size[1] < sz[1]) size[1] = sz[1];
|
||||
if (size[2] < sz[2]) size[2] = sz[2];
|
||||
}
|
||||
|
||||
return (size[0] < 3 && size[1] < 3 && size[2] < 3);
|
||||
}
|
||||
|
||||
void Model::convert_from_imperial_units()
|
||||
{
|
||||
double in_to_mm = 25.4;
|
||||
for (ModelObject* o : this->objects)
|
||||
o->scale_mesh_after_creation(Vec3d(in_to_mm, in_to_mm, in_to_mm));
|
||||
}
|
||||
|
||||
void Model::adjust_min_z()
|
||||
{
|
||||
if (objects.empty())
|
||||
|
|
|
|||
|
|
@ -851,6 +851,8 @@ public:
|
|||
|
||||
bool looks_like_multipart_object() const;
|
||||
void convert_multipart_object(unsigned int max_extruders);
|
||||
bool looks_like_imperial_units() const;
|
||||
void convert_from_imperial_units();
|
||||
|
||||
// Ensures that the min z of the model is not negative
|
||||
void adjust_min_z();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue