mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-08-18 19:30:09 +00:00
59 lines
5.2 KiB
Plaintext
59 lines
5.2 KiB
Plaintext
{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset0 Times New Roman;}}
|
|
\viewkind4\uc1\pard\ltrpar\b\f0\fs20 Application:\b0 PrintLog\line\b Revit Platform:\b0 All\line\b Revit Version:\b0 2010.0\line\b First Released For:\b0 2010.0\line\b Last Modified:\b0 09/09/2008\line\b Modified By:\b0 JJ Autodesk\line\b Programming Language:\b0 C#\line\b Skill Level:\b0 Medium\line\b Category:\b0 Basics\line\b Type:\b0 ExternalApplication\line\line\b Subject:\b0 Dump print information to log.\line\b Summary:\b0 \line\lang1036 This sample demonstrates how to subscribe Print related events, access properties in argument of event handlers and dump print related information to log file.\f1\par
|
|
\lang1033\f0\par
|
|
\b Classes\b0 : \par
|
|
\pard\ltrpar\fi180\li180\lang1036 Autodesk.Revit.IExternalApplication \f1\par
|
|
\f0 Autodesk.Revit.IExternalCommand \f1\par
|
|
\f0 Autodesk.Revit.Elements\par
|
|
Autodesk.Revit.Events.ViewPrintingEventArgs\par
|
|
Autodesk.Revit.Events.ViewPrintedEventArgs\par
|
|
Autodesk.Revit.Events.DocumentPrintingEventArgs\par
|
|
Autodesk.Revit.Events.DocumentPrintedEventArgs\f1\par
|
|
\par
|
|
\f0 System.DateTime\f1\par
|
|
\f0 System.Diagnostics.Stopwatch\f1\par
|
|
\par
|
|
\pard\ltrpar\lang1033\f0\par
|
|
\b Project Files\b0 : \par
|
|
Application.cs\par
|
|
\pard\ltrpar\li360\tx720 This file contains a class Application which implements IExternalApplcation interface. The OnStartUp method will register ViewPrinting, ViewPrinted, DocumentPrinting and DocumentPrinted events when Revit starts.\f1\par
|
|
\par
|
|
\pard\ltrpar\f0 Command.cs\par
|
|
\pard\ltrpar\li360\tx720 This file contains a class Command which implements IExternalCommmand interface. The function of the class is to call API Document.Print to raise ViewPrint and DocumentPrint related events.\par
|
|
\f1\par
|
|
\pard\ltrpar\f0 EventsReactor.cs\par
|
|
\pard\ltrpar\li360\tx720 This file contains a class EventsReactor\f1 ,\f0 it has four handler methods which will be subscribed to ViewPrint and DocumentPrint events separately; it also contains other methods which are used to dump related information to log files.\f1\par
|
|
\par
|
|
\f0 This class will dump all print information (printer name, project name, start and end time of each print process, individual print time of each view and total print time for all views, events related information) to PrintLog.txt; besides, it also dumps events related information to PrintEventsLog.txt file.\f1\par
|
|
\par
|
|
\pard\ltrpar\f0 EventsWatches.cs\par
|
|
\pard\ltrpar\li360\tx720 This file contains a class EventsWatches which has two stop watches used to calculate time consumed for View printing and Document printing\f1 .\par
|
|
\par
|
|
\pard\ltrpar\f0\par
|
|
\b Description\b0 : \par
|
|
The sample implements IExternalApplication interface and subscribes ViewPrinting, ViewPrinted, DocumentPrinting and DocumentPrinted events in OnStartUp; the registered event handlers will dump print related information to log files\f1 .\par
|
|
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab Event handlers of ControlledApplication.ViewPrinting, ViewPrinted, DocumentPrinting and DocumentPrinted will be subscribed to react to the print actions\f1 .\par
|
|
\f0 -\tab ViewPrintingEventArgs properties Cancellable, View, Index and TotalViews will be dumped to log when view is about to be printed.\par
|
|
\pard\ltrpar\fi-360\li360 -\tab ViewPrintedEventArgs properties Status, Cancellable, View, Index and TotalViews will be dumped to log when view has been printed.\par
|
|
\pard\ltrpar\fi-360\li360\tx360 -\tab DocumentPrintingEventArgs properties Cancellable and Views will be dumped to log file when document is about to be printed. \par
|
|
\pard\ltrpar\fi-360\li360 -\tab DocumentPrintingEventArgs properties Status, Cancellable PrintedViews and FailedView will be dumped to log file when document has been printed.\f1\par
|
|
\f0 -\tab System.DateTime and System.Diagnostics.Stopwatch will be used to dump start (when ViewPrinting or DocumentPrinting is raised) and end time(when ViewPrinted or DocumentPrinted is raised) of print events and calculate the individual print time for each view and total print time for all views.\f1\par
|
|
\pard\ltrpar\fi-360\li360\tx360\f0 -\tab API Document.Print(ViewSet) can raise ViewPrint and DocumentPrint related events to verify functionalities of this sample\f1 .\par
|
|
\pard\ltrpar\par
|
|
\f0\par
|
|
\b Instructions\b0 : \par
|
|
\pard\ltrpar\fi-360\li360\tx360 1.\tab Update your Revit.ini by following lines: \f1\par
|
|
\pard\ltrpar\li360\f0 [ExternalApplications] \par
|
|
EACount = 1 \par
|
|
EAClassName1 = Revit.SDK.Samples.PrintLog.CS.Application\par
|
|
EAAssembly1 = \i <your path>\i0\f1\\\f0 PrintLog.dll \par
|
|
[ExternalCommands]\par
|
|
ECCount = 1\par
|
|
ECClassName1 = Revit.SDK.Samples.PrintLog.CS.Command\par
|
|
ECAssembly1 = \i <your path>\f1\\\i0\f0 PrintLog.dll\par
|
|
\pard\ltrpar\fi-360\li360\tx360 2.\tab Start Revit, notice that ViewPrint and DocumentPrint events will be registered once Revit starts.\f1\par
|
|
\f0 3.\tab Raise print events by API: Run external command to call API to raise prints events. And then refer to log files PrintLog.txt for more details about print information dumped by this sample.\par
|
|
4.\tab Raise events by UI: Run UI print command File\\Print to print views and then refer to PrintLog.txt.\f1\par
|
|
\pard\ltrpar\f0\par
|
|
}
|
|
|