Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio not detect 3d printers on network

I am trying to detect my 3d printers on the network but for some reason it is only returning the 2d printers, whits is a bit strange because the 3d printers are connected on the network, and detectable from the native software. Any ideas on how to display all network printers ?

using System;
using System.Printing;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace PrintQueuesExample
{
  public partial class Window1 : Window
  {
    PrintQueueCollection _Printers;

    public Window1()
    {
      _Printers = new PrintServer().GetPrintQueues(new[] { 
        EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections});

      foreach (var queue in _Printers)
      {
        Console.WriteLine(queue.Name);
        var capabilities = queue.GetPrintCapabilities();
        foreach (var size in capabilities.PageMediaSizeCapability)
        { Console.WriteLine(size.ToString()); }
        Console.WriteLine();
      }

      InitializeComponent();
    }

    public PrintQueueCollection Printers
    { get { return _Printers; } }

    private void PrintTestPageClick(object sender, RoutedEventArgs e)
    {
      var queue = _PrinterList.SelectedItem as PrintQueue;
      if (queue == null)
      {
        MessageBox.Show("Please select a printer.");
        return;
      }

      var size = _SizeList.SelectedItem as PageMediaSize;
      if (size == null)
      {
        MessageBox.Show("Please select a page size.");
        return;
      }

      queue.UserPrintTicket.PageMediaSize = size;
      queue.UserPrintTicket.PageOrientation = _PortraitRadio.IsChecked == true ? 
        PageOrientation.Portrait : PageOrientation.Landscape;

      var canvas = (Canvas)Resources["MyPrintingExample"];
      canvas.Measure(new Size(size.Width.Value, size.Height.Value));
      canvas.Arrange(new Rect(0, 0, canvas.DesiredSize.Width, 
          canvas.DesiredSize.Height));

      var writer = PrintQueue.CreateXpsDocumentWriter(queue);
      writer.Write(canvas);
    }

  }

  public class PrintQueueToPageSizesConverter : IValueConverter
  {
    public object Convert(object value, Type targetType,
      object parameter, System.Globalization.CultureInfo culture)
    {
      return value == null ? null :
        ((PrintQueue)value).GetPrintCapabilities().PageMediaSizeCapability;
    }

    public object ConvertBack(object value, Type targetType, 
      object parameter, System.Globalization.CultureInfo culture)
    { throw new NotImplementedException(); }
  }
}
like image 292
kevin ver Avatar asked Mar 21 '26 17:03

kevin ver


1 Answers

I highly doubt a 3D printer would appear in the Printers section of the Windows Control-Panel and therefore be seen as a printer. I think the name "3D Printer" is probably confusing, it isn't really a "printer" in the normal sense as Windows see it.

Most printers just know about rows / columns (to hugely over simplify things) so manufacturers can use a generic printer driver as a base. 3D printers are much more advanced / specialised and I am guessing that you will need an SDK that will output instructions that the 3D printer will understand.

You will probably be able to obtain an SDK from the manufacturer of the printer.

like image 54
Belogix Avatar answered Mar 23 '26 07:03

Belogix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!