Print3dServer.Core
1.0.2-preview2
dotnet add package Print3dServer.Core --version 1.0.2-preview2
NuGet\Install-Package Print3dServer.Core -Version 1.0.2-preview2
<PackageReference Include="Print3dServer.Core" Version="1.0.2-preview2" />
paket add Print3dServer.Core --version 1.0.2-preview2
#r "nuget: Print3dServer.Core, 1.0.2-preview2"
// Install Print3dServer.Core as a Cake Addin #addin nuget:?package=Print3dServer.Core&version=1.0.2-preview2&prerelease // Install Print3dServer.Core as a Cake Tool #tool nuget:?package=Print3dServer.Core&version=1.0.2-preview2&prerelease
Print3dServer.Core
A C# based core library for our 3d Print Server nugets (Moonraker, Repetier Server, OctoPrint and so on)
Support me
If you want to support me, you can order over following affilate links (I'll get a small share from your purchase from the corresponding store).
- Prusa: http://www.prusa3d.com/#a_aid=AndreasReitberger *
- Jake3D: https://tidd.ly/3x9JOBp *
- Amazon: https://amzn.to/2Z8PrDu *
(*) Affiliate link Thank you very much for supporting me!
Nuget
Available print servers
- OctoPrint (https://github.com/AndreasReitberger/OctoPrintRestApiSharp)
- Repetier Server (https://github.com/AndreasReitberger/RepetierServerSharpApi)
- Moonraker (https://github.com/AndreasReitberger/KlipperRestApiSharp)
Planned
- PrusaConnect
Usage
Base Client
In order to create your own PrintServerClient
, inherit from the base client Print3dServerClient, IPrintServerClient
as shown below.
public partial class OctoPrintClient : Print3dServerClient, IPrintServerClient
{
//...
}
The base class holds all needed Methods
and Properties
needed to communicate with a print server (via REST API and WebSocket).
Example migration for OctoPrint
To query data from your server, simply call send the needed Command
. The result will contain the data as JsonString
,
which can be accessed over the Result
property.
async Task<OctoPrintFiles> GetFilesAsync(string location, string path = "", bool recursive = true)
{
try
{
string files = string.IsNullOrEmpty(path) ? string.Format("files/{0}", location) : string.Format("files/{0}/{1}", location, path);
Dictionary<string, string> urlSegments = new()
{
//get all files & folders
{ "recursive", recursive ? "true" : "false" }
};
string targetUri = $"{OctoPrintCommands.Api}";
IRestApiRequestRespone result = await SendRestApiRequestAsync(
requestTargetUri: targetUri,
method: Method.Get,
command: files,
jsonObject: null,
authHeaders: AuthHeaders,
urlSegments: urlSegments,
cts: default
)
.ConfigureAwait(false);
OctoPrintFiles list = JsonConvert.DeserializeObject<OctoPrintFiles>(result.Result);
if (list != null)
{
FreeDiskSpace = list.Free;
TotalDiskSpace = list.Total;
}
return list;
}
catch (Exception exc)
{
OnError(new UnhandledExceptionEventArgs(exc, false));
return new OctoPrintFiles();
}
}
Time differences
Each print server uses a different time base for PrintDuration
, StartTime
and EndTime
.
Property | Core | Moonraker | OctoPrint | Repetier Server |
---|---|---|---|---|
PrintDuration |
double? (UNIX Hours) |
double? (UNIX Hours) |
tbd | double? (Seconds) |
Modified |
double? (UNIX DT) |
double? (UNIX DT) |
tbd | double? (Seconds) |
Created |
double? (UNIX DT) |
double? (UNIX DT) |
tbd | long? (Seconds) |
Converters
Available Converters
for XamlBindings
:
https://github.com/AndreasReitberger/SharedMauiCoreLibrary/tree/main/src/SharedMauiCoreLibrary/Converters
Or for code behind, use TimeBaseConvertHelper
.
[ObservableProperty]
double printTime;
partial void OnPrintTimeChanged(double value)
{
PrintTimeGeneralized = TimeBaseConvertHelper.FromUnixDoubleHours(value);
}
[ObservableProperty]
TimeSpan? printTimeGeneralized;
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- CommunityToolkit.Mvvm (>= 8.2.2)
- Newtonsoft.Json (>= 13.0.3)
- RCoreSharp (>= 1.0.9)
- RestSharp (>= 111.2.0)
- Websocket.Client (>= 5.1.1)
-
net6.0
- CommunityToolkit.Mvvm (>= 8.2.2)
- Newtonsoft.Json (>= 13.0.3)
- RCoreSharp (>= 1.0.9)
- RestSharp (>= 111.2.0)
- Websocket.Client (>= 5.1.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Print3dServer.Core:
Package | Downloads |
---|---|
OctoPrintSharpApi
A simple Rest-API-Client for interacting with a OctoPrint instance from any C# project. |
|
RepetierServerSharpApi
A simple RestApi for interacting with a Repetier Server Pro instance. |
|
MoonrakerSharpWebApi
A simple Rest-API library for interacting with Moonraker web api (used by Fluidd and MainsailOS). |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.2-preview2 | 79 | 6/11/2024 |
1.0.1-preview | 105 | 4/22/2024 |
1.0.0-preview | 235 | 4/19/2024 |
Check GitHub releases for changelog.