prusa3d / PrusaSlicer

G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)
https://www.prusa3d.com/prusaslicer/
GNU Affero General Public License v3.0
7.62k stars 1.92k forks source link

[>=2.4.0] G-code Viewer - can't edit gcode file while opened in viewer #8049

Open fe60 opened 2 years ago

fe60 commented 2 years ago

Version

2.4.0, 2.4.1-rc1

Operating system type + version

Windows 10 21H2 (build 19044.1586)

Behavior

I can't save changes done in a text editor while the modified g-code file is open in the g-code viewer. Save works after closing the g-code viewer.

I can reproduce this behavior with 2.4.0 and 2.4.1-rc1. It works as expected using G-code Viewer 2.3.3.

Is this a new feature request? No.

foreachthing commented 2 years ago

I agree. The viewer should open the file as read-only and ask to reload if it was changed

fe60 commented 2 years ago

@foreachthing Not blocking write operations of other software is all I'm asking for. Manual reload has been added in 2.3.0 (https://github.com/prusa3d/PrusaSlicer/issues/5360) and the automatic reload has been requested by another user (https://github.com/prusa3d/PrusaSlicer/issues/6363).

bubnikv commented 2 years ago

The issue is caused by memory mapping the G-code for visualizing the G-code block if you move the horizontal slider. We have the following options to "fix" the "issue":

1) Copy the viewed G-code into a temp file, that may take quite some time. 2) Load the G-code into RAM, that may use quite a lot of RAM, which may be troublesome on low end systems. 3) Don't show the G-code text. 4) Lock / Unlock the G-code just to pull the g-code block to be shown on the screen. This one has the risk that the file will be modified at the background, thus a different file will be accessed.

pá 11. 3. 2022 v 7:50 odesílatel fe60 @.***> napsal:

@foreachthing https://github.com/foreachthing Not blocking write operations of other software is all I'm asking for. Manual reload has been added in 2.3.0 (#5360 https://github.com/prusa3d/PrusaSlicer/issues/5360) and the automatic reload has been requested by another user (#6363 https://github.com/prusa3d/PrusaSlicer/issues/6363).

— Reply to this email directly, view it on GitHub https://github.com/prusa3d/PrusaSlicer/issues/8049#issuecomment-1064825009, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMPSIYXLQUU3CEKGNUDSBLU7LUKFANCNFSM5QM5RBLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

foreachthing commented 2 years ago

@bubnikv can't the gcode file be opened as read only? Why would it need write access?

bubnikv commented 2 years ago

The file needs to be guarded against modification while it is being memory mapped for viewing.

fe60 commented 2 years ago

@bubnikv wrote We have the following options to "fix" the "issue": 1) Copy the viewed G-code into a temp file, that may take quite some time.

IMHO building a laggy workaround would be waste of developers time.

2) Load the G-code into RAM, that may use quite a lot of RAM, which may be troublesome on low end systems.

Could this be added as a switchable feature? By default the current memory-mapping is used. Users who want to edit G-code files while it's shown in the G-code viewer, have to enable the in-memory buffer and need a system with sufficient amount of memory.

3) Don't show the G-code text.

Show G-code or allow editing of open G-code files? Keep G-gode listing.

4) Lock / Unlock the G-code just to pull the g-code block to be shown on the screen. This one has the risk that the file will be modified at the background, thus a different file will be accessed.

I'm afraid I did not get the point.