One click printing to network printer

One click printing to network printer

Anonymous
Not applicable
493 Views
1 Reply
Message 1 of 2

One click printing to network printer

Anonymous
Not applicable
I would like to make a new tool that will print the current sheet to a network printer. Does anyone have a similar utility thy can share?

Thanks
0 Likes
494 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I don't have anything like this written, but it should be pretty straightforward.

 

You could either implement this as a macro, as an IExternalCommand that would show up in the external tools drop-down in the Add-ins toolbar, or implement your own button using an IExternalApplication and an IExternalCommand.  Check the Revit SDK samples if you're not sure how to do this.  If you're new to the SDK, the macro is by far the easiest solution.

 

Partial C# code that should more or less do what you're looking for:

 

View activeView = doc.ActiveView;

 

PrintManager pm = doc.PrintManager;

 

//To pick the printer, otherwise the Windows default is used

pm.SelectNewPrinterDriver("PrinterToUse");

 

//To set print setting, otherwise currently active settings will be used

//This code requires Linq to be loaded

pm.PrintSetup.CurrentPrintSetting = (from Element p in doc.PrintSettings where p.Name == "SavedPrintSetting" select (IPrintSetting)p).First();

 

//I seem to need this to make anything work, but try without it first

pm.PrintRange = PrintRange.Select;

 

pm.SubmitPrint(activeView);