mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-17 18:12:08 +00:00
added Revit 2022 SDK minus except *rvt and *rfa
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
#region Class Interface Implementation
|
||||
/// <summary>
|
||||
/// To add an external command to Autodesk Revit,
|
||||
/// the developer must define a class which implements the IExternalCommand interface.
|
||||
/// This class is used as the connection of Revit and external program
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
|
||||
public class Command : IExternalCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Implement this method as an external command for Revit.
|
||||
/// </summary>
|
||||
/// <param name="commandData">An object that is passed to the external application
|
||||
/// which contains data related to the command,
|
||||
/// such as the application object and active view.</param>
|
||||
/// <param name="message">A message that can be set by the external application
|
||||
/// which will be displayed if a failure or cancellation is returned by
|
||||
/// the external command.</param>
|
||||
/// <param name="elements">A set of elements to which the external application
|
||||
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
|
||||
/// <returns>Return the status of the external command.
|
||||
/// A result of Succeeded means that the API external method functioned as expected.
|
||||
/// Cancelled can be used to signify that the user cancelled the external operation
|
||||
/// at some point. Failure should be returned if the application is unable to proceed with
|
||||
/// the operation.</returns>
|
||||
public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
|
||||
ref string message, Autodesk.Revit.DB.ElementSet elements)
|
||||
{
|
||||
Transaction tranSample = null;
|
||||
try
|
||||
{
|
||||
tranSample = new Transaction(commandData.Application.ActiveUIDocument.Document, "Sample Start");
|
||||
tranSample.Start();
|
||||
// create a form to display the information of Revit rooms and xls based rooms
|
||||
using (RoomScheduleForm infoForm = new RoomScheduleForm(commandData))
|
||||
{
|
||||
infoForm.ShowDialog();
|
||||
}
|
||||
tranSample.Commit();
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (null != tranSample) tranSample.RollBack();
|
||||
// if there are something wrong, give error information and return failed
|
||||
message = ex.Message;
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.ApplicationServices;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the IExternalApplication interface,
|
||||
/// OnStartup will subscribe Save/SaveAs and DocumentClose events when Revit starts and OnShutdown will unregister these events when Revit exists.
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
|
||||
public class CrtlApplication : IExternalApplication
|
||||
{
|
||||
#region Class Members
|
||||
/// <summary>
|
||||
/// The events reactor for this application.
|
||||
/// </summary>
|
||||
static private EventsReactor m_eventReactor;
|
||||
|
||||
/// <summary>
|
||||
/// Access the event reactor instance
|
||||
/// </summary>
|
||||
public static EventsReactor EventReactor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == m_eventReactor)
|
||||
{
|
||||
throw new ArgumentException("External application was not loaded yet, please make sure you register external application by correct full path of dll.", "EventReactor");
|
||||
}
|
||||
else
|
||||
{
|
||||
return CrtlApplication.m_eventReactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region IExternalApplication Implementations
|
||||
/// <summary>
|
||||
/// Implement OnStartup method to subscribe related events.
|
||||
/// </summary>
|
||||
/// <param name="application">Current loaded application.</param>
|
||||
/// <returns></returns>
|
||||
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application)
|
||||
{
|
||||
// specify the log
|
||||
string assemblyName = this.GetType().Assembly.Location;
|
||||
m_eventReactor = new EventsReactor(assemblyName.Replace(".dll", ".log"));
|
||||
//
|
||||
// subscribe events
|
||||
application.ControlledApplication.DocumentSaving += new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingEventArgs>(EventReactor.DocumentSaving);
|
||||
application.ControlledApplication.DocumentSavingAs += new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingAsEventArgs>(EventReactor.DocumentSavingAs);
|
||||
application.ControlledApplication.DocumentClosed += new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(EventReactor.DocumentClosed);
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregister subscribed events when Revit exists
|
||||
/// </summary>
|
||||
/// <param name="application">Current loaded application.</param>
|
||||
/// <returns></returns>
|
||||
public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication application)
|
||||
{
|
||||
m_eventReactor.Dispose();
|
||||
application.ControlledApplication.DocumentSaving -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingEventArgs>(EventReactor.DocumentSaving);
|
||||
application.ControlledApplication.DocumentSavingAs -= new EventHandler<Autodesk.Revit.DB.Events.DocumentSavingAsEventArgs>(EventReactor.DocumentSavingAs);
|
||||
application.ControlledApplication.DocumentClosed -= new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(EventReactor.DocumentClosed);
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,519 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Events;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
using System.IO;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// One struct defines the content of mapped Excel spreadsheet: the full name of this file and the sheet.
|
||||
/// Only the opened sheet is reserved by this struct.
|
||||
/// </summary>
|
||||
public class SheetInfo
|
||||
{
|
||||
#region Class Member Variables
|
||||
/// <summary>
|
||||
/// Excel file name, it's full path
|
||||
/// </summary>
|
||||
string m_fileName;
|
||||
|
||||
/// <summary>
|
||||
/// Sheet table within excel file, it's opened by sample
|
||||
/// </summary>
|
||||
string m_sheetName;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Public Methods
|
||||
/// <summary>
|
||||
/// Ctor method
|
||||
/// </summary>
|
||||
/// <param name="fileName">Full path name file.</param>
|
||||
/// <param name="sheetName">The sheet name of spreadsheet which was opened.</param>
|
||||
public SheetInfo(String fileName, String sheetName)
|
||||
{
|
||||
m_fileName = fileName;
|
||||
m_sheetName = sheetName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the full name of spreadsheet file
|
||||
/// </summary>
|
||||
public string FileName
|
||||
{
|
||||
get { return m_fileName; }
|
||||
set { m_fileName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get or set the sheet name within the spreadsheet, the sheet name was mapped by Revit rooms.
|
||||
/// </summary>
|
||||
public string SheetName
|
||||
{
|
||||
get { return m_sheetName; }
|
||||
set { m_sheetName = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public sealed class EventsReactor : IDisposable
|
||||
{
|
||||
#region Class Global Static Variables
|
||||
/// <summary>
|
||||
/// Array of documents' hash code and mapped Excel file and opened table.
|
||||
/// The mapped excel and its table will be updated when events DocumentSave/SaveAs are raised.
|
||||
/// The update occurs only when new room was created according to excel spreadsheet.
|
||||
/// </summary>
|
||||
private Dictionary<int, SheetInfo> m_docMapDict = new Dictionary<int, SheetInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// Specified log file name
|
||||
/// </summary>
|
||||
private String m_logFile;
|
||||
|
||||
/// <summary>
|
||||
/// Logging writer used to write logging to log specified log file.
|
||||
/// It's not recommended to access m_logWriter and call it's method, because maybe it's not initialized yet.
|
||||
/// Please call DumpLog to dump related logging
|
||||
/// </summary>
|
||||
private StreamWriter m_logWriter;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Public Implementations
|
||||
/// <summary>
|
||||
/// This class will dump information to log file to tell user what happened
|
||||
/// </summary>
|
||||
/// <param name="logFile"></param>
|
||||
public EventsReactor(String logFile)
|
||||
{
|
||||
m_logFile = logFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Release the file handling
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (null != m_logWriter)
|
||||
{
|
||||
// close the stream
|
||||
m_logWriter.Flush();
|
||||
m_logWriter.Close();
|
||||
m_logWriter = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizer, we need to ensure the file stream was closed
|
||||
/// This destructor will run only if the Dispose method does not get called.
|
||||
/// </summary>
|
||||
~EventsReactor()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for document save as event, it will update spreadsheet if document was mapped to spreadsheet.
|
||||
/// </summary>
|
||||
/// <param name="sender">Event sender.</param>
|
||||
/// <param name="e">EventArgs of this event.</param>
|
||||
public void DocumentSavingAs(object sender, DocumentSavingAsEventArgs e)
|
||||
{
|
||||
DumpLog("Raised DocumentSavingAs -> Document: " + Path.GetFileNameWithoutExtension(e.Document.Title));
|
||||
UpdateMappedSpreadsheet(e.Document);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for document save event, it will update spreadsheet if document was mapped to spreadsheet.
|
||||
/// </summary>
|
||||
/// <param name="sender">Event sender.</param>
|
||||
/// <param name="e">EventArgs of this event.</param>
|
||||
public void DocumentSaving(object sender, DocumentSavingEventArgs e)
|
||||
{
|
||||
DumpLog("Raised DocumentSaving -> Document: " + Path.GetFileNameWithoutExtension(e.Document.Title));
|
||||
UpdateMappedSpreadsheet(e.Document);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void DocumentClosed(object sender, DocumentClosedEventArgs e)
|
||||
{
|
||||
DumpLog("Raised DocumentClosed.");
|
||||
m_docMapDict.Remove(e.DocumentId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if document is monitored by this event reactor
|
||||
/// </summary>
|
||||
/// <param name="docHashcode">Hashcode of document.</param>
|
||||
/// <returns></returns>
|
||||
public bool DocMonitored(int docHashcode)
|
||||
{
|
||||
return m_docMapDict.ContainsKey(docHashcode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the sheet information of document.
|
||||
/// </summary>
|
||||
/// <param name="hashCode">The hash code of document.</param>
|
||||
/// <param name="sheetInfo">The mapped spread file and sheet information.</param>
|
||||
/// <returns>Indicates whether find the spread sheet mapped by this document.
|
||||
/// True if mapped spreadsheet information found, else false.</returns>
|
||||
public bool DocMappedSheetInfo(int hashCode, ref SheetInfo sheetInfo)
|
||||
{
|
||||
if(!DocMonitored(hashCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_docMapDict.TryGetValue(hashCode, out sheetInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update or reset the sheet information to which document is being mapped.
|
||||
/// </summary>
|
||||
/// <param name="hashCode">Hash code of document used as key to find mapped spreadsheet.</param>
|
||||
/// <param name="newSheetInfo">New value for spreadsheet.</param>
|
||||
public void UpdateSheeInfo(int hashCode, SheetInfo newSheetInfo)
|
||||
{
|
||||
if(!DocMonitored(hashCode))
|
||||
{
|
||||
m_docMapDict.Add(hashCode, newSheetInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_docMapDict.Remove(hashCode);
|
||||
m_docMapDict.Add(hashCode, newSheetInfo);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Implementations
|
||||
/// <summary>
|
||||
/// 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. /// </summary>
|
||||
/// <param name="activeDocument">Current active document.</param>
|
||||
private void UpdateMappedSpreadsheet(Document activeDocument)
|
||||
{
|
||||
// Programming Routines:
|
||||
//
|
||||
// 1: Update spreadsheet when:
|
||||
// a: there is room work sheet table;
|
||||
// b: there is rooms data;
|
||||
// c: shared parameter exists;
|
||||
// 2: Skip update and insert operations for below rooms:
|
||||
// a: the rooms are not placed or located;
|
||||
// b: the rooms whose shared parameter(defined by sample) are not retrieved,
|
||||
// some rooms maybe don't have shared parameter at all, despite user create for Rooms category.
|
||||
// 3: Update spreadsheet rooms values by Revit room actual values.
|
||||
// a: if shared parameter exists(is not null), update row by using this parameter's value;
|
||||
// b: if shared parameter doesn't exist (is null), update row by Id value of room, which will avoid the duplicate
|
||||
// ID columns occur in spreadsheet.
|
||||
// 4: Insert Revit rooms data to spreadsheet if:
|
||||
// a: failed to update values of rooms (maybe there no matched ID value in spread sheet rows).
|
||||
//
|
||||
|
||||
#region Check Whether Update Spreadsheet Data
|
||||
//
|
||||
// check which table to be updated.
|
||||
SheetInfo mappedXlsAndTable;
|
||||
bool hasValue = m_docMapDict.TryGetValue(activeDocument.GetHashCode(), out mappedXlsAndTable);
|
||||
if (!hasValue || null == mappedXlsAndTable ||
|
||||
String.IsNullOrEmpty(mappedXlsAndTable.FileName) || String.IsNullOrEmpty(mappedXlsAndTable.SheetName))
|
||||
{
|
||||
DumpLog("This document isn't mapped to spreadsheet yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
// retrieve all rooms in project(maybe there are new rooms created manually by user)
|
||||
RoomsData roomData = new RoomsData(activeDocument);
|
||||
if (roomData.Rooms.Count <= 0)
|
||||
{
|
||||
DumpLog("This document doesn't have any room yet.");
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// create a connection and update values of spread sheet
|
||||
int updatedRows = 0; // number of rows which were updated
|
||||
int newRows = 0; // number of rows which were added into spread sheet
|
||||
XlsDBConnector dbConnector = new XlsDBConnector(mappedXlsAndTable.FileName);
|
||||
|
||||
// check whether there is room table.
|
||||
// get all available rooms in current document once more
|
||||
int stepNo = -1;
|
||||
DumpLog(System.Environment.NewLine + "Start to update spreadsheet room......");
|
||||
foreach (Room room in roomData.Rooms)
|
||||
{
|
||||
// check Whether We Update This Room
|
||||
stepNo++;
|
||||
double roomArea = 0.0f;
|
||||
String externalId = String.Empty;
|
||||
if (!ValidateRevitRoom(activeDocument, room, ref roomArea, ref externalId))
|
||||
{
|
||||
DumpLog(String.Format("#{0}--> Room:{1} was skipped.", stepNo, room.Number));
|
||||
continue;
|
||||
}
|
||||
|
||||
// try to update
|
||||
try
|
||||
{
|
||||
|
||||
#region Update Spreadsheet Room
|
||||
// flag used to indicate whether update is successful
|
||||
bool bUpdateFailed = false; // reserve whether this room updated successfully.
|
||||
// if room comment is empty, use <null> for mapped room, use <Added from Revit> for not mapped room in spread sheet.
|
||||
bool bCommnetIsNull = false;
|
||||
|
||||
// get comments of room
|
||||
String comments;
|
||||
Parameter param = room.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
|
||||
comments = (null != param) ? (param.AsString()) : ("");
|
||||
if (String.IsNullOrEmpty(comments))
|
||||
{
|
||||
// this room doesn't have comment value
|
||||
bCommnetIsNull = true;
|
||||
// use <null> for room with empty comment by default when updating spread sheet
|
||||
comments = "<null>";
|
||||
}
|
||||
|
||||
// create update SQL clause,
|
||||
// when filtering row to be updated, use Room.Id.IntegerValue if "External Room ID" is null.
|
||||
String updateStr = String.Format(
|
||||
"Update [{0}$] SET [{1}] = '{2}', [{3}] = '{4}', [{5}] = '{6}', [{7}] = '{8:N3}' Where [{9}] = {10}",
|
||||
mappedXlsAndTable.SheetName, // mapped table name
|
||||
RoomsData.RoomName, room.Name,
|
||||
RoomsData.RoomNumber, room.Number,
|
||||
RoomsData.RoomComments, comments,
|
||||
RoomsData.RoomArea, roomArea,
|
||||
RoomsData.RoomID, String.IsNullOrEmpty(externalId) ? room.Id.IntegerValue.ToString() : externalId);
|
||||
|
||||
// execute the command and check the size of updated rows
|
||||
int afftectedRows = dbConnector.ExecuteCommnand(updateStr);
|
||||
if (afftectedRows == 0)
|
||||
{
|
||||
bUpdateFailed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// count how many rows were updated
|
||||
DumpLog(String.Format("#{0}--> {1}", stepNo, updateStr));
|
||||
updatedRows += afftectedRows;
|
||||
|
||||
// if "External Room ID" is null but update successfully, which means:
|
||||
// in spreadsheet there is existing row whose "ID" value equals to room.Id.IntegerValue, so we should
|
||||
// set Revit room's "External Room ID" value to Room.Id.IntegerValue for consistence after update .
|
||||
if (String.IsNullOrEmpty(externalId))
|
||||
{
|
||||
SetExternalRoomIdToRoomId(room);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Insert Revit Room
|
||||
|
||||
// Add this new room to spread sheet if fail to update spreadsheet
|
||||
if (bUpdateFailed)
|
||||
{
|
||||
// try to insert this new room to spread sheet, some rules:
|
||||
// a: if the "External Room ID" exists, set ID column to this external id value,
|
||||
// if the "External Room ID" doesn't exist, use the actual Revit room id as the ID column value.
|
||||
// b: use comments in room if room's description exists,
|
||||
// else, use constant string: "<Added from Revit>" for Comments column in spreadsheet.
|
||||
|
||||
String insertStr =
|
||||
String.Format("Insert Into [{0}$] ([{1}], [{2}], [{3}], [{4}], [{5}]) Values('{6}', '{7}', '{8}', '{9}', '{10:N3}')",
|
||||
mappedXlsAndTable.SheetName, // mapped table name
|
||||
RoomsData.RoomID, RoomsData.RoomComments, RoomsData.RoomName, RoomsData.RoomNumber, RoomsData.RoomArea,
|
||||
(String.IsNullOrEmpty(externalId)) ? (room.Id.IntegerValue.ToString()) : (externalId), // Room id
|
||||
(bCommnetIsNull || String.IsNullOrEmpty(comments)) ? ("<Added from Revit>") : (comments),
|
||||
room.Name, room.Number, roomArea);
|
||||
|
||||
// try to insert it
|
||||
afftectedRows = dbConnector.ExecuteCommnand(insertStr);
|
||||
if (afftectedRows != 0)
|
||||
{
|
||||
// remember the number of new rows
|
||||
String succeedMsg = String.Format("#{0}--> Succeeded to insert spreadsheet Room - Name:{1}, Number:{2}, Area:{3:N3}",
|
||||
stepNo, room.Name, room.Number, roomArea);
|
||||
DumpLog(succeedMsg);
|
||||
newRows += afftectedRows;
|
||||
|
||||
// if the Revit room doesn't have external id value(may be a room created manually)
|
||||
// set its "External Room ID" value to Room.Id.IntegerValue, because the room was added/mapped to spreadsheet,
|
||||
// and the value of ID column in sheet is just the Room.Id.IntegerValue, we should keep this consistence.
|
||||
if (String.IsNullOrEmpty(externalId))
|
||||
{
|
||||
SetExternalRoomIdToRoomId(room);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DumpLog(String.Format("#{0}--> Failed: {1}", stepNo, insertStr));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// close the connection
|
||||
DumpLog(String.Format("#{0}--> Exception: {1}", stepNo, ex.Message));
|
||||
dbConnector.Dispose();
|
||||
RoomScheduleForm.MyMessageBox(ex.Message, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// close the connection
|
||||
dbConnector.Dispose();
|
||||
|
||||
// output the affected result message
|
||||
String sumMsg = String.Format("{0}:[{1}]: {2} rows were updated and {3} rows were added into successfully.",
|
||||
Path.GetFileName(mappedXlsAndTable.FileName), mappedXlsAndTable.SheetName, updatedRows, newRows);
|
||||
DumpLog(sumMsg);
|
||||
DumpLog("Finish updating spreadsheet room." + System.Environment.NewLine);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="activeDocument">Current active document.</param>
|
||||
/// <param name="roomObj">Room object to be checked.</param>
|
||||
/// <param name="roomArea">Room area of this Revit room.</param>
|
||||
/// <param name="externalId">The value of custom shared parameter of this room.</param>
|
||||
/// <returns>Indicates whether it succeeded to get room area and shared parameter value.</returns>
|
||||
private static bool ValidateRevitRoom(Document activeDocument, Room room, ref double roomArea, ref String externalId)
|
||||
{
|
||||
roomArea = 0.0f;
|
||||
externalId = String.Empty;
|
||||
if (null == room.Location || null == activeDocument.GetElement(room.LevelId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get Area of room, if converting to double value fails, skip this.
|
||||
// if the area is zero to less than zero, skip the update too
|
||||
try
|
||||
{
|
||||
// get area without unit, then converting it to double will be ok.
|
||||
String areaStr = RoomsData.GetProperty(activeDocument, room, BuiltInParameter.ROOM_AREA, false);
|
||||
roomArea = Double.Parse(areaStr);
|
||||
if (roomArea <= double.Epsilon)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// parse double value failed, continue the loop
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the shared parameter value of room
|
||||
Parameter externalIdSharedParam = null;
|
||||
bool bExist = RoomsData.ShareParameterExists(room, RoomsData.SharedParam, ref externalIdSharedParam);
|
||||
if (false == bExist || null == externalIdSharedParam)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
externalId = externalIdSharedParam.AsString();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set shared parameter (whose name is "External Room ID") value to Room.Id.IntegerValue
|
||||
/// </summary>
|
||||
/// <param name="room">The room used to get the room which to be updated</param>
|
||||
private static bool SetExternalRoomIdToRoomId(Room room)
|
||||
{
|
||||
try
|
||||
{
|
||||
Parameter shareParam = room.LookupParameter(RoomsData.SharedParam);
|
||||
if (null != shareParam)
|
||||
{
|
||||
return shareParam.Set(room.Id.IntegerValue.ToString());
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// none
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dump log file now
|
||||
/// </summary>
|
||||
private void DumpLog(String strLog)
|
||||
{
|
||||
// Create writer only when there is dump
|
||||
if(null == m_logWriter) {
|
||||
if (File.Exists(m_logFile))
|
||||
{
|
||||
File.Delete(m_logFile);
|
||||
}
|
||||
m_logWriter = new StreamWriter(m_logFile);
|
||||
m_logWriter.AutoFlush = true;
|
||||
}
|
||||
//
|
||||
// dump log now
|
||||
m_logWriter.WriteLine(strLog);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RoomSchedule")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RoomSchedule")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("34e429cd-5bbd-4b2c-a79e-f927d035a407")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,313 @@
|
||||
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
|
||||
{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt \'cb\'ce\'cc\'e5};}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;}
|
||||
{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@SimSun;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;}
|
||||
{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
|
||||
{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}
|
||||
{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f40\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f41\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\f43\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f44\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f45\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f46\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\f47\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f48\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f50\fbidi \fswiss\fcharset238\fprq2 Arial CE;}{\f51\fbidi \fswiss\fcharset204\fprq2 Arial Cyr;}
|
||||
{\f53\fbidi \fswiss\fcharset161\fprq2 Arial Greek;}{\f54\fbidi \fswiss\fcharset162\fprq2 Arial Tur;}{\f55\fbidi \fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f56\fbidi \fswiss\fcharset178\fprq2 Arial (Arabic);}
|
||||
{\f57\fbidi \fswiss\fcharset186\fprq2 Arial Baltic;}{\f58\fbidi \fswiss\fcharset163\fprq2 Arial (Vietnamese);}{\f172\fbidi \fnil\fcharset0\fprq2 SimSun Western{\*\falt \'cb\'ce\'cc\'e5};}{\f380\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}
|
||||
{\f381\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f383\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f384\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f387\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}
|
||||
{\f388\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);}{\f420\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f421\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f423\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}
|
||||
{\f424\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f425\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f426\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f427\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}
|
||||
{\f428\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f429\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f432\fbidi \fnil\fcharset0\fprq2 @SimSun Western;}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;}
|
||||
{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}
|
||||
{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}
|
||||
{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
|
||||
{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}
|
||||
{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}
|
||||
{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}
|
||||
{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;}
|
||||
{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}
|
||||
{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}
|
||||
{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}
|
||||
{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;
|
||||
\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp
|
||||
\fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}
|
||||
{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\*
|
||||
\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1
|
||||
\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052
|
||||
\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\s15\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af38\afs16\alang1025 \ltrch\fcs0
|
||||
\fs16\lang1033\langfe2052\loch\f38\hich\af38\dbch\af31505\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext15 \slink16 \ssemihidden \sunhideused \styrsid11688384 Document Map;}{\*\cs16 \additive \rtlch\fcs1 \af38\afs16 \ltrch\fcs0 \f38\fs16
|
||||
\sbasedon10 \slink15 \slocked \ssemihidden \styrsid11688384 Document Map Char;}}{\*\rsidtbl \rsid4203277\rsid11688384\rsid13177920}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0
|
||||
\mnaryLim1}{\info{\operator Aaron Lu}{\creatim\yr2010\mo3\dy4\hr14}{\revtim\yr2010\mo8\dy11\hr16\min42}{\version4}{\edmins1}{\nofpages3}{\nofwords1110}{\nofchars6331}{\nofcharsws7427}{\vern32771}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/w
|
||||
ord/2003/wordml}}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
|
||||
\widowctrl\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701
|
||||
\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot4203277 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2
|
||||
\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6
|
||||
\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang
|
||||
{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe2052\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 {
|
||||
\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Application:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 RoomSchedule\line }{\rtlch\fcs1 \ab\af1\afs20
|
||||
\ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Revit Platform:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Architecture\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0
|
||||
\b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Revit Version:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 2011.0\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277
|
||||
\hich\af1\dbch\af31505\loch\f1 First Released For:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 2008.2\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
Programming Language:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 C#\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Skill Level:}{\rtlch\fcs1
|
||||
\af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 High\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Category:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Rooms/Spaces\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Type:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid11688384
|
||||
\hich\af1\dbch\af31505\loch\f1 ExternalCommand}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \fs20\loch\af1\hich\af1\dbch\af13\insrsid11688384 \hich\af1\dbch\af13\loch\f1 , }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277
|
||||
\hich\af1\dbch\af31505\loch\f1 ExternalApplication\line \line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Subject:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277
|
||||
\hich\af1\dbch\af31505\loch\f1 Room creation and modification; Excel data import and export.\line }{\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Summary:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 \line This sample demonstrates: how to retrieve spread sheet data, how to create rooms without placing them and how to update spreadsheet d\hich\af1\dbch\af31505\loch\f1
|
||||
ata with data of rooms mapped to}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\lang1036\langfe2052\langnp1036\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Classes:}{\rtlch\fcs1
|
||||
\af1\afs20 \ltrch\fcs0 \f1\fs20\lang1036\langfe2052\langnp1036\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\lang1036\langfe2052\langnp1036\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
Autodesk.Revit.UI.IExternalCommand}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\lang1036\langfe2052\langnp1036\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\lang1036\langfe2052\langnp1036\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Document}{\rtlch\fcs1 \af0\afs20
|
||||
\ltrch\fcs0 \f0\fs20\lang1036\langfe2052\langnp1036\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi180\li180\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Architecture.Room
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Level
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Phase
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Category
|
||||
\par }\pard \ltrpar\ql \fi180\li180\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.\hich\af1\dbch\af31505\loch\f1 Parameters.BuildInParameter}{
|
||||
\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Parameters.Definition
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Parameters.DefinitionGroup}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Parameters.InstanceBinding
|
||||
\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi180\li180\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin180\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Events.DocumentSaving
|
||||
\par }\pard \ltrpar\ql \fi180\li180\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.DB.Events.DocumentSavingAs
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Autodesk.Revit.\hich\af1\dbch\af31505\loch\f1 DB.Events.DocumentClosed
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 System.Data.OleDb.OleDbConnection}{\rtlch\fcs1
|
||||
\af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi360\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 System.Data.OleDb.OleDbCommand}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 System.Data.DataTable
|
||||
\par }\pard \ltrpar\ql \fi180\li180\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin180\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi180\li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Project Files:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Command}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 cs}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\tx720\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 This file contains the class Command which inherits from IExternalCommand interf
|
||||
\hich\af1\dbch\af31505\loch\f1 ace and implements the Execute method, this class will pop up Room Schedule form.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 CtrlApplication.cs
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\tx720\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
This file contains the class CrtlApplication which implements IExternalApplication interface, this class will subscribe DocumentSaving/SavingAs event in O\hich\af1\dbch\af31505\loch\f1 nStartup method and unregister these events in OnShutdown method.
|
||||
|
||||
\par \hich\af1\dbch\af31505\loch\f1 The OnStartup method will subscribe
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 RoomScheduleForm.cs}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
This file contains a Form class which consists of two DataGridView controls and three ComboBox controls. The data from spreadsheet a\hich\af1\dbch\af31505\loch\f1 nd available rooms, levels and phases will be displayed in these controls}{\rtlch\fcs1
|
||||
\af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 RoomsData.cs}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
This file will be used to retrieve available rooms, levels and phases data from current Revit project and generate rooms DataTable data for display in DataGridView co\hich\af1\dbch\af31505\loch\f1 ntrol.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 XlsDBConnector.cs}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
This file will be used to connect to Excel spreadsheet file (.xls), retrieve available tables and generate DataTable data for display in DataGridView control; besides, this class will be used to update spreadsheet data or insert n
|
||||
\hich\af1\dbch\af31505\loch\f1 ew data to spreadsheet}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 EventsReactor.cs}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
This file defines the class EventsReactor which contains three delegates methods for DocumentSaving/SavingAs/Closing events, the delegate methods will implement accordingly update when they are raised.
|
||||
\par \hich\af1\dbch\af31505\loch\f1 Class Events\hich\af1\dbch\af31505\loch\f1
|
||||
Reactor also includes methods which implement update for spreadsheet and Revit rooms; when update, related logging information will be dumped to log file(RoomSchedule.log) for your review later.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Description:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
\par }\pard \ltrpar\ql \li2\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin2\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 This sample uses OleDb.OleDbConnectio\hich\af1\dbch\af31505\loch\f1
|
||||
n, OleDb.OleDbCommand and relevant Revit classes mostly to synchronize spreadsheet based room schedule with Revit rooms. This sample implements two functionalities: import room schedule from spreadsheet and update room area fields in spreadsheet by using
|
||||
\hich\af1\dbch\af31505\loch\f1 d\hich\af1\dbch\af31505\loch\f1 ata from Revit}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\tx360\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1
|
||||
To deal with .xls file (read, update), use OleDb.OleDbConnection, OleDbCommand, DataTable classes of .NET}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1 To create rooms in specified phase, use Creation.Document.NewRoom(Phase)}
|
||||
{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1 To get specified element you want, use Document.get_E\hich\af1\dbch\af31505\loch\f1 lements(Filter) method.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1 To get parameters of room, use Room.get_Parameter(String paramName) method}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1 To get all rooms in each PlanTopology}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 ,}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 use PlanTopology.Rooms property.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\tx360\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 -\tab \hich\af1\dbch\af31505\loch\f1
|
||||
DocumenSaving/DocumentSavedAs/DocumentClosed of controlled application level s\hich\af1\dbch\af31505\loch\f1 ubscribed and implements related functionality.
|
||||
\par -\tab \hich\af1\dbch\af31505\loch\f1 Class DefinitionFile, DefinitionGroup, Definition and InstanceBinding will be used to create shared parameter for rooms.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Instructions:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\cf2\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\cf2\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\tx360\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 1.\tab }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid13177920
|
||||
\hich\af1\dbch\af31505\loch\f1 Copy the provided .addin file under sample folder to install folde\hich\af1\dbch\af31505\loch\f1 r of your Revit and specify full paths for dll. }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277
|
||||
\hich\af1\dbch\af31505\loch\f1 . }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 2.\tab \hich\f1
|
||||
Before running this sample, please make sure the Excel file has a work sheet which must contain \'93\loch\f1 \hich\f1 ID\'94\loch\f1 \hich\f1 , \'93\loch\f1 \hich\f1 Room Area \'93\loch\f1 \hich\f1 , \'93\loch\f1 \hich\f1 Room Name\'94\loch\f1 \hich\f1 ,
|
||||
\'93\loch\f1 \hich\f1 Room Number\'94\loch\f1 \hich\f1 , \'93\loch\f1 \hich\f1 Room Comments\'94\loch\f1 columns at first row, the ID and Area col\hich\af1\dbch\af31505\loch\f1 umns should be number values}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277 ,}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
the other columns should be text value, and the spreadsheet should be writeable too. Under project folder there is one Excel file named RoomSchedule.xls, you can use this file as example to define your data or import this file
|
||||
\hich\af1\dbch\af31505\loch\f1 directly in below steps. }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 3.\tab \hich\f1 Run this sample directly, the \'93\loch\f1 \hich\f1 Room Schedule\'94\loch\f1
|
||||
form will pop up, all the available levels and phases will be listed in ComboBox controls separately.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 4.\tab \hich\f1 Click \'93\loch\f1 Import Excel}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 ...}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\insrsid4203277 \loch\af1\dbch\af31505\hich\f1 \'94\loch\f1 button will allow you to select one spreadsheet fi\hich\af1\dbch\af31505\loch\f1
|
||||
le. This sample will retrieve all available work sheets in this sheet file and list them in ComboBox control. }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 5.\tab Select the work sheet which defines the rooms, and then all room data in this sheet will be displayed in DataGridView control}{\rtlch\fcs1 \af0\afs20
|
||||
\ltrch\fcs0 \f0\fs20\insrsid4203277 .
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\tx360\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 6.\tab Select one p\hich\af1\dbch\af31505\loch\f1 \hich\f1
|
||||
hase and click \'93\loch\f1 \hich\f1 Create Unplaced Rooms\'94\loch\f1 will create rooms (without placing them) according to the spread sheet rooms\hich\f1 \rquote \loch\f1 data (The new unplaced rooms\hich\f1 \rquote \loch\f1
|
||||
properties will set by the relevant columns in spreadsheet data)}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 \hich\f1 A shared parameter named
|
||||
\'93\loch\f1 \hich\f1 External Room ID\'94\hich\af1\dbch\af31505\loch\f1 will be added to Room category and the parameter value is mapped to spread sheet rooms\hich\f1 \rquote \loch\f1 ID}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277 .}{
|
||||
\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Document Save, SaveAs events will be subscribed too after rooms\hich\f1 \rquote \loch\f1 creation.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 7.\tab \hich\f1 Check \'93\loch\f1 \hich\f1 Show All Rooms\'94\loch\f1
|
||||
will display all available rooms (placed and unplaced rooms) i\hich\af1\dbch\af31505\loch\f1 n current project; select one level will filter all rooms which are in selected level.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 8.\tab \hich\f1 Exit this sample, click the \'93\loch\f1 \hich\f1 Room\'94\loch\f1
|
||||
in Revit Basic tab, select the created rooms in above steps and place them. Click Save/SaveAs command to save project: After Save d\hich\af1\dbch\af31505\loch\f1 \hich\f1 ialog this sample will update the \'93\loch\f1 \hich\f1 Room Area\'94\loch\f1
|
||||
\hich\f1 , \'93\loch\f1 \hich\f1 Room Name\'94\loch\f1 \hich\f1 , \'93\loch\f1 \hich\f1 Room Number\'94\loch\f1 \hich\f1 and \'93\loch\f1 \hich\f1 Room Comments\'94\loch\f1
|
||||
column data of work sheet by the actual values of mapped and placed room. You can open log file(RoomSchedule.log) to review details of update.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 9.\tab \hich\af1\dbch\af31505\loch\f1 \hich\f1
|
||||
If there are new rooms which were created and placed by user manually, these rooms will be added into spreadsheet when save or save as is called, the \'93\loch\f1 \hich\f1 Room Comments\'94\loch\f1 \hich\f1 column in spread will be set to \'93\loch\f1
|
||||
\hich\f1 <Added from Revit>\'94\loch\f1 if the room doesn\hich\f1 \rquote \loch\f1 t have comments. B\hich\af1\dbch\af31505\loch\f1 e\hich\af1\dbch\af31505\loch\f1 \hich\f1 sides, the \'93\loch\f1 \hich\f1 External Room ID\'94\loch\f1
|
||||
parameter of new room will be set to room\hich\f1 \rquote \loch\f1 s id value after adding.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 10.\tab When creating unplaced rooms, the new rooms\hich\f1 \rquote \loch\f1 \hich\f1 name, number and comments properties will be set by the \'93\loch\f1
|
||||
\hich\f1 Room Name\'94\loch\f1 \hich\f1 , \'93\loch\f1 \hich\f1 Room Number\'94\loch\f1 \hich\f1 and \'93\loch\f1 \hich\f1 Room Comments\'94\loch\f1 column \hich\af1\dbch\af31505\loch\f1 values in room sheet automatically. }{\rtlch\fcs1 \af0\afs20
|
||||
\ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 11.\tab
|
||||
If spreadsheet room was already mapped by Revit room, new creation will be skipped (some message will be popped up), because more than one Revit room maps to same one spreadsheet room is not allowed}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0
|
||||
\f0\fs20\insrsid4203277 .}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 \hich\f1 Click \'93\hich\af1\dbch\af31505\loch\f1 \hich\f1 Clear External Room ID\'94\loch\f1
|
||||
button will clear the existing maps (all values of shared parameter will to set to null) and allow user to create more unplaced rooms.}{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\outlinelevel0\rin0\lin0\itap0\pararsid11688384 {\rtlch\fcs1 \ab\af1\afs20 \ltrch\fcs0 \b\f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 Notes:}{\rtlch\fcs1 \af1\afs20 \ltrch\fcs0
|
||||
\f1\fs20\cf2\insrsid4203277 \hich\af1\dbch\af31505\loch\f1
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\tx360\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 1.\tab
|
||||
The sample is not supported with 64-bit Revit since there is no 64-bit Jet OLE DB Pro\hich\af1\dbch\af31505\loch\f1 vider available.
|
||||
\par }\pard \ltrpar\ql \fi-360\li360\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin360\itap0 {\rtlch\fcs1 \af1\afs20 \ltrch\fcs0 \f1\fs20\insrsid4203277 \hich\af1\dbch\af31505\loch\f1 2.\tab
|
||||
Because of limitations of Excel ISAM driver, if there is both number data and text data in Name, Number or Comments columns in Excel file, please format number data to text type by adding a single quotation in front of data as prefix, t
|
||||
\hich\af1\dbch\af31505\loch\f1 ext format will make sample\hich\f1 \rquote \loch\f1 \hich\f1
|
||||
s read and update operations work well. Again, generally the Rooms created manually or by API will have text Name, and the Comments column will be filled with text \'93\loch\f1 \hich\f1 <null>\'94\loch\f1 if Revit room doesn\hich\f1 \rquote \loch\f1
|
||||
t have Comments value, so you\hich\f1 \rquote \loch\f1 d be\hich\af1\dbch\af31505\loch\f1 t\hich\af1\dbch\af31505\loch\f1 ter make sure there is no number data in Name and Comments column.
|
||||
\par \hich\af1\dbch\af31505\loch\f1 3.\tab The Name and Comments of Room should not contain single quote (\hich\f1 \lquote \loch\f1 ) because it will conflict with SQL query line.
|
||||
\par }{\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\faauto\rin0\lin0\itap0 {\rtlch\fcs1 \af0\afs20 \ltrch\fcs0 \f0\fs20\insrsid4203277
|
||||
\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8
|
||||
72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7
|
||||
2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b
|
||||
44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7
|
||||
065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000
|
||||
00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08
|
||||
84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc
|
||||
52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353
|
||||
bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468
|
||||
656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c
|
||||
070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7
|
||||
29e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f7468656d65
|
||||
312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87615b8116d8
|
||||
a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad79482a9c04
|
||||
98f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b5d8a314d3c
|
||||
94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab999fb7b471
|
||||
7509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9699640f671
|
||||
9e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd5868b37a088d1
|
||||
e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d60cf03ac1a5
|
||||
193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f9e7ef3f2d1
|
||||
17d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be15c308d3f2
|
||||
8acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a99793849c26ae6
|
||||
6252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d32a423279a
|
||||
668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2af074481847
|
||||
bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86e877f0034e
|
||||
16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb44f95d843b
|
||||
5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a6409fb44d0
|
||||
8741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c3d9058edf2
|
||||
c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db02565e85f3b966
|
||||
0d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276b9f7dec44b
|
||||
7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8c33585b5fb
|
||||
9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e51440ca2e0
|
||||
088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95b21be5ceaf
|
||||
8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff6dce591a26
|
||||
ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec69ffb9e65d0
|
||||
28d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239b75a5bb1e6
|
||||
345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a44959d366ad93
|
||||
b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e82db8df9f30
|
||||
254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f74
|
||||
68656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f24
|
||||
51eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198
|
||||
720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528
|
||||
a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000000000000000
|
||||
000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000000000000000
|
||||
002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000140200007468
|
||||
656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b000016000000000000000000
|
||||
00000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000270000000000
|
||||
00000000000000009b0900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000960a00000000}
|
||||
{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d
|
||||
617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169
|
||||
6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363
|
||||
656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e}
|
||||
{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4;
|
||||
\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9;
|
||||
\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7;
|
||||
\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference;
|
||||
\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000
|
||||
4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000
|
||||
d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f0000000000000000000000007045
|
||||
fd243139cb01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000105000000000000}}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Application">
|
||||
<Name>External Tool</Name>
|
||||
<Assembly>RoomSchedule.dll</Assembly>
|
||||
<ClientId>77f598f4-21b9-4308-986e-ac8cf992deff</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.RoomSchedule.CrtlApplication</FullClassName>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>RoomSchedule.dll</Assembly>
|
||||
<ClientId>f3a72c3f-8119-4658-a11b-1dd45569093c</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.RoomSchedule.Command</FullClassName>
|
||||
<Text>Room Schedule</Text>
|
||||
<Description>Room Schedule.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
</RevitAddIns>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CAB59A7F-7317-4E91-B3DE-BA016E38C01A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Revit.SDK.Samples.RoomSchedule</RootNamespace>
|
||||
<AssemblyName>RoomSchedule</AssemblyName>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CtrlApplication.cs" />
|
||||
<Compile Include="EventsReactor.cs" />
|
||||
<Compile Include="RoomScheduleForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RoomScheduleForm.Designer.cs">
|
||||
<DependentUpon>RoomScheduleForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="RoomScheduleForm.resx">
|
||||
<DependentUpon>RoomScheduleForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="RoomsData.cs" />
|
||||
<Compile Include="XlsDBConnector.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
|
||||
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,313 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// Room Schedule form, used to retrieve data from .xls data source and create new rooms.
|
||||
/// </summary>
|
||||
partial class RoomScheduleForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.importRoomButton = new System.Windows.Forms.Button();
|
||||
this.sheetDataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.tableLabel = new System.Windows.Forms.Label();
|
||||
this.tablesComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.levelLabel = new System.Windows.Forms.Label();
|
||||
this.revitRoomDataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.levelComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.roomsGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.clearIDButton = new System.Windows.Forms.Button();
|
||||
this.showAllRoomsCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.newRoomButton = new System.Windows.Forms.Button();
|
||||
this.phaseComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.Phase = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.roomExcelTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.closeButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.sheetDataGridView)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.revitRoomDataGridView)).BeginInit();
|
||||
this.roomsGroupBox.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// importRoomButton
|
||||
//
|
||||
this.importRoomButton.Location = new System.Drawing.Point(595, 17);
|
||||
this.importRoomButton.Name = "importRoomButton";
|
||||
this.importRoomButton.Size = new System.Drawing.Size(109, 23);
|
||||
this.importRoomButton.TabIndex = 1;
|
||||
this.importRoomButton.Text = "&Import Excel...";
|
||||
this.importRoomButton.UseVisualStyleBackColor = true;
|
||||
this.importRoomButton.Click += new System.EventHandler(this.importRoomButton_Click);
|
||||
//
|
||||
// sheetDataGridView
|
||||
//
|
||||
this.sheetDataGridView.AllowUserToAddRows = false;
|
||||
this.sheetDataGridView.AllowUserToDeleteRows = false;
|
||||
this.sheetDataGridView.AllowUserToResizeRows = false;
|
||||
this.sheetDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.sheetDataGridView.Location = new System.Drawing.Point(5, 48);
|
||||
this.sheetDataGridView.Name = "sheetDataGridView";
|
||||
this.sheetDataGridView.ReadOnly = true;
|
||||
this.sheetDataGridView.RowHeadersVisible = false;
|
||||
this.sheetDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.sheetDataGridView.Size = new System.Drawing.Size(699, 155);
|
||||
this.sheetDataGridView.TabIndex = 1;
|
||||
//
|
||||
// tableLabel
|
||||
//
|
||||
this.tableLabel.AutoSize = true;
|
||||
this.tableLabel.Location = new System.Drawing.Point(6, 22);
|
||||
this.tableLabel.Name = "tableLabel";
|
||||
this.tableLabel.Size = new System.Drawing.Size(66, 13);
|
||||
this.tableLabel.TabIndex = 2;
|
||||
this.tableLabel.Text = "Room Sheet";
|
||||
//
|
||||
// tablesComboBox
|
||||
//
|
||||
this.tablesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.tablesComboBox.FormattingEnabled = true;
|
||||
this.tablesComboBox.Location = new System.Drawing.Point(78, 19);
|
||||
this.tablesComboBox.Name = "tablesComboBox";
|
||||
this.tablesComboBox.Size = new System.Drawing.Size(187, 21);
|
||||
this.tablesComboBox.TabIndex = 0;
|
||||
this.tablesComboBox.SelectedIndexChanged += new System.EventHandler(this.tablesComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// levelLabel
|
||||
//
|
||||
this.levelLabel.AutoSize = true;
|
||||
this.levelLabel.Location = new System.Drawing.Point(39, 19);
|
||||
this.levelLabel.Name = "levelLabel";
|
||||
this.levelLabel.Size = new System.Drawing.Size(33, 13);
|
||||
this.levelLabel.TabIndex = 2;
|
||||
this.levelLabel.Text = "Level";
|
||||
//
|
||||
// revitRoomDataGridView
|
||||
//
|
||||
this.revitRoomDataGridView.AllowUserToAddRows = false;
|
||||
this.revitRoomDataGridView.AllowUserToDeleteRows = false;
|
||||
this.revitRoomDataGridView.AllowUserToResizeRows = false;
|
||||
this.revitRoomDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.revitRoomDataGridView.Location = new System.Drawing.Point(6, 42);
|
||||
this.revitRoomDataGridView.Name = "revitRoomDataGridView";
|
||||
this.revitRoomDataGridView.ReadOnly = true;
|
||||
this.revitRoomDataGridView.RowHeadersVisible = false;
|
||||
this.revitRoomDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.revitRoomDataGridView.Size = new System.Drawing.Size(699, 169);
|
||||
this.revitRoomDataGridView.TabIndex = 1;
|
||||
//
|
||||
// levelComboBox
|
||||
//
|
||||
this.levelComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.levelComboBox.FormattingEnabled = true;
|
||||
this.levelComboBox.Location = new System.Drawing.Point(78, 16);
|
||||
this.levelComboBox.Name = "levelComboBox";
|
||||
this.levelComboBox.Size = new System.Drawing.Size(187, 21);
|
||||
this.levelComboBox.Sorted = true;
|
||||
this.levelComboBox.TabIndex = 0;
|
||||
this.levelComboBox.SelectedIndexChanged += new System.EventHandler(this.levelComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// roomsGroupBox
|
||||
//
|
||||
this.roomsGroupBox.Controls.Add(this.clearIDButton);
|
||||
this.roomsGroupBox.Controls.Add(this.showAllRoomsCheckBox);
|
||||
this.roomsGroupBox.Controls.Add(this.revitRoomDataGridView);
|
||||
this.roomsGroupBox.Controls.Add(this.levelComboBox);
|
||||
this.roomsGroupBox.Controls.Add(this.levelLabel);
|
||||
this.roomsGroupBox.Location = new System.Drawing.Point(12, 256);
|
||||
this.roomsGroupBox.Name = "roomsGroupBox";
|
||||
this.roomsGroupBox.Size = new System.Drawing.Size(711, 220);
|
||||
this.roomsGroupBox.TabIndex = 1;
|
||||
this.roomsGroupBox.TabStop = false;
|
||||
this.roomsGroupBox.Text = "Revit Rooms";
|
||||
//
|
||||
// clearIDButton
|
||||
//
|
||||
this.clearIDButton.Location = new System.Drawing.Point(560, 13);
|
||||
this.clearIDButton.Name = "clearIDButton";
|
||||
this.clearIDButton.Size = new System.Drawing.Size(144, 23);
|
||||
this.clearIDButton.TabIndex = 3;
|
||||
this.clearIDButton.Text = "Clear &External Room ID";
|
||||
this.clearIDButton.UseVisualStyleBackColor = true;
|
||||
this.clearIDButton.Click += new System.EventHandler(this.clearIDButton_Click);
|
||||
//
|
||||
// showAllRoomsCheckBox
|
||||
//
|
||||
this.showAllRoomsCheckBox.AutoSize = true;
|
||||
this.showAllRoomsCheckBox.Location = new System.Drawing.Point(277, 18);
|
||||
this.showAllRoomsCheckBox.Name = "showAllRoomsCheckBox";
|
||||
this.showAllRoomsCheckBox.Size = new System.Drawing.Size(103, 17);
|
||||
this.showAllRoomsCheckBox.TabIndex = 2;
|
||||
this.showAllRoomsCheckBox.Text = "&Show All Rooms";
|
||||
this.showAllRoomsCheckBox.UseVisualStyleBackColor = true;
|
||||
this.showAllRoomsCheckBox.CheckedChanged += new System.EventHandler(this.showAllRoomsCheckBox_CheckedChanged);
|
||||
//
|
||||
// newRoomButton
|
||||
//
|
||||
this.newRoomButton.Location = new System.Drawing.Point(271, 209);
|
||||
this.newRoomButton.Name = "newRoomButton";
|
||||
this.newRoomButton.Size = new System.Drawing.Size(136, 23);
|
||||
this.newRoomButton.TabIndex = 3;
|
||||
this.newRoomButton.Text = "Create Unplaced &Rooms";
|
||||
this.newRoomButton.UseVisualStyleBackColor = true;
|
||||
this.newRoomButton.Click += new System.EventHandler(this.newRoomButton_Click);
|
||||
//
|
||||
// phaseComboBox
|
||||
//
|
||||
this.phaseComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.phaseComboBox.FormattingEnabled = true;
|
||||
this.phaseComboBox.Location = new System.Drawing.Point(78, 209);
|
||||
this.phaseComboBox.Name = "phaseComboBox";
|
||||
this.phaseComboBox.Size = new System.Drawing.Size(187, 21);
|
||||
this.phaseComboBox.Sorted = true;
|
||||
this.phaseComboBox.TabIndex = 2;
|
||||
//
|
||||
// Phase
|
||||
//
|
||||
this.Phase.AutoSize = true;
|
||||
this.Phase.Location = new System.Drawing.Point(32, 214);
|
||||
this.Phase.Name = "Phase";
|
||||
this.Phase.Size = new System.Drawing.Size(40, 13);
|
||||
this.Phase.TabIndex = 2;
|
||||
this.Phase.Text = "Phase ";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.roomExcelTextBox);
|
||||
this.groupBox1.Controls.Add(this.tablesComboBox);
|
||||
this.groupBox1.Controls.Add(this.newRoomButton);
|
||||
this.groupBox1.Controls.Add(this.phaseComboBox);
|
||||
this.groupBox1.Controls.Add(this.tableLabel);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.Phase);
|
||||
this.groupBox1.Controls.Add(this.sheetDataGridView);
|
||||
this.groupBox1.Controls.Add(this.importRoomButton);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(711, 238);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Spreadsheet Rooms Information";
|
||||
//
|
||||
// roomExcelTextBox
|
||||
//
|
||||
this.roomExcelTextBox.Location = new System.Drawing.Point(271, 19);
|
||||
this.roomExcelTextBox.Name = "roomExcelTextBox";
|
||||
this.roomExcelTextBox.ReadOnly = true;
|
||||
this.roomExcelTextBox.Size = new System.Drawing.Size(318, 20);
|
||||
this.roomExcelTextBox.TabIndex = 3;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(6, 45);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(0, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.closeButton.Location = new System.Drawing.Point(648, 482);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.closeButton.TabIndex = 2;
|
||||
this.closeButton.Text = "&Close";
|
||||
this.closeButton.UseVisualStyleBackColor = true;
|
||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||
//
|
||||
// RoomScheduleForm
|
||||
//
|
||||
this.AcceptButton = this.closeButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.closeButton;
|
||||
this.ClientSize = new System.Drawing.Size(735, 512);
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.roomsGroupBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "RoomScheduleForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Room Schedule";
|
||||
((System.ComponentModel.ISupportInitialize)(this.sheetDataGridView)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.revitRoomDataGridView)).EndInit();
|
||||
this.roomsGroupBox.ResumeLayout(false);
|
||||
this.roomsGroupBox.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button importRoomButton;
|
||||
private System.Windows.Forms.DataGridView sheetDataGridView;
|
||||
private System.Windows.Forms.Label tableLabel;
|
||||
private System.Windows.Forms.ComboBox tablesComboBox;
|
||||
private System.Windows.Forms.Label levelLabel;
|
||||
private System.Windows.Forms.DataGridView revitRoomDataGridView;
|
||||
private System.Windows.Forms.ComboBox levelComboBox;
|
||||
private System.Windows.Forms.GroupBox roomsGroupBox;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Button closeButton;
|
||||
private System.Windows.Forms.Button newRoomButton;
|
||||
private System.Windows.Forms.ComboBox phaseComboBox;
|
||||
private System.Windows.Forms.Label Phase;
|
||||
private System.Windows.Forms.CheckBox showAllRoomsCheckBox;
|
||||
private System.Windows.Forms.Button clearIDButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox roomExcelTextBox;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,714 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Data.OleDb;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
using Autodesk.Revit.DB.Events;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// Room Schedule form, used to retrieve data from .xls data source and create new rooms.
|
||||
/// </summary>
|
||||
public partial class RoomScheduleForm : System.Windows.Forms.Form
|
||||
{
|
||||
#region Class Member Variables
|
||||
|
||||
// Reserve name of data source
|
||||
private String m_dataBaseName;
|
||||
|
||||
// Revit external command data
|
||||
private ExternalCommandData m_commandData;
|
||||
|
||||
// Current active document
|
||||
private Document m_document;
|
||||
|
||||
// Room data information
|
||||
private RoomsData m_roomData;
|
||||
|
||||
// All levels in Revit document.
|
||||
private List<Level> m_allLevels = new List<Level>();
|
||||
|
||||
// All available phases in Revit document.
|
||||
private List<Phase> m_allPhases = new List<Phase>();
|
||||
|
||||
// Room work sheet name
|
||||
private String m_roomTableName;
|
||||
|
||||
// All rooms data from spread sheet
|
||||
private DataTable m_spreadRoomsTable;
|
||||
#endregion
|
||||
|
||||
#region Class Constructor Method
|
||||
/// <summary>
|
||||
/// Class constructor
|
||||
/// </summary>
|
||||
/// <param name="commandData">Revit external command data</param>
|
||||
public RoomScheduleForm(ExternalCommandData commandData)
|
||||
{
|
||||
// UI initialization
|
||||
InitializeComponent();
|
||||
|
||||
// reserve Revit command data and get rooms information,
|
||||
// and then display rooms information in DataGrideView
|
||||
m_commandData = commandData;
|
||||
m_document = m_commandData.Application.ActiveUIDocument.Document;
|
||||
m_roomData = new RoomsData(commandData.Application.ActiveUIDocument.Document);
|
||||
|
||||
// bind levels and phases data to level and phase ComboBox controls
|
||||
GetAllLevelsAndPhases();
|
||||
|
||||
// list all levels and phases
|
||||
this.levelComboBox.DisplayMember = "Name";
|
||||
this.levelComboBox.DataSource = m_allLevels;
|
||||
this.levelComboBox.SelectedIndex = 0;
|
||||
|
||||
this.phaseComboBox.DisplayMember = "Name";
|
||||
this.phaseComboBox.DataSource = m_allPhases;
|
||||
this.phaseComboBox.SelectedIndex = 0;
|
||||
|
||||
// if there is no phase, newRoomButton will be disabled.
|
||||
if (m_allPhases.Count == 0)
|
||||
{
|
||||
newRoomButton.Enabled = false;
|
||||
}
|
||||
|
||||
// check to see whether current Revit document was mapped to spreadsheet.
|
||||
UpdateRoomMapSheetInfo();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class Implementations
|
||||
/// <summary>
|
||||
/// Get all available levels and phases from current document
|
||||
/// </summary>
|
||||
private void GetAllLevelsAndPhases()
|
||||
{
|
||||
// get all levels which can place rooms
|
||||
foreach (PlanTopology planTopology in m_document.PlanTopologies)
|
||||
{
|
||||
m_allLevels.Add(planTopology.Level);
|
||||
}
|
||||
|
||||
// get all phases by filter type
|
||||
FilteredElementCollector collector = new FilteredElementCollector(m_document);
|
||||
ICollection<Element> allPhases = collector.OfClass(typeof(Phase)).ToElements();
|
||||
foreach (Phase phs in allPhases)
|
||||
{
|
||||
m_allPhases.Add(phs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create shared parameter for Rooms category
|
||||
/// </summary>
|
||||
/// <returns>True, shared parameter exists; false, doesn't exist</returns>
|
||||
private bool CreateMyRoomSharedParameter()
|
||||
{
|
||||
// Create Room Shared Parameter Routine: -->
|
||||
// 1: Check whether the Room shared parameter("External Room ID") has been defined.
|
||||
// 2: Share parameter file locates under sample directory of this .dll module.
|
||||
// 3: Add a group named "SDKSampleRoomScheduleGroup".
|
||||
// 4: Add a shared parameter named "External Room ID" to "Rooms" category, which is visible.
|
||||
// The "External Room ID" parameter will be used to map to spreadsheet based room ID(which is unique)
|
||||
|
||||
try
|
||||
{
|
||||
// check whether shared parameter exists
|
||||
if (ShareParameterExists(RoomsData.SharedParam))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// create shared parameter file
|
||||
String modulePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
String paramFile = modulePath + "\\RoomScheduleSharedParameters.txt";
|
||||
if (File.Exists(paramFile))
|
||||
{
|
||||
File.Delete(paramFile);
|
||||
}
|
||||
FileStream fs = File.Create(paramFile);
|
||||
fs.Close();
|
||||
|
||||
// cache application handle
|
||||
Autodesk.Revit.ApplicationServices.Application revitApp = m_commandData.Application.Application;
|
||||
|
||||
// prepare shared parameter file
|
||||
m_commandData.Application.Application.SharedParametersFilename = paramFile;
|
||||
|
||||
// open shared parameter file
|
||||
DefinitionFile parafile = revitApp.OpenSharedParameterFile();
|
||||
|
||||
// create a group
|
||||
DefinitionGroup apiGroup = parafile.Groups.Create("SDKSampleRoomScheduleGroup");
|
||||
|
||||
// create a visible "External Room ID" of text type.
|
||||
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions = new ExternalDefinitionCreationOptions(RoomsData.SharedParam, SpecTypeId.String.Text);
|
||||
Definition roomSharedParamDef = apiGroup.Definitions.Create(ExternalDefinitionCreationOptions);
|
||||
|
||||
// get Rooms category
|
||||
Category roomCat = m_commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms);
|
||||
CategorySet categories = revitApp.Create.NewCategorySet();
|
||||
categories.Insert(roomCat);
|
||||
|
||||
// insert the new parameter
|
||||
InstanceBinding binding = revitApp.Create.NewInstanceBinding(categories);
|
||||
m_commandData.Application.ActiveUIDocument.Document.ParameterBindings.Insert(roomSharedParamDef, binding);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Failed to create shared parameter: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test if the Room binds a specified shared parameter
|
||||
/// </summary>
|
||||
/// <param name="paramName">Parameter name to be checked</param>
|
||||
/// <returns>true, the definition exists, false, doesn't exist.</returns>
|
||||
private bool ShareParameterExists(String paramName)
|
||||
{
|
||||
BindingMap bindingMap = m_document.ParameterBindings;
|
||||
DefinitionBindingMapIterator iter = bindingMap.ForwardIterator();
|
||||
iter.Reset();
|
||||
|
||||
while (iter.MoveNext())
|
||||
{
|
||||
Definition tempDefinition = iter.Key;
|
||||
|
||||
// find the definition of which the name is the appointed one
|
||||
if (String.Compare(tempDefinition.Name, paramName) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the category which is bound
|
||||
ElementBinding binding = bindingMap.get_Item(tempDefinition) as ElementBinding;
|
||||
CategorySet bindCategories = binding.Categories;
|
||||
foreach (Category category in bindCategories)
|
||||
{
|
||||
if (category.Name
|
||||
== m_document.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms).Name)
|
||||
{
|
||||
// the definition with appointed name was bound to Rooms, return true
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// return false if shared parameter doesn't exist
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// My custom message box
|
||||
/// </summary>
|
||||
/// <param name="strMsg">message to be popped up</param>
|
||||
/// <param name="icon">icon to be displayed</param>
|
||||
public static void MyMessageBox(String strMsg, MessageBoxIcon icon)
|
||||
{
|
||||
TaskDialog.Show("Room Schedule", strMsg, TaskDialogCommonButtons.Ok);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update control display of form
|
||||
/// call this method when create new rooms or switch the room show(show all or show by level)
|
||||
/// </summary>
|
||||
/// <param name="bUpdateAllRooms">whether retrieve all rooms from Revit project once more</param>
|
||||
private void UpdateFormDisplay(bool bUpdateAllRooms)
|
||||
{
|
||||
// update Revit Rooms data when there is room creation
|
||||
if (bUpdateAllRooms)
|
||||
{
|
||||
m_roomData.UpdateRoomsData();
|
||||
}
|
||||
|
||||
revitRoomDataGridView.DataSource = null;
|
||||
if (showAllRoomsCheckBox.Checked)
|
||||
{
|
||||
// show all rooms in Revit project
|
||||
revitRoomDataGridView.DataSource = new DataView(m_roomData.GenRoomsDataTable(null));
|
||||
}
|
||||
else
|
||||
{
|
||||
// show all rooms in specified level
|
||||
levelComboBox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
// update this DataGridView
|
||||
revitRoomDataGridView.Update();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Display current Room sheet information: Excel path
|
||||
/// </summary>
|
||||
private void UpdateRoomMapSheetInfo()
|
||||
{
|
||||
int hashCode = m_document.GetHashCode();
|
||||
SheetInfo xlsAndTable = new SheetInfo("", "");
|
||||
if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
|
||||
{
|
||||
roomExcelTextBox.Text = "Mapped Sheet: " + xlsAndTable.FileName + ": " + xlsAndTable.SheetName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Some preparation and check before creating room.
|
||||
/// </summary>
|
||||
/// <param name="curPhase">Current phase used to create room, all rooms will be created in this phase.</param>
|
||||
/// <returns>Number indicates how many new rooms were created.</returns>
|
||||
private int RoomCreationStart()
|
||||
{
|
||||
int nNewRoomsSize = 0;
|
||||
// transaction is used to cancel room creation when exception occurs
|
||||
SubTransaction myTransaction = new SubTransaction(m_document);
|
||||
try
|
||||
{
|
||||
// Preparation before room creation starts
|
||||
Phase curPhase = null;
|
||||
if (!RoomCreationPreparation(ref curPhase))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get all existing rooms which have mapped to spreadsheet rooms.
|
||||
// we should skip the creation for those spreadsheet rooms which have been mapped by Revit rooms.
|
||||
Dictionary<int, string> existingRooms = new Dictionary<int, string>();
|
||||
foreach (Room room in m_roomData.Rooms)
|
||||
{
|
||||
Parameter sharedParameter = room.LookupParameter(RoomsData.SharedParam);
|
||||
if (null != sharedParameter && false == String.IsNullOrEmpty(sharedParameter.AsString()))
|
||||
{
|
||||
existingRooms.Add(room.Id.IntegerValue, sharedParameter.AsString());
|
||||
}
|
||||
}
|
||||
|
||||
#region Rooms Creation and Set
|
||||
myTransaction.Start();
|
||||
// create rooms with spread sheet based rooms data
|
||||
for (int row = 0; row < m_spreadRoomsTable.Rows.Count; row++)
|
||||
{
|
||||
// get the ID column value and use it to check whether this spreadsheet room is mapped by Revit room.
|
||||
String externaId = m_spreadRoomsTable.Rows[row][RoomsData.RoomID].ToString();
|
||||
if (existingRooms.ContainsValue(externaId))
|
||||
{
|
||||
// skip the spreadsheet room creation if it's mapped by Revit room
|
||||
continue;
|
||||
}
|
||||
|
||||
// create rooms in specified phase, but without placing them.
|
||||
Room newRoom = m_document.Create.NewRoom(curPhase);
|
||||
if (null == newRoom)
|
||||
{
|
||||
// abort the room creation and pop up failure message
|
||||
myTransaction.RollBack();
|
||||
|
||||
MyMessageBox("Create room failed.", MessageBoxIcon.Warning);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// set the shared parameter's value of Revit room
|
||||
Parameter sharedParam = newRoom.LookupParameter(RoomsData.SharedParam);
|
||||
if (null == sharedParam)
|
||||
{
|
||||
// abort the room creation and pop up failure message
|
||||
myTransaction.RollBack();
|
||||
MyMessageBox("Failed to get shared parameter, please try again.", MessageBoxIcon.Warning);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sharedParam.Set(externaId);
|
||||
}
|
||||
|
||||
// Update this new room with values of spreadsheet
|
||||
UpdateNewRoom(newRoom, row);
|
||||
|
||||
// remember how many new rooms were created, based on spread sheet data
|
||||
nNewRoomsSize++;
|
||||
}
|
||||
|
||||
// end this transaction if create all rooms successfully.
|
||||
myTransaction.Commit();
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// cancel this time transaction when exception occurs
|
||||
if (myTransaction.HasStarted())
|
||||
{
|
||||
myTransaction.RollBack();
|
||||
}
|
||||
|
||||
MyMessageBox(ex.Message, MessageBoxIcon.Warning);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// output unplaced rooms creation message
|
||||
String strMessage = string.Empty;
|
||||
int nSkippedRooms = m_spreadRoomsTable.Rows.Count - nNewRoomsSize;
|
||||
if (nSkippedRooms > 0)
|
||||
{
|
||||
strMessage = string.Format("{0} unplaced {1} created successfully.\r\n{2} skipped, {3}",
|
||||
nNewRoomsSize,
|
||||
(nNewRoomsSize > 1) ? ("rooms were") : ("room was"),
|
||||
nSkippedRooms.ToString() + ((nSkippedRooms > 1) ? (" were") : (" was")),
|
||||
(nSkippedRooms > 1) ? ("because they were already mapped by Revit rooms.") :
|
||||
("because it was already mapped by Revit rooms."));
|
||||
}
|
||||
else
|
||||
{
|
||||
strMessage = string.Format("{0} unplaced {1} created successfully.",
|
||||
nNewRoomsSize,
|
||||
(nNewRoomsSize > 1) ? ("rooms were") : ("room was"));
|
||||
}
|
||||
|
||||
// output creation message
|
||||
MyMessageBox(strMessage, MessageBoxIcon.Information);
|
||||
return nNewRoomsSize;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Some preparation and check before creating room.
|
||||
/// </summary>
|
||||
/// <param name="curPhase">Current phase used to create room, all rooms will be created in this phase.</param>
|
||||
/// <returns></returns>
|
||||
private bool RoomCreationPreparation(ref Phase curPhase)
|
||||
{
|
||||
// check to see whether there is available spread sheet based rooms to create
|
||||
if (null == m_spreadRoomsTable || null == m_spreadRoomsTable.Rows || m_spreadRoomsTable.Rows.Count == 0)
|
||||
{
|
||||
MyMessageBox("There is no available spread sheet based room to create.", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
// create shared parameter for "Room" category elements
|
||||
CreateMyRoomSharedParameter();
|
||||
|
||||
// create Revit rooms by using spread sheet based rooms
|
||||
// add "ID" data of spread sheet to Room element's share parameter: "External Room ID"
|
||||
DataColumn column = m_spreadRoomsTable.Columns[RoomsData.RoomID];
|
||||
if (column == null)
|
||||
{
|
||||
MyMessageBox("Failed to get ID data of spread sheet rooms.", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
// get phase used to create room
|
||||
foreach (Phase phase in m_allPhases)
|
||||
{
|
||||
if (String.Compare(phase.Name, phaseComboBox.Text) == 0)
|
||||
{
|
||||
curPhase = phase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (null == curPhase)
|
||||
{
|
||||
MyMessageBox("No available phase used to create room.", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update new room with values in spreadsheet, currently there are three columns need to be set.
|
||||
/// </summary>
|
||||
/// <param name="newRoom">New room to be updated.</param>
|
||||
/// <param name="index">The index of row in spreadsheet, use values of this row to update the new room.</param>
|
||||
private void UpdateNewRoom(Room newRoom, int row)
|
||||
{
|
||||
String[] constantColumns = { RoomsData.RoomName, RoomsData.RoomNumber, RoomsData.RoomComments };
|
||||
for (int col = 0; col < constantColumns.Length; col++)
|
||||
{
|
||||
// check to see whether the column exists in table
|
||||
if (m_spreadRoomsTable.Columns.IndexOf(constantColumns[col]) != -1)
|
||||
{
|
||||
// if value is not null or empty, set new rooms related parameter.
|
||||
String colValue = m_spreadRoomsTable.Rows[row][constantColumns[col]].ToString();
|
||||
if (String.IsNullOrEmpty(colValue))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (constantColumns[col])
|
||||
{
|
||||
case RoomsData.RoomName:
|
||||
newRoom.Name = colValue;
|
||||
break;
|
||||
case RoomsData.RoomNumber:
|
||||
newRoom.Number = colValue;
|
||||
break;
|
||||
case RoomsData.RoomComments:
|
||||
Parameter commentParam = newRoom.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
|
||||
if (null != commentParam)
|
||||
{
|
||||
commentParam.Set(colValue);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// no action for other parameter
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Class Events Implmentation
|
||||
/// <summary>
|
||||
/// Import room spread sheet and display them in form
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void importRoomButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog sfdlg = new OpenFileDialog())
|
||||
{
|
||||
// file dialog initialization
|
||||
sfdlg.Title = "Import Excel File";
|
||||
sfdlg.Filter = "Excel File(*.xls)|*.xls";
|
||||
sfdlg.RestoreDirectory = true;
|
||||
//
|
||||
// initialize the default file name
|
||||
int hashCode = m_document.GetHashCode();
|
||||
SheetInfo xlsAndTable = new SheetInfo(String.Empty, String.Empty);
|
||||
if (CrtlApplication.EventReactor.DocMappedSheetInfo(hashCode, ref xlsAndTable))
|
||||
{
|
||||
sfdlg.FileName = xlsAndTable.FileName;
|
||||
}
|
||||
//
|
||||
// import the select
|
||||
if (DialogResult.OK == sfdlg.ShowDialog())
|
||||
{
|
||||
try
|
||||
{
|
||||
// create xls data source connector and retrieve data from it
|
||||
m_dataBaseName = sfdlg.FileName;
|
||||
XlsDBConnector xlsCon = new XlsDBConnector(m_dataBaseName);
|
||||
|
||||
// bind table data to grid view and ComboBox control
|
||||
tablesComboBox.DataSource = xlsCon.RetrieveAllTables();
|
||||
|
||||
// close the connection
|
||||
xlsCon.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tablesComboBox.DataSource = null;
|
||||
MyMessageBox(ex.Message, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select one table(work sheet) and display its data to DataGridView control.
|
||||
/// after selection, generate data table from data source
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void tablesComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// update spread sheet based rooms
|
||||
sheetDataGridView.DataSource = null;
|
||||
m_roomTableName = tablesComboBox.SelectedValue as String;
|
||||
XlsDBConnector xlsCon = null;
|
||||
try
|
||||
{
|
||||
if (null != m_spreadRoomsTable)
|
||||
{
|
||||
m_spreadRoomsTable.Clear();
|
||||
}
|
||||
|
||||
// get all rooms table then close this connection immediately
|
||||
xlsCon = new XlsDBConnector(m_dataBaseName);
|
||||
|
||||
// generate room data table from room work sheet.
|
||||
m_spreadRoomsTable = xlsCon.GenDataTable(m_roomTableName);
|
||||
newRoomButton.Enabled = (0 == m_spreadRoomsTable.Rows.Count) ? false : true;
|
||||
|
||||
// close connection
|
||||
xlsCon.Dispose();
|
||||
|
||||
// update data source of DataGridView
|
||||
sheetDataGridView.DataSource = new DataView(m_spreadRoomsTable);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// close connection and update data source
|
||||
xlsCon.Dispose();
|
||||
sheetDataGridView.DataSource = null;
|
||||
MyMessageBox(ex.Message, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// update the static s_DocMapDict variable when user changes the Excel and room table
|
||||
int hashCode = m_document.GetHashCode();
|
||||
if (CrtlApplication.EventReactor.DocMonitored(hashCode))
|
||||
{
|
||||
// update spread sheet to which document is being mapped.
|
||||
CrtlApplication.EventReactor.UpdateSheeInfo(hashCode, new SheetInfo(m_dataBaseName, m_roomTableName));
|
||||
|
||||
// update current mapped room sheet information, only show this when Revit rooms were mapped to Excel sheet.
|
||||
UpdateRoomMapSheetInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filter rooms by specified level.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void levelComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// get the selected level, by comparing its name and ComboBox selected item's name
|
||||
Level selLevel = null;
|
||||
foreach (Level level in m_allLevels)
|
||||
{
|
||||
if (0 == String.Compare(level.Name, levelComboBox.Text))
|
||||
{
|
||||
selLevel = level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selLevel == null)
|
||||
{
|
||||
MyMessageBox("There is no available level to get rooms.", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// update data source of DataGridView
|
||||
this.revitRoomDataGridView.DataSource = null;
|
||||
this.revitRoomDataGridView.DataSource = new DataView(m_roomData.GenRoomsDataTable(selLevel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create new rooms according to spreadsheet based rooms data and specified phase.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void newRoomButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Create room process:
|
||||
// 1: Create shared parameter for "Room" category elements if it doesn't exist.
|
||||
// 2: Create rooms by using spread sheet's data:
|
||||
// a: We should make sure that each of spreadsheet room is mapped by only one Revit room;
|
||||
// if not, many Revit rooms map to one spreadsheet room will confuse user;
|
||||
// b: Set Name, Number and comment values of new rooms by spreadsheet relative data.
|
||||
// 3: Subscribe document Save, SaveAs and Close event handlers.
|
||||
// 4: Update all rooms data and pop up message
|
||||
|
||||
// Create rooms now
|
||||
int nNewRoomsSize = RoomCreationStart();
|
||||
if (nNewRoomsSize <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Reserve this document by its hash code, this document will be updated when it's about to be saved.
|
||||
int hashCode = m_document.GetHashCode();
|
||||
if (!CrtlApplication.EventReactor.DocMonitored(hashCode))
|
||||
{
|
||||
// reserves this document and current .xls file and table.
|
||||
CrtlApplication.EventReactor.UpdateSheeInfo(hashCode, new SheetInfo(m_dataBaseName, m_roomTableName));
|
||||
|
||||
// show current Excel and sheet name sample is mapped to, only show them after unplaced rooms were created.
|
||||
UpdateRoomMapSheetInfo();
|
||||
}
|
||||
|
||||
// update Revit rooms data and display of controls.
|
||||
UpdateFormDisplay(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show all rooms in current document
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void showAllRoomsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// disable and enable some controls
|
||||
levelComboBox.Enabled = !showAllRoomsCheckBox.Checked;
|
||||
|
||||
// update room display, there is no new creation, so it's not necessary to retrieve all rooms
|
||||
UpdateFormDisplay(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close the form.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void closeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear all values of shared parameters
|
||||
/// Allow user to create more unplaced rooms and update map relationships between Revit and spreadsheet rooms.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void clearIDButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
int nCount = 0;
|
||||
foreach (Room room in m_roomData.Rooms)
|
||||
{
|
||||
Parameter param = null;
|
||||
bool bExist = RoomsData.ShareParameterExists(room, RoomsData.SharedParam, ref param);
|
||||
if (bExist && null != param && false == String.IsNullOrEmpty(param.AsString()))
|
||||
{
|
||||
param.Set(String.Empty);
|
||||
nCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// update Revit rooms display
|
||||
if (nCount > 0)
|
||||
{
|
||||
UpdateFormDisplay(false);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,399 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// Iterates through the rooms in the project and get the information of all the rooms
|
||||
/// </summary>
|
||||
public class RoomsData
|
||||
{
|
||||
#region Class Constant Variables
|
||||
/// <summary>
|
||||
/// Constant name for RoomID, this column must exist in first row.
|
||||
/// </summary>
|
||||
public const String RoomID = "ID";
|
||||
|
||||
/// <summary>
|
||||
/// Constant name for room area, this column must exist in first row
|
||||
/// </summary>
|
||||
public const String RoomArea = "Room Area";
|
||||
|
||||
/// <summary>
|
||||
/// Constant named for room name, this column must exist in first row
|
||||
/// </summary>
|
||||
public const String RoomName = "Room Name";
|
||||
|
||||
/// <summary>
|
||||
/// Constant name for room number, this column must exist in first row
|
||||
/// </summary>
|
||||
public const String RoomNumber = "Room Number";
|
||||
|
||||
/// <summary>
|
||||
/// Constant name for room number, this column must exist in first row
|
||||
/// </summary>
|
||||
public const String RoomComments = "Room Comments";
|
||||
|
||||
/// <summary>
|
||||
/// Constant name for shared parameter,
|
||||
/// the mapped room id of spread sheet will saved in this parameter.
|
||||
/// </summary>
|
||||
public const String SharedParam = "External Room ID";
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Member Variables
|
||||
/// <summary>
|
||||
/// Active document to which this RoomsData instance belongs
|
||||
/// </summary>
|
||||
Document m_activeDocument;
|
||||
|
||||
/// <summary>
|
||||
/// a list to store all rooms in the project
|
||||
/// </summary>
|
||||
List<Room> m_rooms = new List<Room>();
|
||||
|
||||
/// <summary>
|
||||
/// parameters which will be displayed in DataGridView
|
||||
/// </summary>
|
||||
List<BuiltInParameter> m_parameters = new List<BuiltInParameter>();
|
||||
|
||||
/// <summary>
|
||||
/// a list to store column names of Rooms
|
||||
/// </summary>
|
||||
List<String> m_columnNames = new List<string>();
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Properties
|
||||
/// <summary>
|
||||
/// A list of all the rooms in the project
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<Room> Rooms
|
||||
{
|
||||
get
|
||||
{
|
||||
return new ReadOnlyCollection<Room>(m_rooms);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Constructor Method
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="activeDocument">Revit project.</param>
|
||||
public RoomsData(Document activeDocument)
|
||||
{
|
||||
m_activeDocument = activeDocument;
|
||||
|
||||
// initialize the output parameters
|
||||
InitializeParameters();
|
||||
|
||||
// get all the rooms in the project
|
||||
GetAllRooms(activeDocument);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Public Methods
|
||||
/// <summary>
|
||||
/// Update rooms data after room creation happens in Revit
|
||||
/// </summary>
|
||||
public void UpdateRoomsData()
|
||||
{
|
||||
// clear all rooms and re-retrieve data from Revit
|
||||
m_rooms.Clear();
|
||||
GetAllRooms(m_activeDocument);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get all parameters to be displayed in DataGridView.
|
||||
/// </summary>
|
||||
/// <param name="specifiedParams">all parameters specified by user.</param>
|
||||
public void UpdateParameters(ReadOnlyCollection<BuiltInParameter> specifiedParams)
|
||||
{
|
||||
// if there is no instance, parameter setting is not allowed
|
||||
if (m_rooms.Count <= 0)
|
||||
{
|
||||
throw new Exception("No element instance to set parameters");
|
||||
}
|
||||
|
||||
// clear old parameters data
|
||||
m_parameters.Clear();
|
||||
m_columnNames.Clear();
|
||||
|
||||
// get column names of room by specified parameters
|
||||
Room firstRoom = m_rooms[0];
|
||||
foreach (BuiltInParameter param in specifiedParams)
|
||||
{
|
||||
// add this parameter
|
||||
m_parameters.Add(param);
|
||||
|
||||
// store all specified parameter names of room.
|
||||
Parameter toomPara = firstRoom.get_Parameter(param);
|
||||
m_columnNames.Add(toomPara.Definition.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate all rooms which are located in specified level.
|
||||
/// A DataTable data object will be generated after this method call.
|
||||
/// </summary>
|
||||
/// <param name="level">the specified level to retrieve rooms</param>
|
||||
/// <returns>DataTable generated from rooms</returns>
|
||||
public DataTable GenRoomsDataTable(Level level)
|
||||
{
|
||||
// get all Rooms information and generate a DataTable
|
||||
if (m_rooms.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// generate columns by all parameters
|
||||
DataTable newTable = new DataTable();
|
||||
foreach (String col in m_columnNames)
|
||||
{
|
||||
DataColumn column = new DataColumn();
|
||||
column.ColumnName = col;
|
||||
column.ReadOnly = true;
|
||||
column.DataType = System.Type.GetType("System.String");
|
||||
newTable.Columns.Add(column);
|
||||
}
|
||||
|
||||
// add constant column: External Room ID
|
||||
DataColumn constantCol = new DataColumn();
|
||||
constantCol.ColumnName = SharedParam;
|
||||
constantCol.ReadOnly = true;
|
||||
constantCol.DataType = System.Type.GetType("System.String");
|
||||
newTable.Columns.Add(constantCol);
|
||||
|
||||
// filter rooms by level
|
||||
foreach (Room room in m_rooms)
|
||||
{
|
||||
// check whether room is located at specified level
|
||||
if ((null == level) || (m_activeDocument.GetElement(room.LevelId) != null && room.LevelId.IntegerValue == level.Id.IntegerValue))
|
||||
{
|
||||
DataRow dataRow = newTable.NewRow();
|
||||
for (int i = 0; i < m_parameters.Count; i++)
|
||||
{
|
||||
dataRow[i] = GetProperty(m_activeDocument, room, m_parameters[i], true);
|
||||
}
|
||||
|
||||
// add constant column value: External Room ID
|
||||
Parameter param = null;
|
||||
bool bExist = ShareParameterExists(room, SharedParam, ref param);
|
||||
if (bExist && null != param && false == String.IsNullOrEmpty(param.AsString()))
|
||||
{
|
||||
dataRow[m_parameters.Count] = param.AsString();
|
||||
}
|
||||
else
|
||||
{
|
||||
dataRow[m_parameters.Count] = "<null>";
|
||||
}
|
||||
|
||||
// add this row
|
||||
newTable.Rows.Add(dataRow);
|
||||
}
|
||||
}
|
||||
|
||||
return newTable;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the room property value according the parameter name
|
||||
/// </summary>
|
||||
/// <param name="activeDoc">Current active document.</param>
|
||||
/// <param name="room">an instance of room class</param>
|
||||
/// <param name="paraEnum">the parameter used to get parameter value</param>
|
||||
/// <param name="useValue">convert parameter to value type or not.
|
||||
/// if true, the value of parameter will be with unit.
|
||||
/// if false, the value of parameter will be without unit.</param>
|
||||
/// <returns>the string value of property specified by shared parameter</returns>
|
||||
public static String GetProperty(Document activeDoc, Room room, BuiltInParameter paraEnum, bool useValue)
|
||||
{
|
||||
String propertyValue = null; //the value of parameter
|
||||
|
||||
// Assuming the build in parameter is legal for room.
|
||||
// if the room is not placed, some properties are not available, i.g. Level name, Area ...
|
||||
// trying to retrieve them will throw exception;
|
||||
// however some parameters are available, e.g.: name, number
|
||||
Parameter param;
|
||||
try
|
||||
{
|
||||
param = room.get_Parameter(paraEnum);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// throwing exception for this parameter is acceptable if it's a unplaced room
|
||||
if (null == room.Location)
|
||||
{
|
||||
propertyValue = "Not Placed";
|
||||
return propertyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Illegal built in parameter.");
|
||||
}
|
||||
}
|
||||
|
||||
// get the parameter via the built in parameter
|
||||
if (null == param)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// get the parameter's storage type and convert parameter to string
|
||||
StorageType storageType = param.StorageType;
|
||||
switch (storageType)
|
||||
{
|
||||
case StorageType.Integer:
|
||||
int iVal = param.AsInteger();
|
||||
propertyValue = iVal.ToString();
|
||||
break;
|
||||
case StorageType.String:
|
||||
propertyValue = param.AsString();
|
||||
break;
|
||||
case StorageType.Double:
|
||||
// AsValueString will make the return string with unit, it's appreciated.
|
||||
if (useValue)
|
||||
{
|
||||
propertyValue = param.AsValueString();
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyValue = param.AsDouble().ToString();
|
||||
}
|
||||
break;
|
||||
case StorageType.ElementId:
|
||||
Autodesk.Revit.DB.ElementId elemId = param.AsElementId();
|
||||
Element elem = activeDoc.GetElement(elemId);
|
||||
propertyValue = elem.Name;
|
||||
break;
|
||||
default:
|
||||
propertyValue = param.AsString();
|
||||
break;
|
||||
}
|
||||
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see whether specified parameter exists in room object.
|
||||
/// </summary>
|
||||
/// <param name="roomObj">Room object used to get parameter</param>
|
||||
/// <param name="paramName">parameter name to be checked</param>
|
||||
/// <param name="sharedParam">shared parameter returned</param>
|
||||
/// <returns>true, the parameter exists; false, the parameter doesn't exist</returns>
|
||||
public static bool ShareParameterExists(Room roomObj, String paramName, ref Parameter sharedParam)
|
||||
{
|
||||
// get the parameter
|
||||
try
|
||||
{
|
||||
sharedParam = roomObj.LookupParameter(paramName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return (null != sharedParam);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Implementation
|
||||
/// <summary>
|
||||
/// Get all rooms in current Revit project
|
||||
/// </summary>
|
||||
private void GetAllRooms(Document activeDoc)
|
||||
{
|
||||
// get all room elements
|
||||
// try to find all rooms in the project and add to the list
|
||||
RoomFilter filter = new RoomFilter();
|
||||
FilteredElementCollector collector = new FilteredElementCollector(activeDoc);
|
||||
m_rooms = collector.WherePasses(filter).ToElements().Cast<Room>().ToList<Room>();
|
||||
// sort rooms by number
|
||||
m_rooms.Sort(CompRoomByNumber);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sort the rooms by number
|
||||
/// </summary>
|
||||
/// <param name="room1"></param>
|
||||
/// <param name="room2"></param>
|
||||
/// <returns></returns>
|
||||
private static int CompRoomByNumber(Room room1, Room room2)
|
||||
{
|
||||
if (null == room1 || null == room2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return room1.Number.CompareTo(room2.Number);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the parameters displayed in DataGridView control
|
||||
/// </summary>
|
||||
private void InitializeParameters()
|
||||
{
|
||||
// Room name
|
||||
m_parameters.Add(BuiltInParameter.ROOM_NAME);
|
||||
m_columnNames.Add("Name");
|
||||
|
||||
// Room Number
|
||||
m_parameters.Add(BuiltInParameter.ROOM_NUMBER);
|
||||
m_columnNames.Add("Number");
|
||||
|
||||
// Room Area
|
||||
m_parameters.Add(BuiltInParameter.ROOM_AREA);
|
||||
m_columnNames.Add("Area");
|
||||
|
||||
// Room Comments
|
||||
m_parameters.Add(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS);
|
||||
m_columnNames.Add("Comments");
|
||||
|
||||
// Level
|
||||
m_parameters.Add(BuiltInParameter.LEVEL_NAME);
|
||||
m_columnNames.Add("Level");
|
||||
|
||||
// Phase
|
||||
m_parameters.Add(BuiltInParameter.ROOM_PHASE);
|
||||
m_columnNames.Add("Phase");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both that copyright notice and the limited warranty and
|
||||
// restricted rights notice below appear in all supporting
|
||||
// documentation.
|
||||
//
|
||||
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
|
||||
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
|
||||
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
|
||||
// UNINTERRUPTED OR ERROR FREE.
|
||||
//
|
||||
// Use, duplication, or disclosure by the U.S. Government is subject to
|
||||
// restrictions set forth in FAR 52.227-19 (Commercial Computer
|
||||
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
|
||||
// (Rights in Technical Data and Computer Software), as applicable.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.IO;
|
||||
|
||||
namespace Revit.SDK.Samples.RoomSchedule
|
||||
{
|
||||
/// <summary>
|
||||
/// An integrated class to connect .xls data source, retrieve / update data
|
||||
/// </summary>
|
||||
class XlsDBConnector : IDisposable
|
||||
{
|
||||
#region Class Memeber Variables
|
||||
// The connection created
|
||||
private System.Data.OleDb.OleDbConnection m_objConn;
|
||||
|
||||
// One command for this connection
|
||||
private OleDbCommand m_command;
|
||||
|
||||
// The connection string
|
||||
private String m_connectStr;
|
||||
|
||||
// All available tables(work sheets) in xls data source
|
||||
private List<String> m_tables = new List<String>();
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Constructor & Destructor
|
||||
/// <summary>
|
||||
/// Class constructor, to retrieve data from .xls data source
|
||||
/// </summary>
|
||||
/// <param name="strXlsFile">The .xls file to be connected.
|
||||
/// This file should exist and it can be writable.</param>
|
||||
public XlsDBConnector(String strXlsFile)
|
||||
{
|
||||
// Validate the specified
|
||||
if (!ValidateFile(strXlsFile)) {
|
||||
throw new ArgumentException("The specified file doesn't exists or has readonly attribute.", strXlsFile);
|
||||
}
|
||||
|
||||
// establish a connection to the data source.
|
||||
m_connectStr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = \"" + strXlsFile +
|
||||
"\"; Extended Properties = \"Excel 8.0;HDR=YES;\"";
|
||||
|
||||
// create the .xls connection
|
||||
m_objConn = new System.Data.OleDb.OleDbConnection(m_connectStr);
|
||||
m_objConn.Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close the OleDb connection
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (null != m_objConn)
|
||||
{
|
||||
// close the OleDbConnection
|
||||
m_objConn.Close();
|
||||
m_objConn = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizer, we need to ensure the connection was closed
|
||||
/// This destructor will run only if the Dispose method does not get called.
|
||||
/// </summary>
|
||||
~XlsDBConnector()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Member Methods
|
||||
/// <summary>
|
||||
/// Get all available table names from .xls data source
|
||||
/// </summary>
|
||||
public List<String> RetrieveAllTables()
|
||||
{
|
||||
// clear the old tables list firstly
|
||||
m_tables.Clear();
|
||||
|
||||
// get all table names from data source
|
||||
DataTable schemaTable = m_objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
|
||||
new object[] { null, null, null, "TABLE" });
|
||||
for (int i = 0; i < schemaTable.Rows.Count; i++)
|
||||
{
|
||||
m_tables.Add(schemaTable.Rows[i].ItemArray[2].ToString().TrimEnd('$'));
|
||||
}
|
||||
|
||||
|
||||
return m_tables;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generate a DataTable data from xls data source, by a specified table name
|
||||
/// </summary>
|
||||
/// <param name="tableName">Table name to be retrieved </param>
|
||||
/// <returns>The generated DataTable from work sheet</returns>
|
||||
public DataTable GenDataTable(String tableName)
|
||||
{
|
||||
// Get all data via command and then fill data to table
|
||||
string strCom = "Select * From [" + tableName + "$]";
|
||||
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, m_objConn);
|
||||
DataSet myDataSet = new DataSet();
|
||||
myCommand.Fill(myDataSet, "[" + tableName + "$]");
|
||||
|
||||
try
|
||||
{
|
||||
// check to see whether the constant columns(defined in RoomsData class) exist in spread sheet.
|
||||
// These columns are necessary when updating spread sheet
|
||||
|
||||
// define a flag variable to remember whether column is found
|
||||
// duplicate column is not allowed in spreadsheet
|
||||
bool[] bHasColumn = new bool[5];
|
||||
Array.Clear(bHasColumn, 0, 5); // clear the variable to false
|
||||
|
||||
// five constant columns which must exist and to be checked
|
||||
String[] constantNames = { RoomsData.RoomID, RoomsData.RoomName,
|
||||
RoomsData.RoomNumber, RoomsData.RoomArea, RoomsData.RoomComments };
|
||||
|
||||
// remember all duplicate columns, used to pop up error message
|
||||
String duplicateColumns = String.Empty;
|
||||
for (int i = 0; i < myDataSet.Tables[0].Columns.Count; i++)
|
||||
{
|
||||
// get each column and check it
|
||||
String columnName = myDataSet.Tables[0].Columns[i].ColumnName;
|
||||
|
||||
// check whether there are expected columns one by one
|
||||
for (int col = 0; col < bHasColumn.Length; col++)
|
||||
{
|
||||
bool bDupliate = CheckSameColName(columnName, constantNames[col]);
|
||||
if (bDupliate)
|
||||
{
|
||||
if (false == bHasColumn[col])
|
||||
{
|
||||
bHasColumn[col] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this column is duplicate, reserve it
|
||||
duplicateColumns += String.Format("[{0}], ", constantNames[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check to see whether there are duplicate columns
|
||||
if (duplicateColumns.Length > 0)
|
||||
{
|
||||
// duplicate columns are not allowed
|
||||
String message = String.Format("There are duplicate column(s) in the spread sheet: {0}.", duplicateColumns);
|
||||
throw new Exception(message);
|
||||
}
|
||||
|
||||
|
||||
// check whether all required columns are there.
|
||||
String missingColumns = String.Empty; // reserve all column names which are missing.
|
||||
for (int col = 0; col < bHasColumn.Length; col++)
|
||||
{
|
||||
if (bHasColumn[col] == false)
|
||||
{
|
||||
missingColumns += String.Format("[{0}], ", constantNames[col]);
|
||||
}
|
||||
}
|
||||
|
||||
// check to see whether any required columns are missing.
|
||||
if (missingColumns.Length != 0)
|
||||
{
|
||||
// some columns are missing, pop up these column names
|
||||
String message = String.Format("Required columns are missing: {0}.", missingColumns);
|
||||
throw new Exception(message);
|
||||
}
|
||||
|
||||
// if no exception occurs, return the table of dataset directly
|
||||
return myDataSet.Tables[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// throw exception
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Execute SQL command, such as: update and insert
|
||||
/// </summary>
|
||||
/// <param name="strCmd">command to be executed</param>
|
||||
/// <returns>the number of rows affected by this command</returns>
|
||||
public int ExecuteCommnand(String strCmd)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (null == m_command)
|
||||
{
|
||||
m_command = m_objConn.CreateCommand();
|
||||
}
|
||||
m_command.CommandText = strCmd;
|
||||
return m_command.ExecuteNonQuery();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.ToString() + strCmd);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Class Implementation
|
||||
/// <summary>
|
||||
/// This method will validate and update attributes the specified file.
|
||||
/// The file should exist and it should have writable attribute.
|
||||
/// If it's readonly, this method will try to set the attribute to writable.
|
||||
/// </summary>
|
||||
/// <param name="strFile"></param>
|
||||
/// <returns></returns>
|
||||
private bool ValidateFile(String strFile)
|
||||
{
|
||||
// exists check
|
||||
if(!File.Exists(strFile)) {
|
||||
return false;
|
||||
}
|
||||
//
|
||||
// writable attribute set
|
||||
File.SetAttributes(strFile, FileAttributes.Normal);
|
||||
return (FileAttributes.Normal == File.GetAttributes(strFile));
|
||||
}
|
||||
/// <summary>
|
||||
/// Check if two columns names are the same
|
||||
/// </summary>
|
||||
/// <param name="baseName">first name</param>
|
||||
/// <param name="compName">second name</param>
|
||||
/// <returns>true, the two names are same; false, they are different.</returns>
|
||||
private static bool CheckSameColName(String baseName, String compName)
|
||||
{
|
||||
if (String.Compare(baseName, compName) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
};
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user