When Fill bed with copies has to place more copies than its arrange
step handles, it places them on a grid, which did not number them, so
every copy was named "<name> -1". Number them as the arranged copies
are.
Ported from bambulab/BambuStudio@78aa0a5a31
Co-authored-by: teng.ye <teng.ye@bambulab.com>
A part copied from one object and pasted into another kept its matrix
relative to the object. When the two objects had different scales or
rotations, the pasted part took on the second object's on top of its
own, so a part copied at 100% into an object scaled to 200% came out
twice as large. Correct the part's matrix by the difference between the
two objects.
Ported from bambulab/BambuStudio@0e8b34088f
Co-authored-by: teng.ye <teng.ye@bambulab.com>
A user preset is saved as its differences from the parent. For the
per-nozzle options of multi-extruder printers, every slot equal to the
parent is written as "nil". Importing such a preset applied it over its
parent as it was, so the "nil" slots replaced the parent's values, and
the imported preset held placeholders for speeds, accelerations, flows
and nozzle settings until Orca was restarted and loaded it again. Merge
it the way the preset loader does.
Ported from bambulab/BambuStudio@bb1db5dd7c
Co-authored-by: Zhiyuan Dou <zhiyuan.dou@bambulab.com>
The two-option switch of the Bambu device dialogs compared the click in
screen coordinates with 0. On a monitor to the left of the main one,
screen coordinates are negative, so every click picked the right
option. Compare the position within the control instead.
Ported from bambulab/BambuStudio@6a3e8bb388
Co-authored-by: Max Paperno <max@wdg.us>
The Windows launcher reads --sw-renderer and --no-sw-renderer to choose
between the system OpenGL driver and Mesa, then passed them on with the
other arguments. The app's command line parser doesn't know them and
exits with an invalid option, so the Mesa fallback could never be
forced. Keep them in the launcher. #11281 restores the --sw-renderer
definition instead, which still leaves --no-sw-renderer rejected.
Ported from Snapmaker/OrcaSlicer@ebde164a10
Co-authored-by: johnson.yzs <yinzhaosheng@snapmaker.com>
GUI_Run() gave wxEntry() the UTF-8 argv[0], which wxWidgets decodes with
the ANSI code page. When OrcaSlicer is installed in a folder with
non-ASCII characters, such as a Chinese user name, the conversion fails
and wxWidgets warns at startup that command line argument 0 couldn't
be converted to Unicode. Pass the same app path to the UTF-16 overload.
Ported from Snapmaker/OrcaSlicer@722e8d8444
Co-authored-by: Joyx <48636909+iesteem@users.noreply.github.com>
The spin input, the scrolled window and full width setting fields size
their inner controls by subtracting labels, buttons and margins from
their own size. Before the first layout, or when a label is wider than
the control, that size is negative, and GTK rejects it with a
gtk_widget_set_size_request assertion and keeps the old geometry. At
startup this logged hundreds of assertions on Linux. Clamp these sizes
to zero.
Ported from Snapmaker/OrcaSlicer@14221150a4
Co-authored-by: johnson.yzs <yinzhaosheng@snapmaker.com>
Dropping a G-code on the window first switched to the Prepare tab.
When the G-code was the one already open, load_gcode() returned before
switching to the preview, so the user was left on an empty Prepare
page and the G-code seemed to be gone. Show the preview in that case,
and keep the preview when a G-code is dropped in G-code preview mode.
Ported from Snapmaker/OrcaSlicer@21a68ae945
and Snapmaker/OrcaSlicer@c5ed6c1098
Co-authored-by: kenshin627 <87zhaoxiaobo@163.com>
Split to objects made a new object from each part and dropped every
negative part, modifier, support blocker and enforcer without notice.
An object of a single part with a negative part also counted as one of
several parts, so it could not be split into its pieces at all. Count
only the parts, and give each other volume to the new object it
overlaps most, in the same place.
Ported from Snapmaker/OrcaSlicer@b5ff9ce0ae,
without its label that tracks which object of an assembly each volume
came from.
Co-authored-by: bluetianyu <421966588@qq.com>
Slice all set a flag that nothing cleared when it finished, failed, was
cancelled or stopped at a plate it could not slice. A later slice
started without going through the Slice buttons, such as the automatic
slice after a change, was then taken for the next step of Slice all:
after a cancelled Slice all or a new plate it went on to slice and
select the following plates.
Ported from Snapmaker/OrcaSlicer@0d85ce65ee
Co-authored-by: wudi901 <wudi@snapmaker.com>
When a filament was deleted, a part's support, support interface or
brim filament was renumbered into the config of its object instead of
the part's, overwriting the object's own value. A part that used the
deleted filament was switched to the replacement filament, but the
object list kept showing the object's filament for it.
Ported from Snapmaker/OrcaSlicer@d4947f3cbe
and Snapmaker/OrcaSlicer@e89263e51a
Co-authored-by: Rad <radugheorghiu96@gmail.com>
Co-authored-by: xiaoyeliu <xyliu_leo@163.com>
The mesh boolean tool transformed both meshes into object space without
fixing the winding of a mirrored part, so mcut got an inside-out mesh
and the union, difference or intersection failed or came out wrong.
Flip the triangles of a mirrored mesh, as the other transforms do.
Ported from Snapmaker/OrcaSlicer@c7a5bb6ffa
Co-authored-by: mwz-iot <2952410757@qq.com>
Every preset reload calls set_printer_technology(), which hid the
slicing progress even when the technology stayed the same. A reload
that does not invalidate the print, such as a preset sync from a
connected printer, left the slice running with no progress and no
cancel button until it ended. Hide it only when the technology changes;
an invalidated slice is still hidden by the background process update.
Ported from Snapmaker/OrcaSlicer@99e66ae171
Co-authored-by: chenpenggui <155463329+gushanji@users.noreply.github.com>
With several objects selected, the menu checked all of them but only
the first was subdivided. Subdividing an object also rounded its
modifiers, negative parts and support blockers, which changes what they
cover. And for selected parts, the open edges were taken from the whole
object instead of from the parts. Subdivide every selected object, only
its model parts, and check the meshes that are actually subdivided.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: jianglinfeng <jianglinfeng@snapmaker.com>
Importing vertex colors skipped the faces whose vertices were all on
filament 1, but the test read "<= 2" for the third vertex, so a face
with a filament 2 corner in that position lost its paint. It also
assumed the object's filament is 1, while it is the filament of the
first vertex. Skip only the faces that are entirely in the object's own
filament. Only the command line reaches this since the GUI imports
colors as textures.
Ported from Snapmaker/OrcaSlicer@22fae6ccbf
Co-authored-by: WongZzz <1184075697@qq.com>
The cut tool's undo state held the dovetail shape but not the number of
dovetails or the gap between them, so undo left both as they were.
Changing the count with its buttons did not take a snapshot either.
Save both in the state and take a snapshot when the count changes.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: mwz-iot <mawenzhi@snapmaker>
The preview built all dovetails from one set of slot coordinates, and the
back face of each dovetail shifted them in place. The second dovetail and
the ones after it started from the shifted values, so they drifted
deeper and wider, and so did the vertices that decide whether the groove
is valid. Start each dovetail from its own copy.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: mwz-iot <mawenzhi@snapmaker>
A dovetail cut copied the object for each groove with clone_for_cut(),
which allocates an object that no model owns, and only cleared its
volumes afterwards, so every groove of every cut leaked an object. Copy
it into a model of its own that goes away after the groove.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: mwz-iot <mawenzhi@snapmaker>
Outside the assembly view, volumes far from the plates are already left
out of the box the camera fits to. The assembly view merged every
volume, so a single non-finite or absurdly distant transformation, as
some projects saved by other slicers carry, blew the box up and left the
view blank. Skip volumes whose box is not finite or lies beyond 100 km.
Ported from Snapmaker/OrcaSlicer@fd6e55e734
Co-authored-by: johnson.yzs <yinzhaosheng@snapmaker.com>
These tools hide the unselected volumes while they are open and show
them again when they close, but only changed the volumes' active flag.
A scene reload while a tool was open, after an assembly move for
example, registered the hidden volumes' raycasters as inactive, so the
other objects could not be picked after the tool closed. Update the
volume raycasters together with the flag, as the other visibility
toggles do.
Ported from Snapmaker/OrcaSlicer@fd6e55e734
Co-authored-by: johnson.yzs <yinzhaosheng@snapmaker.com>
The brush caps the length of the edges it splits at 0.05 mm, and the
height range tool at 0.1 mm. Edges are measured in mesh units, so on a
part stored large and scaled down (a model in micrometres, for example)
the caps shrank with the scale: at 1% every stroke split triangles down
to 0.0005 mm, which made painting slow. Widen the caps by the scale so
they hold in millimetres. Unscaled and enlarged parts are unchanged.
Ported from Snapmaker/OrcaSlicer@fd6e55e734
Co-authored-by: XieJiajun <68017138+PILIPALA030@users.noreply.github.com>
Opening a G-code file filled in only the cost of the print statistics.
The preview legend then showed 0 for the total filament and a negative
model filament, because it subtracts the support and tower filament from
those totals. Compute the length and weight from the processed volumes
as well.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: Changwei <yanchangwei@snapmaker.com>
Fix mixed temperature preference path in warning
Update the incompatible nozzle temperature message to point to
Preferences / Behaviour / Prepare. Update the localization catalogs
using the existing translated preference labels.
A slope lift rises along a travel. Since the H2D port, a lift with no travel
after it, before a toolchange or a timelapse frame, was a spiral with Slope
Lift, though Slope never spirals elsewhere. It now goes straight up, as it did
for every Z-hop type up to 2.3.1. Auto and Spiral Lift still spiral there, as
Auto does at a layer change, and every Bambu Lab profile uses Auto Lift.
Without a prime tower, or with a Type 2 one, GCode::set_extruder()
lifted in a spiral before the filament change whatever the Z hop type,
so printers set to Normal Lift spiralled at every toolchange. Follow
the Z hop type, as the Type 1 tower already did: Normal Lift lifts
straight up, and Auto, Slope and Spiral Lift lift in a spiral, since a
slope needs a travel to follow. The two places that already mapped it
this way now share the helper.
Bambu Studio's cooling buffer read ;_SET_FAN_SPEED_CHANGING_LAYER to set
the layer's fan speed after the layer change. Orca's cooling buffer no
longer reads it, since the merge of Bambu Studio 1.7.4, so the marker
was left in every file as a comment. It sent no command, so nothing
else in the G-code changes.
The post-process and pre-heat passes of the G-code processor still
asked "Is the disk full?" only. Add the system error below, as the
G-code export does, and clear errno before each write and flush, so a
failure that sets no error code does not report an older one.
ToolOrdering::tools_for_layer() only asserts that the Z it is given is
in the tool ordering, so a release build would read past its end if
the layer lists ever disagreed. A layer the tool ordering doesn't hold
is now counted, as every layer was before. The comment now says what
the count leaves out.
The rule that skips the retraction on Hilbert curve surfaces also
skipped the retraction for a toolchange, which GCode::set_extruder()
asks for without a role. On a first layer with Hilbert curve bottom
surfaces and no wipe, a toolchange then happened without any
retraction. Keep the skip for travels only.
Spiral vase mode rewrote a lone G1 Z with an absolute height and let a
lift set the layer's starting height, also in relative positioning, so
custom G-code that lifts the nozzle with G91 moved it by the wrong
amount. Leave a move read in relative positioning as it is, keep it out
of the starting height, and read each layer from absolute positioning,
as it starts with Orca's own moves.
Custom G-code that switches to G91 and back through a macro, such as
RESTORE_GCODE_STATE, left the fan mover's reader in relative positioning
for the rest of the print, so it measured every later move wrong and
split none. Orca's own moves, which follow a role tag, are absolute, or
the print itself would go wrong, so put the reader back to absolute
positioning at each role tag.
The G-code writer ignored the results of fwrite() and fflush(), and a
failed export always asked "Is the disk full?". Keep the first system
error and show it below that question, so a missing permission or a
removed drive says what went wrong.
Ported from bambulab/BambuStudio@302cadf9b9
Co-authored-by: BenJule <benjamin.luetker@gmail.com>
The conflict check offsets the prime tower by the plate origin it was
given, while the objects are already at their plate positions. The
Type 1 tower passed the plate origin, but the Type 2 tower passed zero,
so on plates 2+ it was checked as if it stood on the first plate and
conflicts with the objects there were missed. #12742 makes the same
change.
Ported from Snapmaker/OrcaSlicer@c75ddaabac
Co-authored-by: lhx <luohaoxuan@snapmaker.com>
GCodeReader read every X, Y and Z as absolute, also after G91. Custom
G-code that lifts the nozzle with "G91 / G1 Z2 / G90" left the reader
2 mm low, and the next absolute Z move looked like a move up. When the
fan mover then split that move to place a fan command earlier, it
wrote a Z between the wrong height and the target, so the nozzle dipped
into the print. Track G90 and G91, and make the distances and targets
of a line relative while G91 is in effect. The fan mover no longer
splits a move read in relative mode, since the split writes absolute
coordinates.
Ported from Snapmaker/OrcaSlicer@99d613e354
Co-authored-by: lhx <luohaoxuan@snapmaker.com>
GCodeReader went on to fread() from the FILE* even when opening the file
had failed. On Windows that null handle aborts the app through the CRT's
invalid parameter handler; elsewhere it is undefined behaviour. Return
false instead, as for a read error.
Ported from Snapmaker/OrcaSlicer@24593a3b77
Co-authored-by: Joyx <48636909+iesteem@users.noreply.github.com>
Print::extruders() adds the prime tower filament when more than one
filament is in use, but it counted them before removing duplicates.
Supports printed with the object's filament, or a brim filament equal
to it, list that filament twice. A plate printing a single filament
then gained the prime tower filament, which kept the prime tower
enabled, printed it with that filament and heated its extruder.
Ported from Snapmaker/OrcaSlicer@40adf181d8
Co-authored-by: lujiaxin <1091917314@qq.com>
After a toolchange on the Type1 prime tower, the wipe path was built in
plate coordinates while the nozzle position includes the plate origin.
On every plate but the first, the wipe that ends the toolchange headed
toward the first plate instead of along the tower. The Type2 tower and
the nozzle change path already add the plate origin.
Found through Snapmaker/OrcaSlicer@407dc6f68e,
which adds the plate origin to the same wipe in the fork's version of
the Type2 path.
Co-authored-by: fire2wind <1229725087@qq.com>
The cooling buffer only handled the end marker of a support interface
when it had acted on the start marker. When it had not, for example on
a raft printed while the fan is still held off, the end marker fell
through and ";_SUPP_INTERFACE_FAN_END" was written to the G-code.
Handle the end marker unconditionally, as the ironing one already is.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: lujiaxin <1091917314@qq.com>
A wipe retracts only part of the length and leaves the rest, including
retract_after_wipe, to the regular retraction that follows. On the first
layer with Hilbert curve bottom surfaces, and on Hilbert curve top
surfaces, that retraction is skipped, so the rest was silently dropped.
Always finish the retraction once a wipe has started it.
Ported from Snapmaker/OrcaSlicer@b070bcfaff
Co-authored-by: lhx <luohaoxuan@snapmaker.com>
The layer count behind [total_layer_count] and "; total layers count"
included every object and support layer. process_layer() skips a layer
whose tool ordering has no extruder, such as the tip of a cone that is
too thin for a wall, so the count could be higher than the layer changes
in the file. Printers that report progress from it with
SET_PRINT_STATS_INFO then stopped short of the last layer. On flat beds,
count only the layers their tool ordering prints. Belt printers keep
their own filter.
Found by Snapmaker/OrcaSlicer@b070bcfaff,
which rewrites the count afterwards instead.
Co-authored-by: zengerqi <zengerqi@snapmaker.com>
Smoothing the color regions of an imported texture traced each
boundary by calling itself once per vertex. On a large OBJ the
boundaries have enough vertices to overflow the 512 KB stack of a macOS
worker thread, and the import crashed. Trace them in a loop instead.
Ported from bambulab/BambuStudio@fa624a2577
Co-authored-by: sheng.zhang <sheng.zhang@bambulab.com>
With a painting tool open, Ctrl+clicking another object in the object
list updated the tool before closing it. The selection then spanned two
objects, its object index was -1, and reading the model object at that
index crashed.
Ported from bambulab/BambuStudio@b7d083bf65
Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
Dragging text or an SVG over a surface kept a pointer to its GLVolume
from the start of the drag. A "use surface" job finished between two
drags rebuilds the volume, and the next drag read the freed one and
could crash. Look the volume up again on each step.
Ported from bambulab/BambuStudio@c3b0156127
Co-authored-by: andrew hunt <andrew@hunt.codes>
Rebuilding the GUI, after a language change for example, shuts the
removable drive manager down and starts it again. Shutting down did not
release the macOS observer of mounted drives, so each rebuild left one
behind that kept reporting drives, and builds with asserts aborted.
Release it, and start its pointer as null, which registering asserts:
it was null only because the manager is created with make_unique.
Ported from bambulab/BambuStudio@406cac36e7
Co-authored-by: zhenze.xu <zhenze.xu@bambulab.com>
Closing Orca while the startup sync of presets and plugins was running
crashed on exit. The threads only saw their cancel flag once
~PresetUpdater ran, after the main window with its plater and the app
config were gone, and the sync thread checked it in a few places only,
so it went on to call into them. Read the app settings it needs before
starting the thread, make the flag atomic and check it at each step,
and stop and join the threads when the main window closes, and again in
GUI_App::OnExit().
Ported from bambulab/BambuStudio@fc560922da
Co-authored-by: baijie <tonghao.yuan@bambulab.com>
The tools read the selection's bounding box when they draw, which an
empty selection doesn't have. Shift clicking empty space now closes
them, but other paths can still empty the selection while one is open.
Ported from bambulab/BambuStudio@1f3e6bd71a
Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
A Shift click, or a Shift rectangle, on empty space removed the
selection directly. The Move, Rotate or Scale tool stayed open and read
the empty selection on the next frame, which crashed with a part
selected, and the object list kept showing the old selection. Deselect
the way a plain click on empty space does, which also closes the tool.
Bambu Studio fixes the same crash by guarding the tools instead, in
bambulab/BambuStudio@1f3e6bd71a, which the
next commit ports.
Slicing a multi-extruder plate in manual mode from the command line
read the filament map without checking its length. A map shorter than
the plate's filaments read past its end in the printability check,
which crashed or gave a bogus "can not be printed on extruder" error.
Read a filament the map leaves out as nozzle 1, as the final map does.
Since #17476, a nozzle the printer doesn't have already maps to nozzle 1.
Ported from bambulab/BambuStudio@bdfd004de8
Co-authored-by: Sterling G. Baird <sterling.baird@byu.edu>