Duet wifi S3D
-
@brianhanifin said in Duet wifi S3D:
--------------------------16eea21da68ae83e
Content-Disposition: form-data; name="file"; filename="curl_test.gcode"
Content-Type: application/octet-stream@dc42
I'm currently implementing the G-Code upload for Slic3rPE and struggeling with the same problem mentioned by @BrianHanifin .
Some parts of the HTTP-Header are saved in the G-Code after upload when uploading the G-Code using form_add of libcurl.
Is it somehow possible to support forms in the firmware?Thanks,
Best regards
Martin -
HI,
I have just installed a Duet Wifi and running well...However, I cant work out how to get the slicer to control bed temp. Simplify3D wants tools and laser to be indicated as T0 to T5, and Duet indicates bed as 'B' .... Yes, I can and do control bed temp manually prior to printing, but I want it auto controlled by g-code.
Could the gurus here help please ?
Thanks
-
I think you are overthinking it. Do you have multiple beds?
If not, default setting in S3D is OK, it will output M140 S70 to set bed temperature to 70°C, and that works with Duet -
In case anyone's interested... here's how I print from Linux...
#!/usr/bin/env bash echo "$(date) $@" >> /var/log/pp.log printit() { set +xe op="$1" of=$(basename "$op") ncftpput -t 5 duet0 /gcodes/ "$op" || ncftpput -t 5 -v duet0 /gcodes/ "$op" # I do the ncftpput again if the first one fails as it does sometimes. fn=$(python -c "import urllib ; print(urllib.urlencode({'gcode': 'M32 \"$of\"'}))") echo $fn curl "http://duet0/rr_gcode?$fn" echo "Done" } printit "$@" 2>&1 >> /var/log/pp.log
save that someplace and make it executable. You do need ncftpput (part of ncftp package), curl and python (both of which are standard). There are no issues with spaces in the filename BTW.
In Simplify3D Process, Scripts, Post Processing put something like...
/bin/bash /data1/3d/duet/pp.sh "[output_filepath]"
substituting "/data1/3d/duet/pp.sh" with wherever you put the script.
All you have to do now is 'Save Toolpaths To Disk" and the file should transfer and start printing after the save is complete.I have also had good luck printing directly from Simplify3D.
Like others have said, you need to set "M555 P2" at the end of your config.g to turn on Marlin emulation and you also have to set "Hardware Flow Control" in the firmware Communications settings.If I didn't have the PanelDue 7i, I'd print directly. I'm not overly fond of having to switch desktop windows around to start the print.
-
I've cobbled up a quick powershell script for the purpose when I got my Duet. It watches a folder for new/changed .gcode files and offers to upload them.
# adjust these to your values $folder = "e:\3dprint\gcodes" $filter = "*.gcode" $Global:baseUri = "http://duet3d.local/rr_upload?name=gcodes/" Add-Type -AssemblyName PresentationCore,PresentationFramework $Global:lastPath = '' $Global:lastTime = Get-Date $Watcher = New-Object IO.FileSystemWatcher $folder, $filter -Property @{ IncludeSubdirectories = $false NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite' } $changeAction = [scriptblock]::Create(' $path = $Event.SourceEventArgs.FullPath $name = $Event.SourceEventArgs.Name $timeGenerated = $Event.TimeGenerated # usually multile change events are triggered when a file is written, no need to spam those if ($Global:lastPath -ne $path -or ($Global:lastTime - $timeGenerated).TotalSeconds -lt -10) { $Global:lastPath = $path; $Global:lastTime = $timeGenerated $msgBoxResult = [System.Windows.MessageBox]::Show(("Upload `"{0}`" to the printer?" -f $Event.SourceEventArgs.Name),"GCode Upload","YesNo","Question") switch ($msgBoxResult) { "Yes" { try { Invoke-WebRequest -Uri ("{0}{1}" -f $baseUri, $name) -Method Post -InFile $path } catch { } } "No" { } } } ') $onChanged = Register-ObjectEvent $Watcher Changed -SourceIdentifier FileChanged -Action $changeAction # prevent the console from closing while (1) { sleep 2 }
Save somewhere with .ps1 extension and edit line 2-4 to match your settings. To run it rightclick the file -> "Run with PowerShell" and leave the powershell window open. To trigger the upload question just save your gcode file into the folder you specified in line 2.
-
For anyone still looking through this thread, the following S3D script will upload the file to your printer (with a timestamp) and tell it to start printing that file much like Slic3r would do:
curl -F "file=@[output_filepath]" "http://XXX.XXX.XXX.XXX/rr_upload?name=gcodes/[output_filename].gcode&time=YYY" curl "http://XXX.XXX.XXX.XXX/rr_gcode?gcode=M32[output_filename].gcode"
Copy and paste into "Additional terminal commands for post processing" under the Scripts tab and replace XXX.XXX.XXX.XXX with your printer's IP address or hostname if applicable. As mentioned above, DWC will throw a couple of errors but doesn't seem to impact the print in any way. Happy printing!
-
You may wish to add the following line at the end:
curl "http://XXX.XXX.XXX.XXX/rr_disconnect"
This will avoid RRF buffering up messages that S3D isn't going to fetch.
-
I have try pathio alpha/beta versions and have Duet integration, to upload files, and they do not add any header to gcode file uploaded.
-
Worked on this for a while and was able to resolve the issue where file names are truncated if the name contains a space.
Basically all it does is replace spaces in the file name with %20, a simple form of URL Encode. It also uses --data-binary and does not add any extra text to the Gcode like the -F option does. Paste this into the 'Additional terminal commands for post processing' on the Scripts tab of Simplify 3d... don't forget to change the IP address. I'm sure there's a more elegant way but this works on a Mac.
bash -c "echo 'http://xxx.xxx.xxx.xxx/rr_upload?name=gcodes/[output_filename].gcode' | sed 's/ /%20/g' | curl --data-binary '@[output_filepath]' $(</dev/stdin)";
-
Hello, sry for bumping this thread, but just wanted to say thank you for this. Been wanting this 'feature' for awhile now, and just found this thread and got it working! WOOT!
But I do get a error when starting the file. Is there a way to eliminate the error? Thanks!
My script is as follows:
curl -F "file=@[output_filepath]" "http://192.168.0.10/rr_upload?name=gcodes/[output_filename].gcode&time=YYY" ; uploads file to printer
; curl "http://192.168.0.10/rr_gcode?gcode=M32[output_filename].gcode" ; Starts the file printing
curl "http://192.168.0.10/rr_disconnect" ; Not sure what this one does -
Searching the firmware source for "Bad command" seems to suggest the firmware is taking the HTTP header to be part of the g-code to process?
Maybe try getting curl to use a minimum of headers, seem to recall DWC not using a fully http compliant parsing of the requests after having looked into something else.
ref: https://stackoverflow.com/questions/31293181/how-can-i-remove-default-headers-that-curl-sends
may be out of luck with adding
-H 'Content-Disposition:' -H 'Content-Type:'
but try it and see if things have changed the last 2 years or when that comment was from.. -
Seems its the file uploading enforcing the Content-Type to be multipart, which breaks the parsing.
workaround:
curl --data-binary "@[output_filepath]" "http://10.10.0.169/rr_upload?name=gcodes/[output_filename].gcode&time=YYY" curl "http://10.10.0.169/rr_disconnect"
which was mentioned in the post just above yours...
-
@bearer That code works as long as there are no spaces in the name.
-
@etrigan63 said in Duet wifi S3D:
no spaces
thats a limitation of the URL specification, replace spaces with
%20
if you need them, but in general you will find life much simpler by using-
or_
or any other delimiter instead of spaces in filenames.as aworkaround you could try adding
--data-urlencode
to the curl commandline but I haven't tried it. -
I made it easier
App:
https://mega.nz/file/ywgiCS5Y#kHK4-RvvnkdyTL-yI6dlYlC_4e3lTijv3ViF1e0QLiY
(windows exe file, didn't obfuscate so you can check that it's no more than an uploader)
You'd need .NET Framework 4.6.2 or newerCommand:
"C:\path\path\FileUploadProgress.exe" "Uploading print file..." "[output_filepath]" "http://duet_replicator.local/rr_upload?name=gcodes/[output_filename].gcode"
curl "http://duet_replicator.local/rr_disconnect"Preview:
Comments: (for anyone without previous experience with this method)
You must be logged in to you web interface from a browser for that to work -
@orc Perhaps you could make a dedicated post to share your uploader app to increase visibility?