C# Class Revit.SDK.Samples.RoomSchedule.EventsReactor

Class consists of delegate methods of DocumentSaving/SavingAs and DocumentClosing events. These delegates will be raised once document is about to be saved or closed. But, delegate will update mapped spreadsheet only when user created rooms for current document. (That's, user clicks the button "Create Unplaced Rooms" and new rooms was created successfully). Otherwise, these events handler methods won't do any update even if they were raised.
Inheritance: IDisposable
Show file Open project: AMEE/revit Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Release the file handling

DocMappedSheetInfo ( int hashCode, SheetInfo &sheetInfo ) : bool

Get the sheet information of document.

DocMonitored ( int docHashcode ) : bool

Check if document is monitored by this event reactor

DocumentClosed ( object sender, DocumentClosedEventArgs e ) : void

Removed the document which was closed, event reactor doesn't need to monitor this document any more. DocumentId is designed to identify one document, it's equal to hash code of this document.

DocumentSaving ( object sender, DocumentSavingEventArgs e ) : void

Delegate for document save event, it will update spreadsheet if document was mapped to spreadsheet.

DocumentSavingAs ( object sender, DocumentSavingAsEventArgs e ) : void

Delegate for document save as event, it will update spreadsheet if document was mapped to spreadsheet.

EventsReactor ( String logFile ) : System

This class will dump information to log file to tell user what happened

UpdateSheeInfo ( int hashCode, SheetInfo newSheetInfo ) : void

Update or reset the sheet information to which document is being mapped.

Private Methods

Method Description
DumpLog ( String strLog ) : void

Dump log file now

SetExternalRoomIdToRoomId ( Room room ) : bool

Set shared parameter (whose name is "External Room ID") value to Room.Id.IntegerValue

UpdateMappedSpreadsheet ( System.Windows.Forms.Document activeDocument ) : void

Update mapped spread sheet when document is about to be saved or saved as This method will update spread sheet room data([Area] column) with actual area value of mapped Revit Room. or add Revit room to spreadsheet if it is not mapped to room of spreadsheet. ///

ValidateRevitRoom ( System.Windows.Forms.Document activeDocument, Room room, double &roomArea, String &externalId ) : bool

Check to see if we need to update spreadsheet data according to this Revit room. We don't need to update spreadsheet rooms if Revit room: . Which is one unplaced room. . The room has area which is zero. . Special room which doesn't have custom shared parameter at all.

Method Details

Dispose() public method

Release the file handling
public Dispose ( ) : void
return void

DocMappedSheetInfo() public method

Get the sheet information of document.
public DocMappedSheetInfo ( int hashCode, SheetInfo &sheetInfo ) : bool
hashCode int The hash code of document.
sheetInfo SheetInfo The mapped spread file and sheet information.
return bool

DocMonitored() public method

Check if document is monitored by this event reactor
public DocMonitored ( int docHashcode ) : bool
docHashcode int Hashcode of document.
return bool

DocumentClosed() public method

Removed the document which was closed, event reactor doesn't need to monitor this document any more. DocumentId is designed to identify one document, it's equal to hash code of this document.
public DocumentClosed ( object sender, DocumentClosedEventArgs e ) : void
sender object
e DocumentClosedEventArgs
return void

DocumentSaving() public method

Delegate for document save event, it will update spreadsheet if document was mapped to spreadsheet.
public DocumentSaving ( object sender, DocumentSavingEventArgs e ) : void
sender object Event sender.
e DocumentSavingEventArgs EventArgs of this event.
return void

DocumentSavingAs() public method

Delegate for document save as event, it will update spreadsheet if document was mapped to spreadsheet.
public DocumentSavingAs ( object sender, DocumentSavingAsEventArgs e ) : void
sender object Event sender.
e DocumentSavingAsEventArgs EventArgs of this event.
return void

EventsReactor() public method

This class will dump information to log file to tell user what happened
public EventsReactor ( String logFile ) : System
logFile String
return System

UpdateSheeInfo() public method

Update or reset the sheet information to which document is being mapped.
public UpdateSheeInfo ( int hashCode, SheetInfo newSheetInfo ) : void
hashCode int Hash code of document used as key to find mapped spreadsheet.
newSheetInfo SheetInfo New value for spreadsheet.
return void