Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/local/dev' into superslicer_var…
Browse files Browse the repository at this point in the history
…iant
  • Loading branch information
supermerill committed Feb 16, 2025
2 parents 944f5cb + a07b946 commit d0d86fb
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 193 deletions.
58 changes: 48 additions & 10 deletions BuildMacOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ echo "\nbrew --prefix libiconv:\n"
brew --prefix libiconv
echo "\nbrew --prefix zstd:\n"
brew --prefix zstd
export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
# not enough to fix the issue on cross-compiling
#if [[ -n "$BUILD_ARCH" ]]
#then
Expand Down Expand Up @@ -224,15 +223,25 @@ then
echo "Cmake command: cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.15\" ${BUILD_ARCH} "
pushd deps/build > /dev/null
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET="10.15" $BUILD_ARGS

echo -e "\n ... done\n"
if [ $? -eq 0 ]
then
echo -e "\n ... done\n"
else
echo -e "\n ... fail\n"
exit 1 # terminate and indicate error
fi

echo -e "[4/9] Building dependencies ...\n"

# make deps
make -j$NCORES

echo -e "\n ... done\n"
if [ $? -eq 0 ]
then
echo -e "\n ... done\n"
else
echo -e "\n ... fail\n"
exit 1 # terminate and indicate error
fi

echo -e "[5/9] Renaming wxscintilla library ...\n"

Expand Down Expand Up @@ -296,14 +305,26 @@ then
# cmake
pushd build > /dev/null
cmake .. -DCMAKE_PREFIX_PATH="$PWD/../deps/build/destdir/usr/local" -DCMAKE_OSX_DEPLOYMENT_TARGET="10.14" -DSLIC3R_STATIC=1 ${BUILD_ARGS}
echo -e "\n ... done"
if [ $? -eq 0 ]
then
echo -e "\n ... done\n"
else
echo -e "\n ... fail\n"
exit 1 # terminate and indicate error
fi

# make Slic3r
if [[ -z "$BUILD_XCODE" ]]
then
echo -e "\n[6/9] Building Slicer ...\n"
make -j$NCORES Slic3r
echo -e "\n ... done"
if [ $? -eq 0 ]
then
echo -e "\n ... done\n"
else
echo -e "\n ... fail\n"
exit 1 # terminate and indicate error
fi
fi

echo -e "\n[7/9] Generating language files ...\n"
Expand All @@ -313,9 +334,14 @@ then
make gettext_make_pot
fi
make gettext_po_to_mo
if [ $? -eq 0 ]
then
echo -e "\n ... done\n"
else
echo -e "\n ... fail\n"
exit 1 # terminate and indicate error
fi

popd > /dev/null
echo -e "\n ... done"
popd > /dev/null

