mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 19:01:02 +00:00
fix non 45 degree slicing methods after regression created while cleaning up UI
This commit is contained in:
+7
-1
@@ -90,6 +90,12 @@ if (SLIC3R_GUI)
|
||||
# list(REMOVE_ITEM wxWidgets_LIBRARIES oleacc)
|
||||
|
||||
find_package(wxInspector REQUIRED)
|
||||
# wxInspector 1.0.0 installs its headers but accidentally declares the
|
||||
# INSTALL_INTERFACE include directory PRIVATE, so its imported target does
|
||||
# not expose them to consumers. Restore the package prefix include path until
|
||||
# the upstream export is fixed.
|
||||
get_filename_component(WXINSPECTOR_PREFIX "${wxInspector_DIR}/../../.." ABSOLUTE)
|
||||
target_include_directories(wxInspector::wxInspector INTERFACE "${WXINSPECTOR_PREFIX}/include")
|
||||
list(APPEND wxWidgets_LIBRARIES "wxInspector::wxInspector")
|
||||
|
||||
message(STATUS "wx libs: ${wxWidgets_LIBRARIES}")
|
||||
@@ -175,7 +181,7 @@ endif ()
|
||||
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
|
||||
if (SLIC3R_GUI)
|
||||
# target_link_libraries(OrcaSlicer ws2_32 uxtheme setupapi libslic3r_gui ${wxWidgets_LIBRARIES})
|
||||
target_link_libraries(OrcaSlicer libslic3r_gui)
|
||||
target_link_libraries(OrcaSlicer libslic3r_gui wxInspector::wxInspector)
|
||||
if (MSVC)
|
||||
# Generate debug symbols even in release mode.
|
||||
target_link_options(OrcaSlicer PUBLIC "$<$<CONFIG:RELEASE>:/DEBUG>")
|
||||
|
||||
@@ -29,31 +29,34 @@ bool MachineFrameTransform::init_from_config(const PrintConfig &config)
|
||||
return false;
|
||||
|
||||
const double angle_rad = Geometry::deg2rad(angle_deg);
|
||||
const double cos_a = std::cos(angle_rad);
|
||||
if (std::abs(cos_a) <= EPSILON)
|
||||
const double sin_a = std::sin(angle_rad);
|
||||
if (std::abs(sin_a) <= EPSILON)
|
||||
return false;
|
||||
const double tan_a = std::sin(angle_rad) / cos_a;
|
||||
const double inv_cos = 1.0 / cos_a;
|
||||
const double cot_a = std::cos(angle_rad) / sin_a;
|
||||
const double inv_sin = 1.0 / std::abs(sin_a);
|
||||
|
||||
// Couple the height axis (Z) to the belt-feed axis and stretch the belt-feed
|
||||
// axis by 1/cos so a unit slicing move maps to the correct belt travel. The
|
||||
// shear sign matches the belt-floor slope derived from the same rotation in
|
||||
// BeltTransformPipeline::compute_belt_height_and_floor:
|
||||
// tilt about X: feed axis Y, Z += +tan·Y, scale Y *= 1/cos
|
||||
// tilt about Y: feed axis X, Z += -tan·X, scale X *= 1/cos
|
||||
// This stage runs after the conventional belt axis swap. For an X-axis
|
||||
// slicing rotation, remapped Y is model height and remapped Z is travel
|
||||
// along the belt. Convert those Cartesian coordinates to machine axes with
|
||||
// the established belt-printer convention:
|
||||
// machine gantry = model height / sin(a)
|
||||
// machine belt = model belt + model height * cot(a)
|
||||
// The Y-rotation case is the same mapping on X/Z, with the rotation sign.
|
||||
// At 45 degrees tan/cot and sin/cos are equal, which previously hid the
|
||||
// incorrect complementary-angle formulas used by this unified transform.
|
||||
Matrix3d shear = Matrix3d::Identity();
|
||||
Matrix3d scale = Matrix3d::Identity();
|
||||
if (axis == BeltRotationAxis::X) {
|
||||
shear(2, 1) = tan_a; // Z from Y
|
||||
scale(1, 1) = inv_cos; // Y
|
||||
shear(2, 1) = cot_a; // Z from Y
|
||||
scale(1, 1) = inv_sin; // Y
|
||||
} else { // BeltRotationAxis::Y
|
||||
shear(2, 0) = -tan_a; // Z from X
|
||||
scale(0, 0) = inv_cos; // X
|
||||
shear(2, 0) = -cot_a; // Z from X
|
||||
scale(0, 0) = inv_sin; // X
|
||||
}
|
||||
|
||||
// Apply shear first, then scale (the historical default ShearThenScale order:
|
||||
// result = scale * shear * p). For the canonical 45°/X belt this maps
|
||||
// (x,y,z) -> (x, y/cos, y + z), matching the previous per-axis config.
|
||||
// (x,y,z) -> (x, y/sin, y + z), matching the previous per-axis config.
|
||||
Transform3d combined = Transform3d::Identity();
|
||||
combined.linear() = scale * shear;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Slic3r {
|
||||
//
|
||||
// Derived entirely from the single belt tilt (belt_slice_rotation axis +
|
||||
// belt_slice_rotation_angle): a shear coupling the height axis to the belt-feed
|
||||
// axis (factor tan a) plus a 1/cos a scale on the belt-feed axis. The expert
|
||||
// axis (factor cot a) plus a 1/sin a scale on the gantry-height axis. The expert
|
||||
// belt_frame_tilt_decouple flag lets the machine-frame angle differ from the
|
||||
// pre-slice rotation angle via belt_frame_tilt_angle.
|
||||
class MachineFrameTransform
|
||||
|
||||
@@ -7216,9 +7216,9 @@ void PrintConfigDef::init_fff_params()
|
||||
def = this->add("gcode_back_transform", coBool);
|
||||
def->label = L("G-code back-transform");
|
||||
def->category = L("Printable space");
|
||||
def->tooltip = L("Reverse the shear/scale transform applied during slicing so G-code "
|
||||
"coordinates are in the machine's physical coordinate space. "
|
||||
"Requires at least one shear axis with global mode enabled.");
|
||||
def->tooltip = L("Undo the pre-slice mesh transform before applying the G-code axis remap "
|
||||
"and machine-frame shear/scale. Required for the standard belt-printer "
|
||||
"rotation pipeline.");
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionBool(true));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user