echo "> ls ROOT"
Expand All @@ -334,7 +360,19 @@ then
chmod 755 $ROOT/build/src/BuildMacOSImage.sh
pushd build > /dev/null
echo "> $ROOT/build/src/BuildMacOSImage.sh -i ${BUILD_IMG_ARCH}"
$ROOT/build/src/BuildMacOSImage.sh -i $BUILD_IMG_ARCH
if [[ -n "$BUILD_DOWNLOAD_DEP" ]]
then
$ROOT/build/src/BuildMacOSImage.sh -i $BUILD_IMG_ARCH
else
$ROOT/build/src/BuildMacOSImage.sh -i $BUILD_IMG_ARCH -z
fi
if [ $? -eq 0 ]
then
echo -e "\n BuildMacOSImage done\n"
else
echo -e "\n BuildMacOSImage fail\n"
# exit 1 # terminate and indicate error
fi
popd > /dev/null
echo "> ls ROOT"
ls -al $ROOT
Expand Down
71 changes: 50 additions & 21 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,40 @@ namespace Slic3r {
//}
unsigned int extruder_id = gcodegen.writer().tool()->id();
const ConfigOptionInts& filament_idle_temp = gcodegen.config().idle_temperature;
bool cooldown = false;
if (!filament_idle_temp.is_enabled(extruder_id)) {
// There is no idle temperature defined in filament settings.
// Use the delta value from print config.
if (gcodegen.config().standby_temperature_delta.value != 0 && gcodegen.writer().tool_is_extruder() && this->_get_temp(gcodegen) > 0) {
if (gcodegen.writer().tool_is_extruder() && this->_get_temp(gcodegen) > 0 &&
gcodegen.config().standby_temperature_delta.value != 0) {
// we assume that heating is always slower than cooling, so no need to block
gcode += gcodegen.writer().set_temperature
(this->_get_temp(gcodegen) + gcodegen.config().standby_temperature_delta.value, false, extruder_id);
if(gcode.back() == '\n') gcode.pop_back(); // delete \n if possible to insert our comment FIXME: allow set_temperature to get an extra comment
gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed
cooldown = true;
}
} else {
// Use the value from filament settings. That one is absolute, not delta.
gcode += gcodegen.writer().set_temperature(filament_idle_temp.get_at(extruder_id), false, extruder_id);
if(gcode.back() == '\n') gcode.pop_back(); // delete \n if possible to insert our comment FIXME: allow set_temperature to get an extra comment
cooldown = true;
}
if (cooldown) {
if (gcode.back() == '\n')
gcode.pop_back(); // delete \n if possible to insert our comment FIXME: allow set_temperature to get
// an extra comment
gcode += " ;cooldown\n"; // this is a marker for GCodeProcessor, so it can supress the commands when needed
}

return gcode;
}

std::string OozePrevention::post_toolchange(GCodeGenerator& gcodegen)
{
if (gcodegen.config().standby_temperature_delta.value != 0 && gcodegen.writer().tool_is_extruder()){
if (gcodegen.writer().tool_is_extruder() &&
(gcodegen.config().standby_temperature_delta.value != 0 ||
gcodegen.config().idle_temperature.is_enabled(gcodegen.writer().tool()->id()))) {
int temp = this->_get_temp(gcodegen);
if (temp > 0)
if (temp > 0) {
return gcodegen.writer().set_temperature(temp, true, gcodegen.writer().tool()->id());
}
}
return std::string();
}
Expand Down Expand Up @@ -1183,11 +1191,16 @@ void GCodeGenerator::_init_multiextruders(const Print& print, std::string& out,
//set standby temp for reprap
if (std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) {
for (uint16_t tool_id : tool_ordering.all_extruders()) {
int standby_temp = int(print.config().temperature.get_at(tool_id));
if (standby_temp > 0) {
int printing_temp = int(print.config().temperature.get_at(tool_id));
if (printing_temp > 0) {
int standby_temp = printing_temp;
if (print.config().ooze_prevention.value)
standby_temp += print.config().standby_temperature_delta.value;
if (print.config().idle_temperature.is_enabled(tool_id)) {
standby_temp = print.config().idle_temperature.get_at(tool_id);
}
out.append("G10 P").append(std::to_string(tool_id)).append(" R").append(std::to_string(standby_temp)).append(" ; sets the standby temperature\n");
//out.append("G10 P").append(std::to_string(tool_id)).append(" S").append(std::to_string(printing_temp)).append(" ; sets the default temperature\n");
}
}
}
Expand Down Expand Up @@ -2889,17 +2902,21 @@ void GCodeGenerator::_print_first_layer_extruder_temperatures(std::string &out,
m_writer.set_temperature(temp, wait, first_printing_extruder_id);
} else {
// Custom G-code does not set the extruder temperature. Do it now.
if (!print.config().single_extruder_multi_material.value) {
// it's useful to do it when there is really multiple extruder, or if reprap because of the G10
if (!print.config().single_extruder_multi_material.value ||
std::set<uint8_t>{gcfRepRap}.count(print.config().gcode_flavor.value) > 0) {
// Set temperatures of all the printing extruders.
for (const Extruder& tool : m_writer.extruders()) {
int temp = print.config().first_layer_temperature.get_at(tool.id());
if (temp == 0)
temp = print.config().temperature.get_at(tool.id());
if (print.config().ooze_prevention.value && tool.id() != first_printing_extruder_id)
if (!print.config().idle_temperature.is_enabled(tool.id()))
temp += print.config().standby_temperature_delta.value;
else
if (print.config().ooze_prevention.value && tool.id() != first_printing_extruder_id) {
if (print.config().idle_temperature.is_enabled(tool.id())) {
temp = print.config().idle_temperature.get_at(tool.id());
} else {
temp += print.config().standby_temperature_delta.value;
}
}
if (temp > 0)
out += (m_writer.set_temperature(temp, false, tool.id()));
}
Expand Down Expand Up @@ -6764,11 +6781,11 @@ std::string GCodeGenerator::_before_extrude(const ExtrusionPath &path, const std
// go to midpoint to let us set the decel speed)
if (!last_pos_defined() || !last_pos().coincides_with_epsilon(path.first_point())) {
Polyline poly_start = this->travel_to(gcode, path.first_point(), path.role());
coordf_t length = poly_start.length();
const coordf_t length = poly_start.length();
if (length > SCALED_EPSILON) {
// compute some numbers
double previous_accel = m_writer.get_acceleration(); // in mm/s²
double previous_speed = m_writer.get_speed_mm_s(); // in mm/s
double previous_speed = m_writer.get_speed_mm_s(); // in mm/s
double travel_speed = m_config.get_computed_value("travel_speed");
// first, the acceleration distance
const double extrude2travel_speed_diff = previous_speed >= travel_speed ?
Expand All @@ -6781,7 +6798,8 @@ std::string GCodeGenerator::_before_extrude(const ExtrusionPath &path, const std
assert(!std::isinf(dist_to_go_travel_speed));
assert(!std::isnan(dist_to_go_travel_speed));
// then the deceleration distance
const double travel2extrude_speed_diff = speed_mm_s >= travel_speed ? 0 : (travel_speed - speed_mm_s);
const double travel2extrude_speed_diff = speed_mm_s >= travel_speed ? 0 :
(travel_speed - speed_mm_s);
const double seconds_to_go_extrude_speed = (travel2extrude_speed_diff / acceleration);
const coordf_t dist_to_go_extrude_speed = scaled(seconds_to_go_extrude_speed *
(travel_speed - travel2extrude_speed_diff / 2));
Expand Down Expand Up @@ -6843,26 +6861,35 @@ std::string GCodeGenerator::_before_extrude(const ExtrusionPath &path, const std
poly_start.clip_end(length * ratio);
poly_end.clip_start(length * (1 - ratio));
}
//gcode += "; acceleration to travel\n";
// gcode += "; acceleration to travel\n";
m_writer.set_travel_acceleration((uint32_t) floor(travel_acceleration + 0.5));
this->write_travel_to(gcode, poly_start,
"move to first " + description + " point (acceleration)");
// travel acceleration should be already set at startup via special gcode, and so it's
// automatically used by G0.
//gcode += "; decel to extrusion\n";
// gcode += "; decel to extrusion\n";
m_writer.set_travel_acceleration((uint32_t) floor(acceleration + 0.5));
this->write_travel_to(gcode, poly_end,
"move to first " + description + " point (deceleration)");
// restore travel accel and ensure the new extrusion accel is set
m_writer.set_travel_acceleration((uint32_t) floor(travel_acceleration + 0.5));
m_writer.set_acceleration((uint32_t) floor(acceleration + 0.5));
//gcode += "; end travel\n";
// gcode += "; end travel\n";
assert(!moved_to_point);
moved_to_point = true;
}
} else if (poly_start.size() == 2 && length < SCALED_EPSILON) {
// the travel is epsilon (can this really happen? maybe it needs to be investigated. I saw it happen one time with A21_borked project)
// last_pos().coincides_with_epsilon(path.first_point()) should have prevented this, but it works with SCALED_EPSILON / 2
// were's here because length is between SCALED_EPSILON / 2 and SCALED_EPSILON.
// => No travel needed.
assert(last_pos_defined());
m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5));
assert(!moved_to_point);
moved_to_point = true;
} else {
// this can only happen when !last_pos_defined(), and then poly_start has only one point
assert(poly_start.size() == 1 && !last_pos_defined());
assert(!last_pos_defined() && poly_start.size() == 1);
m_writer.set_travel_acceleration((uint32_t) floor(acceleration + 0.5));
m_writer.set_acceleration((uint32_t) floor(acceleration + 0.5));
this->write_travel_to(gcode, poly_start,
Expand All @@ -6871,6 +6898,8 @@ std::string GCodeGenerator::_before_extrude(const ExtrusionPath &path, const std
moved_to_point = true;
}
} else {
assert(last_pos_defined());
assert(moved_to_point);
m_writer.set_acceleration((uint32_t)floor(acceleration + 0.5));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/MultiMaterialSegmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ static std::vector<ExPolygons> extract_colored_segments(const std::vector<Colore
edge->color(VD_ANNOTATION::DELETED);

if (next_vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR || next_vertex.color() == VD_ANNOTATION::DELETED) {
assert(next_vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR);
// assert(next_vertex.color() == VD_ANNOTATION::VERTEX_ON_CONTOUR); ? and for DELETED ?
break;
}

Expand Down
53 changes: 42 additions & 11 deletions src/platform/osx/BuildMacOSImage.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,39 @@ done
# copy bin and do not let it lower case
cp -f bin/@SLIC3R_APP_CMD@ pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
chmod u+x pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
cp /usr/local/opt/zstd/lib/libzstd.1.dylib pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/libzstd.1.dylib


echo "otool -L exefile:"
otool -L pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
echo "END otool"

#copy libzstd
ZSDT_FILE=
echo "libzstd:\n"
ls -al /opt/homebrew/opt/zstd/lib/libzstd*.dylib
ls -al /usr/local/opt/zstd/lib/libzstd*.dylib
ZSDT_PATH=$(ls -v /usr/local/opt/zstd/lib/libzstd.1.*.dylib | tail -n 1)
if [ -z "${ZSDT_FILE}" ]
then
# try with homebrew
ZSDT_PATH=$(ls -v /opt/homebrew/opt/zstd/lib/libzstd.1.*.dylib | tail -n 1)
fi
ZSTD_FILE=$(basename ${ZSDT_PATH})
echo "zstd var:'"$ZSDT_PATH"' : "$ZSTD_FILE;
cp $ZSDT_PATH pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/Frameworks/$ZSTD_FILE
ls -al pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/Frameworks/
install_name_tool -change $ZSDT_PATH @executable_path/../Frameworks/$ZSTD_FILE pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
install_name_tool -change /opt/homebrew/opt/zstd/lib/libzstd.1.dylib @executable_path/../Frameworks/$ZSTD_FILE pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
install_name_tool -change /usr/local/opt/zstd/lib/libzstd.1.dylib @executable_path/../Frameworks/$ZSTD_FILE pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@

echo "otool -L exefile now:"
otool -L pack/@SLIC3R_APP_KEY@/@[email protected]/Contents/MacOS/@SLIC3R_APP_KEY@
echo "END otool"

# } &> $ROOT/Build.log # Capture all command output
echo -e "\n ... done\n"

DMG_NAME=@SLIC3R_APP_KEY@${VERSION_NUMBER}-$OS_NAME.dmg

if [[ -n "$BUILD_IMAGE" ]]
then
echo -e "\n[9/9] Creating .tgz and DMG Image for distribution..."
Expand All @@ -91,26 +119,28 @@ echo -e "\n[9/9] Creating .tgz and DMG Image for distribution..."

# create dmg
hdiutil create -ov -fs HFS+ -volname "@SLIC3R_APP_KEY@" -srcfolder "pack/@SLIC3R_APP_KEY@" temp.dmg
hdiutil convert temp.dmg -format UDZO -o @SLIC3R_APP_KEY@${VERSION_NUMBER}-$OS_NAME.dmg
hdiutil convert temp.dmg -format UDZO -o $DMG_NAME
rm -f temp.dmg
popd

} &> $ROOT/Build.log # Capture all command output

# check if evrything went well
if [ -e $OS_NAME.dmg ]; then
if [ -e $OS_NAME ]; then
echo -e "\n ... done\n"
else
# something went wrong, publish log
echo -e "\n ... fail\n"
ls -al
cat $ROOT/Build.log
fi
fi

if [[ -e $OS_NAME.dmg ]]
if [[ -e $DMG_NAME ]]
then

echo -e "\nsuccess, returning.\n"
exit 0
else
echo -e "\n[9/9 (bis)] Creating .tgz and DMG Image for distribution... again"
echo -e "\n[9/9 (bis)] Creating .tgz and DMG Image for distribution... again"
{
echo killing...; sudo pkill -9 XProtect >/dev/null || true;
echo waiting...; while pgrep XProtect; do sleep 3; done;
Expand All @@ -120,18 +150,19 @@ echo -e "\n[9/9 (bis)] Creating .tgz and DMG Image for distribution... again"

# create dmg
hdiutil create -ov -fs HFS+ -volname "@SLIC3R_APP_KEY@" -srcfolder "pack/@SLIC3R_APP_KEY@" temp.dmg
hdiutil convert temp.dmg -format UDZO -o @SLIC3R_APP_KEY@${VERSION_NUMBER}-$OS_NAME.dmg
hdiutil convert temp.dmg -format UDZO -o $DMG_NAME
rm -f temp.dmg
popd
} &> $ROOT/Build.log # Capture all command output

# check if evrything went well
if [ -e $OS_NAME.dmg ]; then
if [ -e $DMG_NAME ]; then
echo -e "\n ... done\n"
else
# something went wrong, publish log
echo -e "\n ... fail\n"
ls -al
cat $ROOT/Build.log
exit 1 # terminate and indicate error
fi
fi

4 changes: 2 additions & 2 deletions src/slic3r/GUI/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,8 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
//assert(m_layers_times.size() == m_values.size() - 1 || m_layers_times.size() == m_values.size() || m_layers_times.empty());
//assert(m_layers_values.empty());
}
const size_t layer_number = is_preview_not_gcode ? value + 1 : value;
const size_t time_idx = is_preview_not_gcode ? value : value - 1;
const size_t layer_number = is_preview_not_gcode ? value : value + 1;
const size_t time_idx = is_preview_not_gcode ? value : value;

// When "Print Settings -> Multiple Extruders -> No sparse layer" is enabled, then "Smart" Wipe Tower is used for wiping.
// As a result, each layer with tool changes is splited for min 3 parts: first tool, wiping, second tool ...
Expand Down
Loading

0 comments on commit d0d86fb

Please sign in to comment.