├── .gitignore ├── FittingAndAccessoryCalculationServers ├── Duct │ └── DuctFittingAndAccessoryPressureDropServer.cs ├── FittingAndAccessoryCalculationServers.csproj ├── FittingAndAccessoryCalculationServersApp.cs ├── MSSCCPRJ.SCC ├── Pipe │ └── PipeFittingAndAccessoryPressureDropServer.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── FittingAndAccessoryCalculationUIServers ├── Duct │ └── DuctFittingAndAccessoryPressureDropUIServer.cs ├── FittingAndAccessoryCalculationUIServers.csproj ├── FittingAndAccessoryCalculationUIServersApp.cs ├── FittingAndAccessoryCalculationUIServersHelper.cs ├── MSSCCPRJ.SCC ├── Pipe │ └── PipeFittingAndAccessoryPressureDropUIServer.cs └── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── LICENSE ├── PressureLossReport ├── Dialogs │ ├── PartialReportSettingsDlg.cs │ ├── PartialReportSettingsDlg.designer.cs │ ├── PartialReportSettingsDlg.resx │ ├── ReportFormatNameDlg.cs │ ├── ReportFormatNameDlg.designer.cs │ ├── ReportFormatNameDlg.resx │ ├── ReportSettings.cs │ ├── ReportSystemSelectorDlg.Designer.cs │ ├── ReportSystemSelectorDlg.cs │ ├── ReportSystemSelectorDlg.resx │ ├── ReportSystemTypeFilterDlg.Designer.cs │ ├── ReportSystemTypeFilterDlg.cs │ ├── ReportSystemTypeFilterDlg.resx │ ├── WholeReportSettingsDlg.cs │ ├── WholeReportSettingsDlg.designer.cs │ └── WholeReportSettingsDlg.resx ├── GenerateReport │ ├── CsvStreamWriter.cs │ ├── DataGenerator.cs │ ├── FittingsInfo.cs │ ├── HtmlStreamWriter.cs │ ├── MEPSystemInfo.cs │ ├── ReportInfo.cs │ ├── ReportProjectInfo.cs │ ├── SaveData.cs │ ├── SectionsInfo.cs │ └── SegmentsInfo.cs ├── PressureLossReport.csproj ├── PressureLossReportEntry.cs ├── PressureLossReportHelper.cs ├── Properties │ └── AssemblyInfo.cs ├── ReportResource.Designer.cs ├── ReportResource.resx └── ReportSettings │ ├── PressureLossReportData.cs │ ├── PressureLossReportDataManager.cs │ └── ReportFormatUpgrades.cs ├── README.md ├── StraightSegmentCalculationServers ├── Duct │ ├── DuctPressureDropServer.cs │ └── DuctPressureDropServerDescription.rtf ├── Pipe │ ├── PipePressureDropServer.cs │ ├── PipePressureDropServerDescription.rtf │ ├── PlumbingFixtureFlowServer.cs │ └── PlumbingFixtureFlowServerDescription.rtf ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── StraightSegmentCalculationServers.csproj └── StraightSegmentCalculationServersApp.cs ├── UserMepCalculation.addin ├── UserMepCalculation.sln └── VSProps ├── RevitAdditions.CSharp.Addin.targets ├── RevitAdditions.CSharp.targets └── RevitAdditions.PathDefinition.props /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | DebugWin32/ 5 | Debugx64/ 6 | Intermediate/ 7 | output/ 8 | 9 | # mstest test results 10 | TestResults 11 | 12 | ## Ignore Visual Studio temporary files, build results, and 13 | ## files generated by popular Visual Studio add-ons. 14 | 15 | # User-specific files 16 | *.suo 17 | *.user 18 | *.sln.docstates 19 | 20 | # Build results 21 | [Dd]ebug/ 22 | [Rr]elease/ 23 | x64/ 24 | *_i.c 25 | *_p.c 26 | *.ilk 27 | *.meta 28 | *.obj 29 | *.pch 30 | *.pdb 31 | *.pgc 32 | *.pgd 33 | *.rsp 34 | *.sbr 35 | *.tlb 36 | *.tli 37 | *.tlh 38 | *.tmp 39 | *.log 40 | *.vspscc 41 | *.vssscc 42 | .builds 43 | 44 | # Visual C++ cache files 45 | ipch/ 46 | *.aps 47 | *.ncb 48 | *.opensdf 49 | *.sdf 50 | 51 | # Visual Studio profiler 52 | *.psess 53 | *.vsp 54 | *.vspx 55 | 56 | # Guidance Automation Toolkit 57 | *.gpState 58 | 59 | # ReSharper is a .NET coding add-in 60 | _ReSharper* 61 | 62 | # NCrunch 63 | *.ncrunch* 64 | .*crunch*.local.xml 65 | 66 | # Installshield output folder 67 | [Ee]xpress 68 | 69 | # DocProject is a documentation generator add-in 70 | DocProject/buildhelp/ 71 | DocProject/Help/*.HxT 72 | DocProject/Help/*.HxC 73 | DocProject/Help/*.hhc 74 | DocProject/Help/*.hhk 75 | DocProject/Help/*.hhp 76 | DocProject/Help/Html2 77 | DocProject/Help/html 78 | 79 | # Click-Once directory 80 | publish 81 | 82 | # Publish Web Output 83 | *.Publish.xml 84 | 85 | # NuGet Packages Directory 86 | packages 87 | 88 | # Windows Azure Build Output 89 | csx 90 | *.build.csdef 91 | 92 | # Windows Store app package directory 93 | AppPackages/ 94 | 95 | # Others 96 | [Bb]in 97 | [Oo]bj 98 | sql 99 | TestResults 100 | [Tt]est[Rr]esult* 101 | *.Cache 102 | ClientBin 103 | [Ss]tyle[Cc]op.* 104 | ~$* 105 | *.dbmdl 106 | Generated_Code #added for RIA/Silverlight projects 107 | 108 | # Backup & report files from converting an old project file to a newer 109 | # Visual Studio version. Backup files are not needed, because we have git ;-) 110 | _UpgradeReport_Files/ 111 | Backup*/ 112 | UpgradeLog*.XML 113 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/Duct/DuctFittingAndAccessoryPressureDropServer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using Autodesk.Revit.DB.Mechanical; 28 | using Autodesk.Revit.DB.ExternalService; 29 | using Autodesk.Revit.DB.ExtensibleStorage; 30 | using Autodesk.Revit.DB; 31 | 32 | namespace UserFittingAndAccessoryCalculationServers.Duct 33 | { 34 | public static class SchemaBuildingUtility 35 | { 36 | internal static readonly Guid SpecificCoefficientSchemaGuid = new Guid("13DED697-D107-4B0D-8DC4-2A2E4C870096"); 37 | internal static readonly Guid SpecificLossSchemaGuid = new Guid("5C8B4686-656E-4AB5-8382-EC43C3026B4E"); 38 | internal static readonly Guid CoefficientFromTableSchemaGuid = new Guid("762A2314-1D1C-4087-A58F-BAB902F57BE5"); 39 | 40 | public static readonly string fieldCoefficient = "Coefficient"; 41 | public static readonly string fieldPressureLoss = "PressureLoss"; 42 | public static readonly string fieldUserTableName = "UserTableName"; 43 | 44 | } 45 | 46 | 47 | public class UserTableDuctPressureDropServer : IDuctFittingAndAccessoryPressureDropServer 48 | { 49 | /// 50 | /// Calculates the pressure Drop with the input data . 51 | /// 52 | /// 53 | /// The input for the pressure drop calculation. The result pressure drop is also return through the data to the caller. 54 | /// 55 | public bool Calculate(DuctFittingAndAccessoryPressureDropData data) 56 | { 57 | if (data == null) 58 | return false; 59 | 60 | /* calculation to modify data here */ 61 | 62 | return true; 63 | 64 | } 65 | 66 | /// 67 | /// Returns the method's name this server implements. 68 | /// 69 | public string GetMethodName() 70 | { 71 | return Properties.Resources.DuctUserTablePressureDropServerName; 72 | } 73 | 74 | /// 75 | /// Returns the Id of the server. 76 | /// 77 | public System.Guid GetServerId() 78 | { 79 | return new Guid("8BAF7D75-8B9B-46D0-B8CE-3AD1C19E6B12"); 80 | } 81 | 82 | /// 83 | /// Returns the Id of the service that the server belongs to. 84 | /// 85 | public ExternalServiceId GetServiceId() 86 | { 87 | return ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropService; 88 | } 89 | 90 | /// 91 | /// Returns the name of the server. 92 | /// 93 | public System.String GetName() 94 | { 95 | return Properties.Resources.DuctUserTablePressureDropServerName; 96 | } 97 | 98 | /// 99 | /// Returns the Vendor Id of the server. 100 | /// 101 | public System.String GetVendorId() 102 | { 103 | return "USER"; 104 | } 105 | 106 | /// 107 | /// Returns the description of the server. 108 | /// 109 | public System.String GetDescription() 110 | { 111 | return Properties.Resources.DuctUserTablePressureDropServerDescription; 112 | } 113 | 114 | /// 115 | /// Checks if the server is applicable for the duct fitting and duct accessory. 116 | /// 117 | public bool IsApplicable(DuctFittingAndAccessoryPressureDropData data) 118 | { 119 | //For not define server : applicable for all fittings and accessories 120 | return true; 121 | } 122 | 123 | /// 124 | /// Server can have its own entity, and this function should return the entity schema. 125 | /// 126 | public Schema GetDataSchema() 127 | { 128 | return null; 129 | } 130 | 131 | /// Gets the URL address which provides details about this server. 132 | /// 133 | public System.String GetInformationLink() 134 | { 135 | return Properties.Resources.DuctUserTablePressureDropServerInformationLink; 136 | } 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/FittingAndAccessoryCalculationServers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | None 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 8.0.30703 12 | 2.0 13 | {4A4F7DD7-A614-47E0-A7B0-88BBDB17CFBE} 14 | Library 15 | Properties 16 | UserFittingAndAccessoryCalculationServers 17 | UserFittingAndAccessoryCalculationServers 18 | v4.0 19 | 512 20 | prompt 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ..\..\..\..\Releasex64\Addins\ 32 | 33 | 34 | 35 | False 36 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPI.dll 37 | False 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | True 54 | True 55 | Resources.resx 56 | 57 | 58 | 59 | 60 | ResXFileCodeGenerator 61 | Resources.Designer.cs 62 | 63 | 64 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | 80 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/FittingAndAccessoryCalculationServersApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | 24 | using System; 25 | using System.Collections.Generic; 26 | using System.Linq; 27 | using System.Text; 28 | 29 | using Autodesk.Revit; 30 | using Autodesk.Revit.DB; 31 | using Autodesk.Revit.DB.Mechanical; 32 | using Autodesk.Revit.DB.Plumbing; 33 | using Autodesk.Revit.DB.ExternalService; 34 | using Autodesk.Revit.ApplicationServices; 35 | using Autodesk.Revit.DB.ExtensibleStorage; 36 | 37 | namespace UserFittingAndAccessoryCalculationServers 38 | { 39 | /// 40 | /// The external application for registering fitting and accessory pressure drop servers with Revit. 41 | /// 42 | public class ServerApp : IExternalDBApplication 43 | { 44 | /// 45 | /// Add and register the server on Revit startup. 46 | /// 47 | public ExternalDBApplicationResult OnStartup(ControlledApplication application) 48 | { 49 | AddDuctFittingAndAccessoryPressureDropServers(); 50 | AddPipeFittingAndAccessoryPressureDropServers(); 51 | return ExternalDBApplicationResult.Succeeded; 52 | } 53 | 54 | private void AddDuctFittingAndAccessoryPressureDropServers() 55 | { 56 | MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropService) as MultiServerService; 57 | if (service == null) 58 | return; 59 | 60 | List activeServerIds = new List(); 61 | 62 | // User table server is the default server, and it's already set to active, so it should be set active again. 63 | Duct.UserTableDuctPressureDropServer UserTableServer = new Duct.UserTableDuctPressureDropServer(); 64 | if (UserTableServer != null) 65 | { 66 | service.AddServer(UserTableServer); 67 | activeServerIds.Add(UserTableServer.GetServerId()); 68 | } 69 | 70 | 71 | 72 | IList currentActiveServerIds = service.GetActiveServerIds(); 73 | // currentActiveServerIds.Remove(service.GetDefaultServerId()); 74 | activeServerIds.AddRange(currentActiveServerIds); 75 | service.SetActiveServers(activeServerIds); 76 | } 77 | 78 | private void AddPipeFittingAndAccessoryPressureDropServers() 79 | { 80 | MultiServerService service = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService) as MultiServerService; 81 | if (service == null) 82 | return; 83 | 84 | List activeServerIds = new List(); 85 | 86 | 87 | 88 | 89 | Pipe.UserKFactorTablePipePressureDropServer kFactorTablePipeServer = new Pipe.UserKFactorTablePipePressureDropServer(); 90 | if (kFactorTablePipeServer != null) 91 | { 92 | service.AddServer(kFactorTablePipeServer); 93 | } 94 | 95 | activeServerIds.AddRange(service.GetActiveServerIds()); 96 | service.SetActiveServers(activeServerIds); 97 | } 98 | 99 | public ExternalDBApplicationResult OnShutdown(ControlledApplication application) 100 | { 101 | return ExternalDBApplicationResult.Succeeded; 102 | } 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/MSSCCPRJ.SCC: -------------------------------------------------------------------------------- 1 | SCC = This is a source code control file 2 | 3 | [FittingAndAccessoryCalculationServers.csproj] 4 | SCC_Aux_Path = "P4SCC#manp4:1670##Steven_Mycynek##2014dev-2" 5 | SCC_Project_Name = Perforce Project 6 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/Pipe/PipeFittingAndAccessoryPressureDropServer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using Autodesk.Revit.DB.Plumbing; 28 | using Autodesk.Revit.DB.ExternalService; 29 | using Autodesk.Revit.DB.ExtensibleStorage; 30 | using Autodesk.Revit.DB; 31 | 32 | namespace UserFittingAndAccessoryCalculationServers.Pipe 33 | { 34 | public static class PipeSchemaBuildingUtility 35 | { 36 | internal static readonly Guid KFactorSchemaGuid = new Guid("EA3E8AF6-3235-437D-95EE-D7EBEEE610B2"); 37 | internal static readonly Guid SpecificLossSchemaGuid = new Guid("E520753E-B098-45F4-B2BE-8AC5C4BBB1F2"); 38 | internal static readonly Guid CoefficientFromTableSchemaGuid = new Guid("1B022A2B-5722-4787-928A-4F29CA9D8811"); 39 | 40 | public static readonly string fieldKFactor = "KFactor"; 41 | public static readonly string fieldPressureLoss = "PressureLoss"; 42 | public static readonly string fieldKFactorableName = "PipeFittingKFactorTableName"; 43 | 44 | 45 | } 46 | 47 | 48 | 49 | public class UserKFactorTablePipePressureDropServer : IPipeFittingAndAccessoryPressureDropServer 50 | { 51 | /// 52 | /// Calculates the pressure Drop with the input data . 53 | /// 54 | /// 55 | /// The input for the pressure drop calculation. The result pressure drop is also return through the data to the caller. 56 | /// 57 | public bool Calculate(PipeFittingAndAccessoryPressureDropData data) 58 | { 59 | if (data == null) 60 | return false; 61 | 62 | /* calculation to modify data here */ 63 | 64 | return true; 65 | } 66 | 67 | 68 | /// 69 | /// Returns the Id of the server. 70 | /// 71 | public System.Guid GetServerId() 72 | { 73 | return new Guid("51DD5E98-A9DD-464B-B286-4A37953610B1"); 74 | } 75 | 76 | /// 77 | /// Returns the Id of the service that the sever belongs to. 78 | /// 79 | public ExternalServiceId GetServiceId() 80 | { 81 | return ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropService; 82 | } 83 | 84 | /// 85 | /// Returns the name of the server. 86 | /// 87 | public System.String GetName() 88 | { 89 | return Properties.Resources.PipeKFactorTablePressureDropServerName; 90 | } 91 | 92 | /// 93 | /// Returns the Vendor Id of the server. 94 | /// 95 | public System.String GetVendorId() 96 | { 97 | return "USER"; 98 | } 99 | 100 | /// 101 | /// Returns the description of the server. 102 | /// 103 | public System.String GetDescription() 104 | { 105 | return Properties.Resources.PipeKFactorTablePressureDropServerDescription; 106 | } 107 | 108 | /// 109 | /// Checks if the server is applicable for the pipe fitting and pipe accessory. 110 | /// 111 | public bool IsApplicable(PipeFittingAndAccessoryPressureDropData data) 112 | { 113 | return true; 114 | } 115 | 116 | 117 | /// 118 | /// Server can have its own entity, and this function should return the entity schema. 119 | /// 120 | public Schema GetDataSchema() 121 | { 122 | 123 | return null; 124 | } 125 | 126 | /// Gets the URL address which provides details about this server. 127 | /// 128 | public System.String GetInformationLink() 129 | { 130 | return Properties.Resources.PipeKFactorTablePressureDropServerInformationLink; 131 | } 132 | } 133 | 134 | } 135 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System.Reflection; 24 | using System.Runtime.CompilerServices; 25 | using System.Runtime.InteropServices; 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("UserFittingAndAccessoryCalculationServers")] 31 | [assembly: AssemblyDescription("")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("Autodesk")] 34 | [assembly: AssemblyProduct("UserFittingAndAccessoryCalculationServers")] 35 | [assembly: AssemblyCopyright("© 2012 Autodesk, Inc. All Rights Reserved.")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // Setting ComVisible to false makes the types in this assembly not visible 40 | // to COM components. If you need to access a type in this assembly from 41 | // COM, set the ComVisible attribute to true on that type. 42 | [assembly: ComVisible(false)] 43 | 44 | // The following GUID is for the ID of the typelib if this project is exposed to COM 45 | [assembly: Guid("69BF46B9-47C2-41F6-99B3-24B444C69DCE")] 46 | 47 | // Version information for an assembly consists of the following four values: 48 | // 49 | // Major Version 50 | // Minor Version 51 | // Build Number 52 | // Revision 53 | // 54 | // You can specify all the values or you can default the Build and Revision Numbers 55 | // by using the '*' as shown below: 56 | // [assembly: AssemblyVersion("1.0.*")] 57 | [assembly: AssemblyVersion("2014.0.0.0")] 58 | [assembly: AssemblyFileVersion("2014.0.0.0")] 59 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.544 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UserFittingAndAccessoryCalculationServers.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UserFittingAndAccessoryCalculationServers.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Version 5.0.0 of the User duct fitting database has been implemented for duct fittings, when using the method, the duct fitting coefficient will be read from mapped User table.. 65 | /// 66 | internal static string DuctUserTablePressureDropServerDescription { 67 | get { 68 | return ResourceManager.GetString("DuctUserTablePressureDropServerDescription", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to http://wiki.autodesk.com/display/aeceng/MEP2-109. 74 | /// 75 | internal static string DuctUserTablePressureDropServerInformationLink { 76 | get { 77 | return ResourceManager.GetString("DuctUserTablePressureDropServerInformationLink", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to User Coefficient from User Table. 83 | /// 84 | internal static string DuctUserTablePressureDropServerName { 85 | get { 86 | return ResourceManager.GetString("DuctUserTablePressureDropServerName", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to CIBSE/User/Crane standards are used to pipe fitting loss definition based on the pipe fitting types.. 92 | /// 93 | internal static string PipeKFactorTablePressureDropServerDescription { 94 | get { 95 | return ResourceManager.GetString("PipeKFactorTablePressureDropServerDescription", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to http://wiki.autodesk.com/display/aeceng/MEP2-109. 101 | /// 102 | internal static string PipeKFactorTablePressureDropServerInformationLink { 103 | get { 104 | return ResourceManager.GetString("PipeKFactorTablePressureDropServerInformationLink", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to User K Coefficient from Table. 110 | /// 111 | internal static string PipeKFactorTablePressureDropServerName { 112 | get { 113 | return ResourceManager.GetString("PipeKFactorTablePressureDropServerName", resourceCulture); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationServers/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Version 5.0.0 of the User duct fitting database has been implemented for duct fittings, when using the method, the duct fitting coefficient will be read from mapped User table. 122 | 123 | 124 | http://wiki.autodesk.com/display/aeceng/MEP2-109 125 | 126 | 127 | User Coefficient from User Table 128 | 129 | 130 | CIBSE/User/Crane standards are used to pipe fitting loss definition based on the pipe fitting types. 131 | 132 | 133 | http://wiki.autodesk.com/display/aeceng/MEP2-109 134 | 135 | 136 | User K Coefficient from Table 137 | 138 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/Duct/DuctFittingAndAccessoryPressureDropUIServer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Windows.Forms; 28 | 29 | using Autodesk.Revit.UI; 30 | using Autodesk.Revit.UI.Mechanical; 31 | using Autodesk.Revit.DB; 32 | using Autodesk.Revit.DB.Mechanical; 33 | using Autodesk.Revit.DB.ExternalService; 34 | using Autodesk.Revit.DB.ExtensibleStorage; 35 | using UserFittingAndAccessoryCalculationServers.Duct; 36 | 37 | namespace UserFittingAndAccessoryCalculationUIServers.Duct 38 | { 39 | 40 | 41 | public class CoefficientFromTablePressureDropUIServer : IDuctFittingAndAccessoryPressureDropUIServer 42 | { 43 | /// 44 | /// Returns the id of the corresponding DB server for which this server provides an optional UI. 45 | /// 46 | public System.Guid GetDBServerId() 47 | { 48 | return new Guid("8BAF7D75-8B9B-46D0-B8CE-3AD1C19E6B12"); 49 | } 50 | 51 | /// 52 | /// Indicates that this UI server actually has some settings to be shown. 53 | /// It is required that DB servers have their corresponding UI servers, but it is not required that there is an actual UI to be shown. 54 | /// If the calculations server does not have any additional data and therefore does not need the optional UI, the UI will do nothing (in which case the return from this method will be False) 55 | /// 56 | /// 57 | /// True if there is settings UI for the DB server, False otherwise. 58 | /// 59 | public bool HasSettings() 60 | { 61 | return true; 62 | } 63 | 64 | /// 65 | /// Prompts the setting UI for the user. 66 | /// This method might be invoked only when the server has UI settings (HasSettings == True). 67 | /// 68 | /// 69 | /// The duct fitting and accessory pressure drop UI data. 70 | /// It is used as in/out param, the user can get the old values from it and also can set the new values from the setting UI back to it. 71 | /// 72 | /// 73 | /// True if the user does change something in the UI (i.e. the user changes something in the entity in the data that was given as the argument into this method.), False otherwise. 74 | /// 75 | public bool ShowSettings(DuctFittingAndAccessoryPressureDropUIData data) 76 | { 77 | bool settingChanged = false; 78 | 79 | /* your configuration UI here */ 80 | 81 | return settingChanged; 82 | } 83 | 84 | /// 85 | /// Returns the Id of the server. 86 | /// 87 | public System.Guid GetServerId() 88 | { 89 | return new Guid("25FA8DE2-67C4-47D1-91F6-BD6F0803A588"); 90 | } 91 | 92 | /// 93 | /// Returns the Id of the service that the sever belongs to. 94 | /// 95 | public ExternalServiceId GetServiceId() 96 | { 97 | return ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropUIService; 98 | } 99 | 100 | /// 101 | /// Returns the server's name. 102 | /// 103 | public System.String GetName() 104 | { 105 | return Properties.Resources.DuctCoefficientFromTablePressureDropUIServerName; 106 | } 107 | 108 | /// 109 | /// Returns the server's vendor Id. 110 | /// 111 | public System.String GetVendorId() 112 | { 113 | return "USER"; 114 | } 115 | 116 | /// 117 | /// Returns the description of the server. 118 | /// 119 | public System.String GetDescription() 120 | { 121 | return Properties.Resources.DuctCoefficientFromTablePressureDropUIServerDescription; 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/FittingAndAccessoryCalculationUIServers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | None 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 8.0.30703 12 | 2.0 13 | {88CB9B60-5ADB-4E72-B8E4-E5DA9FC17FA8} 14 | Library 15 | Properties 16 | UserFittingAndAccessoryCalculationUIServers 17 | UserFittingAndAccessoryCalculationUIServers 18 | v4.0 19 | 512 20 | prompt 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ..\..\..\..\Releasex64\Addins\ 32 | 33 | 34 | 35 | False 36 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPI.dll 37 | False 38 | 39 | 40 | False 41 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPIUI.dll 42 | False 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | True 62 | True 63 | Resources.resx 64 | 65 | 66 | 67 | 68 | ResXFileCodeGenerator 69 | Resources.Designer.cs 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | {4A4F7DD7-A614-47E0-A7B0-88BBDB17CFBE} 78 | FittingAndAccessoryCalculationServers 79 | 80 | 81 | 84 | 85 | 86 | 87 | 88 | 95 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/FittingAndAccessoryCalculationUIServersApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.IO; 28 | 29 | using Autodesk.Revit.UI; 30 | using Autodesk.Revit.UI.Mechanical; 31 | using Autodesk.Revit.UI.Plumbing; 32 | using Autodesk.Revit.DB.ExternalService; 33 | 34 | namespace UserFittingAndAccessoryCalculationUIServers 35 | { 36 | /// 37 | /// The external application for registering fitting and accessory pressure drop UI servers with Revit. 38 | /// 39 | public class ServerApp : IExternalApplication 40 | { 41 | /// 42 | /// Add and register the server on Revit startup. 43 | /// 44 | public Result OnStartup(UIControlledApplication application) 45 | { 46 | MultiServerService ductService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctFittingAndAccessoryPressureDropUIService) as MultiServerService; 47 | if (ductService == null) 48 | return Result.Succeeded; 49 | 50 | 51 | 52 | Duct.CoefficientFromTablePressureDropUIServer UserTableUIServer = new Duct.CoefficientFromTablePressureDropUIServer(); 53 | ductService.AddServer(UserTableUIServer); 54 | 55 | //pipe UI servers 56 | MultiServerService pipeService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropUIService) as MultiServerService; 57 | if (pipeService == null) 58 | return Result.Succeeded; 59 | 60 | 61 | Pipe.KFactorTablePipePressureDropUIServer pipeKFactorUIServer = new Pipe.KFactorTablePipePressureDropUIServer(); 62 | pipeService.AddServer(pipeKFactorUIServer); 63 | 64 | return Result.Succeeded; 65 | } 66 | 67 | public Result OnShutdown(UIControlledApplication application) 68 | { 69 | return Result.Succeeded; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/MSSCCPRJ.SCC: -------------------------------------------------------------------------------- 1 | SCC = This is a source code control file 2 | 3 | [FittingAndAccessoryCalculationUIServers.csproj] 4 | SCC_Aux_Path = "P4SCC#manp4:1670##Steven_Mycynek##2014dev-2" 5 | SCC_Project_Name = Perforce Project 6 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/Pipe/PipeFittingAndAccessoryPressureDropUIServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | using Autodesk.Revit.UI; 8 | using Autodesk.Revit.UI.Plumbing; 9 | using Autodesk.Revit.DB; 10 | using Autodesk.Revit.DB.ExternalService; 11 | using Autodesk.Revit.DB.ExtensibleStorage; 12 | using UserFittingAndAccessoryCalculationServers.Pipe; 13 | using UserFittingAndAccessoryCalculationUIServers.Duct; 14 | using Autodesk.Revit.DB.Plumbing; 15 | 16 | namespace UserFittingAndAccessoryCalculationUIServers.Pipe 17 | { 18 | 19 | public class KFactorTablePipePressureDropUIServer : IPipeFittingAndAccessoryPressureDropUIServer 20 | { 21 | 22 | /// 23 | /// Returns the id of the corresponding DB server for which this server provides an optional UI. 24 | /// 25 | public System.Guid GetDBServerId() 26 | { 27 | return new Guid("51DD5E98-A9DD-464B-B286-4A37953610B1"); 28 | } 29 | 30 | /// 31 | /// Indicates that this UI server actually has some settings to be shown. 32 | /// It is required that DB servers have their corresponding UI servers, but it is not required that there is an actual UI to be shown. 33 | /// If the calculations server does not have any additional data and therefore does not need the optional UI, the UI will do nothing (in which case the return from this method will be False) 34 | /// 35 | /// 36 | /// True if there is settings UI for the DB server, False otherwise. 37 | /// 38 | public bool HasSettings() 39 | { 40 | return true; 41 | } 42 | 43 | /// 44 | /// Prompts the setting UI for the user. 45 | /// This method might be invoked only when the server has UI settings (HasSettings == True). 46 | /// 47 | /// 48 | /// The pipe fitting and accessory pressure drop UI data. 49 | /// It is used as in/out param, the user can get the old values from it and also can set the new values from the setting UI back to it. 50 | /// 51 | /// 52 | /// True if the user does change something in the UI (i.e. the user changes something in the entity in the data that was given as the argument into this method.), False otherwise. 53 | /// 54 | public bool ShowSettings(PipeFittingAndAccessoryPressureDropUIData data) 55 | { 56 | bool settingChanged = false; 57 | 58 | 59 | /* your configuration UI here */ 60 | 61 | return settingChanged; 62 | } 63 | 64 | /// 65 | /// Returns the Id of the server. 66 | /// 67 | public System.Guid GetServerId() 68 | { 69 | return new Guid("CDA19B6F-FBD5-4725-A0CE-F159BF5D0266"); 70 | } 71 | 72 | /// 73 | /// Returns the Id of the service that the sever belongs to. 74 | /// 75 | public ExternalServiceId GetServiceId() 76 | { 77 | return ExternalServices.BuiltInExternalServices.PipeFittingAndAccessoryPressureDropUIService; 78 | } 79 | 80 | /// 81 | /// Returns the server's name. 82 | /// 83 | public System.String GetName() 84 | { 85 | return Properties.Resources.PipeKFactorFromTablePressureDropUIServerName; 86 | } 87 | 88 | /// 89 | /// Returns the server's vendor Id. 90 | /// 91 | public System.String GetVendorId() 92 | { 93 | return "USER"; 94 | } 95 | 96 | /// 97 | /// Returns the description of the server. 98 | /// 99 | public System.String GetDescription() 100 | { 101 | return Properties.Resources.PipeKFactorFromTablePressureDropUIServerDescription; 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System.Reflection; 24 | using System.Runtime.CompilerServices; 25 | using System.Runtime.InteropServices; 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("FittingAndAccessoryCalculationUIServers")] 31 | [assembly: AssemblyDescription("")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("Autodesk")] 34 | [assembly: AssemblyProduct("FittingAndAccessoryCalculationUIServers")] 35 | [assembly: AssemblyCopyright("© 2012 Autodesk, Inc. All Rights Reserved.")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // Setting ComVisible to false makes the types in this assembly not visible 40 | // to COM components. If you need to access a type in this assembly from 41 | // COM, set the ComVisible attribute to true on that type. 42 | [assembly: ComVisible(false)] 43 | 44 | // The following GUID is for the ID of the typelib if this project is exposed to COM 45 | [assembly: Guid("69BF46B9-47C2-41F6-99B3-24B444C69DCE")] 46 | 47 | // Version information for an assembly consists of the following four values: 48 | // 49 | // Major Version 50 | // Minor Version 51 | // Build Number 52 | // Revision 53 | // 54 | // You can specify all the values or you can default the Build and Revision Numbers 55 | // by using the '*' as shown below: 56 | // [assembly: AssemblyVersion("1.0.*")] 57 | [assembly: AssemblyVersion("2014.0.0.0")] 58 | [assembly: AssemblyFileVersion("2014.0.0.0")] 59 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.544 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UserFittingAndAccessoryCalculationUIServers.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UserFittingAndAccessoryCalculationUIServers.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Revit-User. 65 | /// 66 | internal static string AppName { 67 | get { 68 | return ResourceManager.GetString("AppName", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to User Duct coefficient from table pressure drop UI server. 74 | /// 75 | internal static string DuctCoefficientFromTablePressureDropUIServerDescription { 76 | get { 77 | return ResourceManager.GetString("DuctCoefficientFromTablePressureDropUIServerDescription", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to User Duct coefficient from table pressure drop UI server. 83 | /// 84 | internal static string DuctCoefficientFromTablePressureDropUIServerName { 85 | get { 86 | return ResourceManager.GetString("DuctCoefficientFromTablePressureDropUIServerName", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Invalid Input. 92 | /// 93 | internal static string InvalidInputMsg { 94 | get { 95 | return ResourceManager.GetString("InvalidInputMsg", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to K Coefficient:. 101 | /// 102 | internal static string KCoefficientLabel { 103 | get { 104 | return ResourceManager.GetString("KCoefficientLabel", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to K Coefficient Table:. 110 | /// 111 | internal static string KFactorTableLabel { 112 | get { 113 | return ResourceManager.GetString("KFactorTableLabel", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to User Loss Coefficient:. 119 | /// 120 | internal static string LossCoefficientLabel { 121 | get { 122 | return ResourceManager.GetString("LossCoefficientLabel", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to User Pipe K coefficient from table pressure drop UI server. 128 | /// 129 | internal static string PipeKFactorFromTablePressureDropUIServerDescription { 130 | get { 131 | return ResourceManager.GetString("PipeKFactorFromTablePressureDropUIServerDescription", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to User Pipe K coefficient from table pressure drop UI server. 137 | /// 138 | internal static string PipeKFactorFromTablePressureDropUIServerName { 139 | get { 140 | return ResourceManager.GetString("PipeKFactorFromTablePressureDropUIServerName", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to User Table:. 146 | /// 147 | internal static string UserTableLabel { 148 | get { 149 | return ResourceManager.GetString("UserTableLabel", resourceCulture); 150 | } 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /FittingAndAccessoryCalculationUIServers/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Revit-User 122 | 123 | 124 | Invalid Input 125 | 126 | 127 | User Duct coefficient from table pressure drop UI server 128 | 129 | 130 | User Duct coefficient from table pressure drop UI server 131 | 132 | 133 | User Pipe K coefficient from table pressure drop UI server 134 | 135 | 136 | User Pipe K coefficient from table pressure drop UI server 137 | 138 | 139 | User Table: 140 | 141 | 142 | K Coefficient Table: 143 | 144 | 145 | K Coefficient: 146 | 147 | 148 | User Loss Coefficient: 149 | 150 | -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/PartialReportSettingsDlg.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.ComponentModel; 26 | using System.Data; 27 | using System.Drawing; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Windows.Forms; 31 | using Autodesk.Revit.UI; 32 | 33 | namespace UserPressureLossReport 34 | { 35 | public enum PartialReportSettingsDlgType 36 | { 37 | Segment = 0, 38 | Fitting 39 | } 40 | 41 | public partial class PartialReportSettingsDlg : Form 42 | { 43 | private PartialReportSettingsDlgType eType = PartialReportSettingsDlgType.Segment; 44 | private PressureLossReportData reportData = null; 45 | 46 | public PartialReportSettingsDlg() 47 | { 48 | InitializeComponent(); 49 | this.buttonUp.Enabled = false; 50 | this.buttonDown.Enabled = false; 51 | } 52 | 53 | public void initializeData(PartialReportSettingsDlgType eInputType, PressureLossReportData inputReportData) 54 | { 55 | eType = eInputType; 56 | reportData = inputReportData; 57 | fillingFields(eType); 58 | } 59 | 60 | private void buttonOK_Click(object sender, EventArgs e) 61 | { 62 | if (reportData == null) 63 | return; 64 | 65 | List avaliableParams = null; 66 | if (eType == PartialReportSettingsDlgType.Segment) 67 | avaliableParams = reportData.StraightSegFields; 68 | else 69 | avaliableParams = reportData.FittingFields; 70 | UIHelperFunctions.getFieldsFromSelectedListBox(avaliableParams, listBoxReportFields); 71 | 72 | DialogResult = DialogResult.OK; 73 | } 74 | 75 | private void fillingFields(PartialReportSettingsDlgType eType) 76 | { 77 | if (reportData == null) 78 | return; 79 | 80 | List avaliableParams = new List(); 81 | if (eType == PartialReportSettingsDlgType.Segment) 82 | avaliableParams = reportData.StraightSegFields; 83 | else 84 | avaliableParams = reportData.FittingFields; 85 | UIHelperFunctions.fillingListBoxFields(avaliableParams, listBoxAvailableFields, listBoxReportFields); 86 | 87 | listBoxAvailableFields.Focus(); 88 | if (listBoxAvailableFields.Items.Count > 0) 89 | listBoxAvailableFields.SetSelected(0, true); 90 | } 91 | 92 | private void buttonAdd_Click(object sender, EventArgs e) 93 | { 94 | UIHelperFunctions.addRemoveFields(listBoxAvailableFields, listBoxReportFields); 95 | } 96 | 97 | private void buttonRemove_Click(object sender, EventArgs e) 98 | { 99 | UIHelperFunctions.addRemoveFields(listBoxReportFields, listBoxAvailableFields); 100 | } 101 | 102 | private void buttonUp_Click(object sender, EventArgs e) 103 | { 104 | UIHelperFunctions.moveSelectedField(listBoxReportFields, true); 105 | } 106 | 107 | private void buttonDown_Click(object sender, EventArgs e) 108 | { 109 | UIHelperFunctions.moveSelectedField(listBoxReportFields, false); 110 | } 111 | 112 | private void listBoxAvailableFields_DoubleClick(object sender, EventArgs e) 113 | { 114 | UIHelperFunctions.addRemoveFields(listBoxAvailableFields, listBoxReportFields); 115 | } 116 | 117 | private void listBoxReportFields_DoubleClick(object sender, EventArgs e) 118 | { 119 | UIHelperFunctions.addRemoveFields(listBoxReportFields, listBoxAvailableFields); 120 | } 121 | 122 | private void listBoxReportFields_SelectedIndexChanged(object sender, EventArgs e) 123 | { 124 | UIHelperFunctions.updateUpDownButtonEnable(listBoxReportFields, buttonUp, buttonDown); 125 | } 126 | 127 | private void PartialReportSettingsDlg_KeyUp(object sender, KeyEventArgs e) 128 | { 129 | if (e.KeyData == Keys.Escape) 130 | this.Close(); 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/PartialReportSettingsDlg.designer.cs: -------------------------------------------------------------------------------- 1 | namespace UserPressureLossReport 2 | { 3 | partial class PartialReportSettingsDlg 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PartialReportSettingsDlg)); 32 | this.buttonCancel = new System.Windows.Forms.Button(); 33 | this.buttonOK = new System.Windows.Forms.Button(); 34 | this.buttonDown = new System.Windows.Forms.Button(); 35 | this.buttonUp = new System.Windows.Forms.Button(); 36 | this.buttonRemove = new System.Windows.Forms.Button(); 37 | this.buttonAdd = new System.Windows.Forms.Button(); 38 | this.listBoxReportFields = new System.Windows.Forms.ListBox(); 39 | this.labelReportFields = new System.Windows.Forms.Label(); 40 | this.listBoxAvailableFields = new System.Windows.Forms.ListBox(); 41 | this.labelAvailableFields = new System.Windows.Forms.Label(); 42 | this.SuspendLayout(); 43 | // 44 | // buttonCancel 45 | // 46 | resources.ApplyResources(this.buttonCancel, "buttonCancel"); 47 | this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 48 | this.buttonCancel.Name = "buttonCancel"; 49 | this.buttonCancel.UseVisualStyleBackColor = true; 50 | // 51 | // buttonOK 52 | // 53 | resources.ApplyResources(this.buttonOK, "buttonOK"); 54 | this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; 55 | this.buttonOK.Name = "buttonOK"; 56 | this.buttonOK.UseVisualStyleBackColor = true; 57 | this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); 58 | // 59 | // buttonDown 60 | // 61 | resources.ApplyResources(this.buttonDown, "buttonDown"); 62 | this.buttonDown.Name = "buttonDown"; 63 | this.buttonDown.UseVisualStyleBackColor = true; 64 | this.buttonDown.Click += new System.EventHandler(this.buttonDown_Click); 65 | // 66 | // buttonUp 67 | // 68 | resources.ApplyResources(this.buttonUp, "buttonUp"); 69 | this.buttonUp.Name = "buttonUp"; 70 | this.buttonUp.UseVisualStyleBackColor = true; 71 | this.buttonUp.Click += new System.EventHandler(this.buttonUp_Click); 72 | // 73 | // buttonRemove 74 | // 75 | resources.ApplyResources(this.buttonRemove, "buttonRemove"); 76 | this.buttonRemove.Name = "buttonRemove"; 77 | this.buttonRemove.UseVisualStyleBackColor = true; 78 | this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); 79 | // 80 | // buttonAdd 81 | // 82 | resources.ApplyResources(this.buttonAdd, "buttonAdd"); 83 | this.buttonAdd.Name = "buttonAdd"; 84 | this.buttonAdd.UseVisualStyleBackColor = true; 85 | this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); 86 | // 87 | // listBoxReportFields 88 | // 89 | resources.ApplyResources(this.listBoxReportFields, "listBoxReportFields"); 90 | this.listBoxReportFields.FormattingEnabled = true; 91 | this.listBoxReportFields.Name = "listBoxReportFields"; 92 | this.listBoxReportFields.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; 93 | this.listBoxReportFields.SelectedIndexChanged += new System.EventHandler(this.listBoxReportFields_SelectedIndexChanged); 94 | this.listBoxReportFields.DoubleClick += new System.EventHandler(this.listBoxReportFields_DoubleClick); 95 | // 96 | // labelReportFields 97 | // 98 | resources.ApplyResources(this.labelReportFields, "labelReportFields"); 99 | this.labelReportFields.Name = "labelReportFields"; 100 | // 101 | // listBoxAvailableFields 102 | // 103 | resources.ApplyResources(this.listBoxAvailableFields, "listBoxAvailableFields"); 104 | this.listBoxAvailableFields.FormattingEnabled = true; 105 | this.listBoxAvailableFields.Name = "listBoxAvailableFields"; 106 | this.listBoxAvailableFields.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; 107 | this.listBoxAvailableFields.Sorted = true; 108 | this.listBoxAvailableFields.DoubleClick += new System.EventHandler(this.listBoxAvailableFields_DoubleClick); 109 | // 110 | // labelAvailableFields 111 | // 112 | resources.ApplyResources(this.labelAvailableFields, "labelAvailableFields"); 113 | this.labelAvailableFields.Name = "labelAvailableFields"; 114 | // 115 | // PartialReportSettingsDlg 116 | // 117 | resources.ApplyResources(this, "$this"); 118 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 119 | this.Controls.Add(this.buttonCancel); 120 | this.Controls.Add(this.buttonOK); 121 | this.Controls.Add(this.buttonDown); 122 | this.Controls.Add(this.buttonUp); 123 | this.Controls.Add(this.buttonRemove); 124 | this.Controls.Add(this.buttonAdd); 125 | this.Controls.Add(this.listBoxReportFields); 126 | this.Controls.Add(this.labelReportFields); 127 | this.Controls.Add(this.listBoxAvailableFields); 128 | this.Controls.Add(this.labelAvailableFields); 129 | this.HelpButton = true; 130 | this.KeyPreview = true; 131 | this.MaximizeBox = false; 132 | this.MinimizeBox = false; 133 | this.Name = "PartialReportSettingsDlg"; 134 | this.ShowIcon = false; 135 | this.ShowInTaskbar = false; 136 | this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PartialReportSettingsDlg_KeyUp); 137 | this.ResumeLayout(false); 138 | this.PerformLayout(); 139 | 140 | } 141 | 142 | #endregion 143 | 144 | private System.Windows.Forms.Button buttonCancel; 145 | private System.Windows.Forms.Button buttonOK; 146 | private System.Windows.Forms.Button buttonDown; 147 | private System.Windows.Forms.Button buttonUp; 148 | private System.Windows.Forms.Button buttonRemove; 149 | private System.Windows.Forms.Button buttonAdd; 150 | private System.Windows.Forms.ListBox listBoxReportFields; 151 | private System.Windows.Forms.Label labelReportFields; 152 | private System.Windows.Forms.ListBox listBoxAvailableFields; 153 | private System.Windows.Forms.Label labelAvailableFields; 154 | 155 | 156 | } 157 | } -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportFormatNameDlg.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.ComponentModel; 26 | using System.Data; 27 | using System.Drawing; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Windows.Forms; 31 | using Autodesk.Revit.UI; 32 | 33 | namespace UserPressureLossReport 34 | { 35 | public partial class ReportFormatNameDlg : Form 36 | { 37 | private string reportFormatName = ""; 38 | public ReportFormatNameDlg() 39 | { 40 | InitializeComponent(); 41 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 42 | if (helper == null) 43 | return; 44 | } 45 | 46 | private void Btn_Yes_Click(object sender, EventArgs e) 47 | { 48 | reportFormatName = textBox1.Text; 49 | //check if the name is valid 50 | if (reportFormatName.Length < 1) 51 | { 52 | UIHelperFunctions.postWarning(ReportResource.plrSettings, ReportResource.formatNameMsg); 53 | } 54 | else 55 | { 56 | //check if the name exists 57 | PressureLossReportDataManager reportDataMgr = PressureLossReportDataManager.Instance; 58 | PressureLossReportData reportData = reportDataMgr.getData(reportFormatName); 59 | if (reportData != null) //post task dialog 60 | { 61 | TaskDialog tdlg = new TaskDialog(ReportResource.plrSettings); 62 | tdlg.MainInstruction = ReportResource.formatNameDuplicateMsg; 63 | tdlg.AllowCancellation = true; 64 | tdlg.CommonButtons = TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.No; 65 | tdlg.DefaultButton = TaskDialogResult.No; 66 | tdlg.TitleAutoPrefix = false; // suppress the prefix of title. 67 | if (tdlg.Show() != TaskDialogResult.Yes) 68 | { 69 | textBox1.Focus(); 70 | return; 71 | } 72 | } 73 | 74 | DialogResult = DialogResult.OK; 75 | } 76 | } 77 | 78 | public string ReportFormatName 79 | { 80 | get { return reportFormatName; } 81 | set { reportFormatName = value; } 82 | } 83 | 84 | private void ReportFormatNameDlg_KeyUp(object sender, KeyEventArgs e) 85 | { 86 | if (e.KeyData == Keys.Escape) 87 | this.Close(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportFormatNameDlg.designer.cs: -------------------------------------------------------------------------------- 1 | namespace UserPressureLossReport 2 | { 3 | partial class ReportFormatNameDlg 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportFormatNameDlg)); 32 | this.Btn_Cancel = new System.Windows.Forms.Button(); 33 | this.Btn_Yes = new System.Windows.Forms.Button(); 34 | this.label1 = new System.Windows.Forms.Label(); 35 | this.textBox1 = new System.Windows.Forms.TextBox(); 36 | this.SuspendLayout(); 37 | // 38 | // Btn_Cancel 39 | // 40 | this.Btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 41 | resources.ApplyResources(this.Btn_Cancel, "Btn_Cancel"); 42 | this.Btn_Cancel.Name = "Btn_Cancel"; 43 | this.Btn_Cancel.UseVisualStyleBackColor = true; 44 | // 45 | // Btn_Yes 46 | // 47 | resources.ApplyResources(this.Btn_Yes, "Btn_Yes"); 48 | this.Btn_Yes.Name = "Btn_Yes"; 49 | this.Btn_Yes.UseVisualStyleBackColor = true; 50 | this.Btn_Yes.Click += new System.EventHandler(this.Btn_Yes_Click); 51 | // 52 | // label1 53 | // 54 | resources.ApplyResources(this.label1, "label1"); 55 | this.label1.Name = "label1"; 56 | // 57 | // textBox1 58 | // 59 | resources.ApplyResources(this.textBox1, "textBox1"); 60 | this.textBox1.Name = "textBox1"; 61 | // 62 | // ReportFormatNameDlg 63 | // 64 | this.AcceptButton = this.Btn_Yes; 65 | resources.ApplyResources(this, "$this"); 66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 67 | this.CancelButton = this.Btn_Cancel; 68 | this.Controls.Add(this.textBox1); 69 | this.Controls.Add(this.label1); 70 | this.Controls.Add(this.Btn_Cancel); 71 | this.Controls.Add(this.Btn_Yes); 72 | this.KeyPreview = true; 73 | this.MaximizeBox = false; 74 | this.MinimizeBox = false; 75 | this.Name = "ReportFormatNameDlg"; 76 | this.ShowIcon = false; 77 | this.ShowInTaskbar = false; 78 | this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.ReportFormatNameDlg_KeyUp); 79 | this.ResumeLayout(false); 80 | this.PerformLayout(); 81 | 82 | } 83 | 84 | #endregion 85 | 86 | private System.Windows.Forms.Button Btn_Cancel; 87 | private System.Windows.Forms.Button Btn_Yes; 88 | private System.Windows.Forms.Label label1; 89 | private System.Windows.Forms.TextBox textBox1; 90 | 91 | } 92 | } -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportSettings.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Windows.Forms; 28 | using Autodesk.Revit.UI; 29 | 30 | 31 | namespace UserPressureLossReport 32 | { 33 | public enum SaveType 34 | { 35 | HTML = 0, 36 | CSV 37 | } 38 | 39 | public class UIHelperFunctions 40 | { 41 | public static void addRemoveFields(ListBox listBoxToRemove, ListBox listBoxToAdd) 42 | { 43 | if (listBoxToRemove == null || listBoxToAdd == null) 44 | return; 45 | 46 | if (listBoxToRemove.SelectedItems.Count < 1) 47 | { 48 | return; 49 | } 50 | else 51 | { 52 | List selTexts = new List(); 53 | listBoxToAdd.ClearSelected(); 54 | foreach (object obj in listBoxToRemove.SelectedItems) 55 | { 56 | int nIndex = listBoxToAdd.Items.Add(obj); 57 | listBoxToAdd.SetSelected(nIndex, true); 58 | selTexts.Add(obj.ToString()); 59 | } 60 | 61 | foreach (string selText in selTexts) 62 | { 63 | listBoxToRemove.Items.Remove(selText); 64 | } 65 | 66 | listBoxToRemove.ClearSelected(); 67 | } 68 | } 69 | 70 | public static void fillingListBoxFields(List avaliableParams, ListBox listBoxUnSelected, ListBox listBoxSelected) 71 | { 72 | if (avaliableParams == null || listBoxSelected == null || listBoxUnSelected == null) 73 | return; 74 | 75 | SortedDictionary displayFields = new SortedDictionary(); 76 | 77 | foreach (PressureLossParameter param in avaliableParams) 78 | { 79 | if (param.Selected == true && param.Display == true) 80 | { 81 | displayFields.Add(param.DisplayOrder, param.Name); 82 | } 83 | else if (param.Display == true) 84 | listBoxUnSelected.Items.Add(param.Name); 85 | } 86 | 87 | foreach (KeyValuePair kvp in displayFields) 88 | { 89 | listBoxSelected.Items.Add(kvp.Value); 90 | } 91 | 92 | } 93 | 94 | public static void getFieldsFromSelectedListBox(List avaliableParams, ListBox listBoxSelected) 95 | { 96 | if (avaliableParams == null || listBoxSelected == null) 97 | return; 98 | 99 | foreach (PressureLossParameter param in avaliableParams) 100 | { 101 | if (listBoxSelected.Items.Contains(param.Name)) 102 | { 103 | param.Selected = true; 104 | param.DisplayOrder = listBoxSelected.Items.IndexOf(param.Name); 105 | } 106 | else if (param.Display == false && param.Selected == true) 107 | { 108 | continue; 109 | } 110 | else 111 | { 112 | param.Selected = false; 113 | param.DisplayOrder = -1; 114 | } 115 | } 116 | } 117 | 118 | public static void moveSelectedField(ListBox listBoxSelected, bool bUp) 119 | { 120 | if (listBoxSelected == null) 121 | return; 122 | 123 | int nFirstSelndex = -1; 124 | int nSelCount = 0; 125 | if (bUp) //move up 126 | { 127 | nFirstSelndex = listBoxSelected.SelectedIndices[0]; 128 | nSelCount = listBoxSelected.SelectedIndices.Count; 129 | string str = listBoxSelected.Items[nFirstSelndex - 1].ToString(); 130 | listBoxSelected.Items.RemoveAt(nFirstSelndex - 1); 131 | listBoxSelected.Items.Insert(nFirstSelndex + nSelCount - 1, str); 132 | 133 | nFirstSelndex = nFirstSelndex - 1; 134 | } 135 | else //move down 136 | { 137 | nFirstSelndex = listBoxSelected.SelectedIndices[0]; 138 | nSelCount = listBoxSelected.SelectedIndices.Count; 139 | int nLastSelIndex = nFirstSelndex + nSelCount - 1; 140 | 141 | string str = listBoxSelected.Items[nLastSelIndex + 1].ToString(); 142 | listBoxSelected.Items.RemoveAt(nLastSelIndex + 1); 143 | listBoxSelected.Items.Insert(nFirstSelndex, str); 144 | 145 | nFirstSelndex = nFirstSelndex + 1; 146 | } 147 | 148 | listBoxSelected.SelectedItems.Clear(); 149 | for (int ii = 0; ii < nSelCount; ++ii) 150 | { 151 | listBoxSelected.SetSelected(nFirstSelndex + ii, true); 152 | } 153 | } 154 | 155 | public static void updateUpDownButtonEnable(ListBox listBoxSelected, Button buttonUp, Button buttonDown) 156 | { 157 | if (listBoxSelected == null || buttonUp == null || buttonDown == null) 158 | return; 159 | 160 | int nSelCount = listBoxSelected.SelectedIndices.Count; 161 | 162 | buttonUp.Enabled = true; 163 | buttonDown.Enabled = true; 164 | 165 | //no select item or select the first one: make up button disabled 166 | if (nSelCount < 1 || listBoxSelected.SelectedIndices[0] == 0) 167 | buttonUp.Enabled = false; 168 | 169 | //no select item or select the last one, make down button disabled 170 | if (nSelCount < 1 || listBoxSelected.SelectedIndices[nSelCount - 1] == listBoxSelected.Items.Count - 1) 171 | buttonDown.Enabled = false; 172 | 173 | //selection is not continues: make both up and down buttons disabled 174 | if (nSelCount < 1) 175 | return; 176 | 177 | int nFirstIndex = listBoxSelected.SelectedIndices[0]; 178 | int ii = 0; 179 | foreach (int nIndex in listBoxSelected.SelectedIndices) 180 | { 181 | if (nIndex != (nFirstIndex + ii)) 182 | { 183 | buttonUp.Enabled = false; 184 | buttonDown.Enabled = false; 185 | break; 186 | } 187 | ii++; 188 | } 189 | } 190 | 191 | public static TaskDialogResult postWarning(string title, string instruction, string content = null) 192 | { 193 | if (title == null || instruction == null) 194 | return TaskDialogResult.None; 195 | 196 | TaskDialog tdlg = new TaskDialog(title); 197 | tdlg.MainInstruction = instruction; 198 | tdlg.MainContent = content; 199 | tdlg.AllowCancellation = true; 200 | tdlg.CommonButtons = TaskDialogCommonButtons.Close; 201 | tdlg.DefaultButton = TaskDialogResult.Close; 202 | tdlg.TitleAutoPrefix = false; 203 | return tdlg.Show(); 204 | } 205 | 206 | public static DialogResult ShowMsgWarning(string warning, string title) 207 | { 208 | return MessageBox.Show( 209 | warning, 210 | title, 211 | MessageBoxButtons.OK, 212 | MessageBoxIcon.Warning); 213 | } 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportSystemSelectorDlg.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace UserPressureLossReport 2 | { 3 | partial class ReportSystemSelectorDlg 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportSystemSelectorDlg)); 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.btnSystemTypeFilter = new System.Windows.Forms.Button(); 34 | this.SystemCheckList = new System.Windows.Forms.CheckedListBox(); 35 | this.btnSelectAll = new System.Windows.Forms.Button(); 36 | this.btnNone = new System.Windows.Forms.Button(); 37 | this.btnInvert = new System.Windows.Forms.Button(); 38 | this.btnOK = new System.Windows.Forms.Button(); 39 | this.btCancel = new System.Windows.Forms.Button(); 40 | this.label3 = new System.Windows.Forms.Label(); 41 | this.SuspendLayout(); 42 | // 43 | // label1 44 | // 45 | resources.ApplyResources(this.label1, "label1"); 46 | this.label1.Name = "label1"; 47 | // 48 | // btnSystemTypeFilter 49 | // 50 | resources.ApplyResources(this.btnSystemTypeFilter, "btnSystemTypeFilter"); 51 | this.btnSystemTypeFilter.Name = "btnSystemTypeFilter"; 52 | this.btnSystemTypeFilter.UseVisualStyleBackColor = true; 53 | this.btnSystemTypeFilter.Click += new System.EventHandler(this.btnSystemTypeFilter_Click); 54 | // 55 | // SystemCheckList 56 | // 57 | resources.ApplyResources(this.SystemCheckList, "SystemCheckList"); 58 | this.SystemCheckList.CheckOnClick = true; 59 | this.SystemCheckList.FormattingEnabled = true; 60 | this.SystemCheckList.Name = "SystemCheckList"; 61 | this.SystemCheckList.SelectedIndexChanged += new System.EventHandler(this.SystemCheckList_SelectedIndexChanged); 62 | // 63 | // btnSelectAll 64 | // 65 | resources.ApplyResources(this.btnSelectAll, "btnSelectAll"); 66 | this.btnSelectAll.Name = "btnSelectAll"; 67 | this.btnSelectAll.UseVisualStyleBackColor = true; 68 | this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click); 69 | // 70 | // btnNone 71 | // 72 | resources.ApplyResources(this.btnNone, "btnNone"); 73 | this.btnNone.Name = "btnNone"; 74 | this.btnNone.UseVisualStyleBackColor = true; 75 | this.btnNone.Click += new System.EventHandler(this.btnNone_Click); 76 | // 77 | // btnInvert 78 | // 79 | resources.ApplyResources(this.btnInvert, "btnInvert"); 80 | this.btnInvert.Name = "btnInvert"; 81 | this.btnInvert.UseVisualStyleBackColor = true; 82 | this.btnInvert.Click += new System.EventHandler(this.btnInvert_Click); 83 | // 84 | // btnOK 85 | // 86 | resources.ApplyResources(this.btnOK, "btnOK"); 87 | this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; 88 | this.btnOK.Name = "btnOK"; 89 | this.btnOK.UseVisualStyleBackColor = true; 90 | this.btnOK.Click += new System.EventHandler(this.btnOK_Click); 91 | // 92 | // btCancel 93 | // 94 | resources.ApplyResources(this.btCancel, "btCancel"); 95 | this.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 96 | this.btCancel.Name = "btCancel"; 97 | this.btCancel.UseVisualStyleBackColor = true; 98 | // 99 | // label3 100 | // 101 | resources.ApplyResources(this.label3, "label3"); 102 | this.label3.Name = "label3"; 103 | // 104 | // ReportSystemSelectorDlg 105 | // 106 | this.AcceptButton = this.btnOK; 107 | resources.ApplyResources(this, "$this"); 108 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 109 | this.CancelButton = this.btCancel; 110 | this.Controls.Add(this.btCancel); 111 | this.Controls.Add(this.btnOK); 112 | this.Controls.Add(this.btnInvert); 113 | this.Controls.Add(this.btnNone); 114 | this.Controls.Add(this.btnSelectAll); 115 | this.Controls.Add(this.SystemCheckList); 116 | this.Controls.Add(this.btnSystemTypeFilter); 117 | this.Controls.Add(this.label3); 118 | this.Controls.Add(this.label1); 119 | this.HelpButton = true; 120 | this.MaximizeBox = false; 121 | this.MinimizeBox = false; 122 | this.Name = "ReportSystemSelectorDlg"; 123 | this.ShowIcon = false; 124 | this.ShowInTaskbar = false; 125 | this.ResumeLayout(false); 126 | this.PerformLayout(); 127 | 128 | } 129 | 130 | #endregion 131 | 132 | private System.Windows.Forms.Label label1; 133 | private System.Windows.Forms.Button btnSystemTypeFilter; 134 | private System.Windows.Forms.CheckedListBox SystemCheckList; 135 | private System.Windows.Forms.Button btnSelectAll; 136 | private System.Windows.Forms.Button btnNone; 137 | private System.Windows.Forms.Button btnInvert; 138 | private System.Windows.Forms.Button btnOK; 139 | private System.Windows.Forms.Button btCancel; 140 | private System.Windows.Forms.Label label3; 141 | } 142 | } -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportSystemTypeFilterDlg.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace UserPressureLossReport 2 | { 3 | partial class ReportSystemTypeFilterDlg 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportSystemTypeFilterDlg)); 32 | this.btCancel = new System.Windows.Forms.Button(); 33 | this.btnOK = new System.Windows.Forms.Button(); 34 | this.btnInvert = new System.Windows.Forms.Button(); 35 | this.btnNone = new System.Windows.Forms.Button(); 36 | this.btnSelectAll = new System.Windows.Forms.Button(); 37 | this.SystemTypeCheckList = new System.Windows.Forms.CheckedListBox(); 38 | this.label1 = new System.Windows.Forms.Label(); 39 | this.SuspendLayout(); 40 | // 41 | // btCancel 42 | // 43 | resources.ApplyResources(this.btCancel, "btCancel"); 44 | this.btCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 45 | this.btCancel.Name = "btCancel"; 46 | this.btCancel.UseVisualStyleBackColor = true; 47 | // 48 | // btnOK 49 | // 50 | resources.ApplyResources(this.btnOK, "btnOK"); 51 | this.btnOK.Name = "btnOK"; 52 | this.btnOK.UseVisualStyleBackColor = true; 53 | this.btnOK.Click += new System.EventHandler(this.btnOK_Click); 54 | // 55 | // btnInvert 56 | // 57 | resources.ApplyResources(this.btnInvert, "btnInvert"); 58 | this.btnInvert.Name = "btnInvert"; 59 | this.btnInvert.UseVisualStyleBackColor = true; 60 | this.btnInvert.Click += new System.EventHandler(this.btnInvert_Click); 61 | // 62 | // btnNone 63 | // 64 | resources.ApplyResources(this.btnNone, "btnNone"); 65 | this.btnNone.Name = "btnNone"; 66 | this.btnNone.UseVisualStyleBackColor = true; 67 | this.btnNone.Click += new System.EventHandler(this.btnNone_Click); 68 | // 69 | // btnSelectAll 70 | // 71 | resources.ApplyResources(this.btnSelectAll, "btnSelectAll"); 72 | this.btnSelectAll.Name = "btnSelectAll"; 73 | this.btnSelectAll.UseVisualStyleBackColor = true; 74 | this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click); 75 | // 76 | // SystemTypeCheckList 77 | // 78 | resources.ApplyResources(this.SystemTypeCheckList, "SystemTypeCheckList"); 79 | this.SystemTypeCheckList.CheckOnClick = true; 80 | this.SystemTypeCheckList.FormattingEnabled = true; 81 | this.SystemTypeCheckList.Name = "SystemTypeCheckList"; 82 | // 83 | // label1 84 | // 85 | resources.ApplyResources(this.label1, "label1"); 86 | this.label1.Name = "label1"; 87 | // 88 | // ReportSystemTypeFilterDlg 89 | // 90 | this.AcceptButton = this.btnOK; 91 | resources.ApplyResources(this, "$this"); 92 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 93 | this.CancelButton = this.btCancel; 94 | this.Controls.Add(this.label1); 95 | this.Controls.Add(this.btCancel); 96 | this.Controls.Add(this.btnOK); 97 | this.Controls.Add(this.btnInvert); 98 | this.Controls.Add(this.btnNone); 99 | this.Controls.Add(this.btnSelectAll); 100 | this.Controls.Add(this.SystemTypeCheckList); 101 | this.HelpButton = true; 102 | this.MaximizeBox = false; 103 | this.MinimizeBox = false; 104 | this.Name = "ReportSystemTypeFilterDlg"; 105 | this.ShowIcon = false; 106 | this.ShowInTaskbar = false; 107 | this.ResumeLayout(false); 108 | this.PerformLayout(); 109 | 110 | } 111 | 112 | #endregion 113 | 114 | private System.Windows.Forms.Button btCancel; 115 | private System.Windows.Forms.Button btnOK; 116 | private System.Windows.Forms.Button btnInvert; 117 | private System.Windows.Forms.Button btnNone; 118 | private System.Windows.Forms.Button btnSelectAll; 119 | private System.Windows.Forms.CheckedListBox SystemTypeCheckList; 120 | private System.Windows.Forms.Label label1; 121 | } 122 | } -------------------------------------------------------------------------------- /PressureLossReport/Dialogs/ReportSystemTypeFilterDlg.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.ComponentModel; 26 | using System.Data; 27 | using System.Drawing; 28 | using System.Linq; 29 | using System.Text; 30 | using System.Windows.Forms; 31 | 32 | namespace UserPressureLossReport 33 | { 34 | public partial class ReportSystemTypeFilterDlg : Form 35 | { 36 | public List checkedValidSystemsType = null; 37 | public List allValidSystemsType = null; 38 | 39 | public ReportSystemTypeFilterDlg(List allSysType, List checkedSysType) 40 | { 41 | allValidSystemsType = allSysType; 42 | checkedValidSystemsType = checkedSysType; 43 | 44 | InitializeComponent(); 45 | 46 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 47 | if (helper == null) 48 | return; 49 | 50 | //title 51 | if (helper.Domain == ReportResource.pipeDomain) 52 | this.Text = ReportResource.pipeSystemTypeFilterDlgTitle; 53 | else 54 | this.Text = ReportResource.ductSystemTypeFilterDlgTitle; 55 | 56 | FillData(); 57 | } 58 | 59 | private void FillData() 60 | { 61 | addItemsToCheckList(allValidSystemsType, checkedValidSystemsType); 62 | } 63 | 64 | private void addItemsToCheckList(List allSysType, List checkedSysType) 65 | { 66 | foreach (Autodesk.Revit.DB.MEPSystemType sysType in allSysType) 67 | { 68 | if (PressureLossReportHelper.isSystemTypeInList(checkedSysType, sysType)) 69 | SystemTypeCheckList.Items.Add(sysType.Name, true); 70 | else 71 | SystemTypeCheckList.Items.Add(sysType.Name, false); 72 | } 73 | } 74 | 75 | private void btnSelectAll_Click(object sender, EventArgs e) 76 | { 77 | setAllItemsStatus(true); 78 | } 79 | 80 | private void btnNone_Click(object sender, EventArgs e) 81 | { 82 | setAllItemsStatus(false); 83 | } 84 | 85 | private void btnInvert_Click(object sender, EventArgs e) 86 | { 87 | for (int ii = 0; ii < SystemTypeCheckList.Items.Count; ++ii) 88 | { 89 | SystemTypeCheckList.SetItemChecked(ii, !SystemTypeCheckList.GetItemChecked(ii)); 90 | } 91 | } 92 | 93 | private void setAllItemsStatus(bool bStatus) 94 | { 95 | for (int ii = 0; ii < SystemTypeCheckList.Items.Count; ++ii) 96 | { 97 | SystemTypeCheckList.SetItemChecked(ii, bStatus); 98 | } 99 | } 100 | 101 | private void btnOK_Click(object sender, EventArgs e) 102 | { 103 | checkedValidSystemsType.Clear(); 104 | for (int ii = 0; ii < SystemTypeCheckList.Items.Count; ++ii) 105 | { 106 | if (SystemTypeCheckList.GetItemChecked(ii)) 107 | { 108 | checkedValidSystemsType.Add(allValidSystemsType[ii]); 109 | } 110 | } 111 | DialogResult = DialogResult.OK; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/CsvStreamWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Collections; 28 | using System.Data; 29 | using System.IO; 30 | 31 | namespace UserPressureLossReport 32 | { 33 | public class CsvStreamWriter 34 | { 35 | private ArrayList rowAL; //Row list,each line is a list 36 | private string fileName; //file name 37 | private Encoding encoding; 38 | 39 | public CsvStreamWriter() 40 | { 41 | this.rowAL = new ArrayList(); 42 | this.fileName = ""; 43 | this.encoding = Encoding.Default; 44 | } 45 | 46 | /// 47 | /// 48 | /// 49 | /// file name, including file path 50 | public CsvStreamWriter(string fileName) 51 | { 52 | this.rowAL = new ArrayList(); 53 | this.fileName = fileName; 54 | this.encoding = Encoding.Default; 55 | } 56 | 57 | /// 58 | /// 59 | /// 60 | /// file name, including file path 61 | /// encoding 62 | public CsvStreamWriter(string fileName, Encoding encoding) 63 | { 64 | this.rowAL = new ArrayList(); 65 | this.fileName = fileName; 66 | this.encoding = encoding; 67 | } 68 | 69 | /// 70 | /// row:row = 1 is the first row 71 | /// col:col = 1 is the first column 72 | /// 73 | public string this[int row, int col] 74 | { 75 | set 76 | { 77 | //check row valid 78 | if (row <= 0) 79 | { 80 | throw new Exception("row can't be less than 0"); 81 | } 82 | else if (row > this.rowAL.Count) //if the row is not big enough, need to add row 83 | { 84 | for (int i = this.rowAL.Count + 1; i <= row; i++) 85 | { 86 | this.rowAL.Add(new ArrayList()); 87 | } 88 | } 89 | 90 | //check column valid 91 | if (col <= 0) 92 | { 93 | throw new Exception("column can't be less than 0"); 94 | } 95 | else 96 | { 97 | ArrayList colTempAL = (ArrayList)this.rowAL[row - 1]; 98 | 99 | //extend column 100 | if (col > colTempAL.Count) 101 | { 102 | for (int i = colTempAL.Count; i <= col; i++) 103 | { 104 | colTempAL.Add(""); 105 | } 106 | } 107 | this.rowAL[row - 1] = colTempAL; 108 | } 109 | //set value 110 | ArrayList colAL = (ArrayList)this.rowAL[row - 1]; 111 | 112 | colAL[col - 1] = value; 113 | this.rowAL[row - 1] = colAL; 114 | } 115 | } 116 | 117 | 118 | /// 119 | /// file name, including file path 120 | /// 121 | public string FileName 122 | { 123 | set 124 | { 125 | this.fileName = value; 126 | } 127 | } 128 | 129 | /// 130 | /// 131 | /// 132 | 133 | public Encoding FileEncoding 134 | { 135 | set 136 | { 137 | this.encoding = value; 138 | } 139 | } 140 | 141 | /// 142 | /// get max row 143 | /// 144 | public int CurMaxRow 145 | { 146 | get 147 | { 148 | return this.rowAL.Count; 149 | } 150 | } 151 | 152 | /// 153 | /// get max col 154 | /// 155 | public int CurMaxCol 156 | { 157 | get 158 | { 159 | int maxCol; 160 | 161 | maxCol = 0; 162 | for (int i = 0; i < this.rowAL.Count; i++) 163 | { 164 | ArrayList colAL = (ArrayList)this.rowAL[i]; 165 | 166 | maxCol = (maxCol > colAL.Count) ? maxCol : colAL.Count; 167 | } 168 | 169 | return maxCol; 170 | } 171 | } 172 | 173 | /// 174 | /// add data to the file 175 | /// 176 | /// datatable 177 | /// start column,beginCol = 1 is the first column 178 | public void AddData(DataTable dataDT, int beginCol) 179 | { 180 | if (dataDT == null) 181 | { 182 | throw new Exception("the table is empty"); 183 | } 184 | int curMaxRow; 185 | 186 | curMaxRow = this.rowAL.Count; 187 | for (int i = 0; i < dataDT.Rows.Count; i++) 188 | { 189 | for (int j = 0; j < dataDT.Columns.Count; j++) 190 | { 191 | this[curMaxRow + i + 1, beginCol + j] = dataDT.Rows[i][j].ToString(); 192 | } 193 | } 194 | } 195 | 196 | public void addTitleRow(string title) 197 | { 198 | DataTable tb = new DataTable(); 199 | tb.Columns.Add(); 200 | tb.Rows.Add(title); 201 | 202 | AddData(tb, 1); 203 | } 204 | 205 | public void addOneEmptyRow() 206 | { 207 | DataTable tb = new DataTable(); 208 | tb.Columns.Add(); 209 | tb.Rows.Add(" "); 210 | 211 | AddData(tb, 1); 212 | } 213 | 214 | /// 215 | /// save file,it will replace the same name file 216 | /// 217 | public void Save() 218 | { 219 | //check the file name valid 220 | if (this.fileName == null) 221 | { 222 | throw new Exception("file name is empty"); 223 | } 224 | else if (File.Exists(this.fileName)) 225 | { 226 | try 227 | { 228 | File.Delete(this.fileName); 229 | } 230 | catch 231 | { 232 | throw new Exception(ReportConstants.failed_to_delete); 233 | } 234 | 235 | } 236 | if (this.encoding == null) 237 | { 238 | this.encoding = Encoding.Default; 239 | } 240 | System.IO.StreamWriter sw = new StreamWriter(this.fileName, false, this.encoding); 241 | 242 | for (int i = 0; i < this.rowAL.Count; i++) 243 | { 244 | sw.WriteLine(ConvertToSaveLine((ArrayList)this.rowAL[i])); 245 | } 246 | 247 | sw.Close(); 248 | } 249 | 250 | /// 251 | /// save file,it will replace the same name file 252 | /// 253 | /// file name, including file path 254 | public void Save(string fileName) 255 | { 256 | this.fileName = fileName; 257 | Save(); 258 | } 259 | 260 | /// 261 | /// save file,it will replace the same name file 262 | /// 263 | /// file name, including file path 264 | /// encoding 265 | public void Save(string fileName, Encoding encoding) 266 | { 267 | this.fileName = fileName; 268 | this.encoding = encoding; 269 | Save(); 270 | } 271 | 272 | 273 | /// 274 | /// convert to line before save 275 | /// 276 | /// one row 277 | /// 278 | private string ConvertToSaveLine(ArrayList colAL) 279 | { 280 | string saveLine; 281 | 282 | saveLine = ""; 283 | for (int i = 0; i < colAL.Count; i++) 284 | { 285 | saveLine += ConvertToSaveCell(colAL[i].ToString()); 286 | //coma is the separator 287 | if (i < colAL.Count - 1) 288 | { 289 | saveLine += ","; 290 | } 291 | } 292 | 293 | return saveLine; 294 | } 295 | 296 | /// 297 | /// 298 | /// add "" to the cell text 299 | /// 300 | /// 301 | /// cell text 302 | /// 303 | private string ConvertToSaveCell(string cell) 304 | { 305 | cell = cell.Replace("\"", "\"\""); 306 | 307 | return "\"" + cell + "\""; 308 | } 309 | } 310 | } 311 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/DataGenerator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | 28 | namespace UserPressureLossReport 29 | { 30 | /// 31 | /// Generates report data. 32 | /// 33 | public class DataGenerator 34 | { 35 | private SaveData writer; 36 | 37 | /// 38 | /// Save pressure loss report to a file according to customer's settings. 39 | /// 40 | public bool SaveReportToFile(string fileName, PressureLossReportData settings, SaveType eSaveType) 41 | { 42 | // TODO 43 | if (eSaveType == SaveType.HTML) 44 | writer = new SaveDataToHTML(); 45 | else 46 | writer = new SaveDataToCSV(); 47 | 48 | PressureLossReportHelper.instance.ReportData = settings; 49 | 50 | return writer.save(fileName, settings); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/HtmlStreamWriter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Collections; 28 | using System.IO; 29 | using System.Data; 30 | using System.Xml.Xsl; 31 | using System.Xml; 32 | using Autodesk.Revit.DB; 33 | using Autodesk.Revit.DB.Mechanical; 34 | 35 | namespace UserPressureLossReport 36 | { 37 | public class HtmlStreamWriter 38 | { 39 | XmlWriter xmlWriter = null; 40 | string xmlFileName = ""; 41 | string xsltFileName = ""; 42 | 43 | public HtmlStreamWriter() 44 | { 45 | try 46 | { 47 | xmlFileName = System.IO.Path.GetDirectoryName( 48 | PressureLossReportHelper.instance.Doc 49 | .Application.RecordingJournalFilename ); 50 | 51 | if( xmlFileName != null && xmlFileName.Length > 0 ) 52 | xmlFileName = xmlFileName 53 | + "\\UserPressureLossReport" 54 | + DateTime.Now.Millisecond.ToString() + ".xml"; 55 | 56 | string strPath = typeof( 57 | UserPressureLossReport.WholeReportSettingsDlg ) 58 | .Assembly.Location; 59 | 60 | xsltFileName = Path.Combine( 61 | Path.GetDirectoryName( Path.GetDirectoryName( 62 | strPath ) ), 63 | "output", "UserPressureLossReport.xslt" ); 64 | 65 | //xmlFileName = strPath + "\\UserPressureLossReport" + DateTime.Now.Millisecond.ToString() + ".xml"; 66 | //xsltFileName = strPath + "\\UserPressureLossReport.xslt"; 67 | 68 | xmlWriter = XmlWriter.Create( xmlFileName ); 69 | } 70 | catch 71 | { 72 | File.Delete( xmlFileName ); 73 | } 74 | } 75 | 76 | public string XmlFileName 77 | { 78 | get { return xmlFileName; } 79 | } 80 | 81 | public string XsltFileName 82 | { 83 | get { return xsltFileName; } 84 | } 85 | 86 | public void ConvertXML( string XMLfilePath, string XSLTFilePath, string HTMLfilePath ) 87 | { 88 | XslCompiledTransform trans = new XslCompiledTransform(); 89 | trans.Load( XSLTFilePath ); 90 | 91 | trans.Transform( XMLfilePath, HTMLfilePath ); 92 | } 93 | 94 | public string ConvertBytesToString( byte[] bytes ) 95 | { 96 | string output = String.Empty; 97 | MemoryStream stream = new MemoryStream( bytes ); 98 | stream.Position = 0; 99 | using( StreamReader reader = new StreamReader( stream ) ) 100 | { 101 | output = reader.ReadToEnd(); 102 | } 103 | return output; 104 | } 105 | 106 | public void WriteStartDocument( bool bWrite = false ) 107 | { 108 | xmlWriter.WriteStartDocument( bWrite ); 109 | } 110 | 111 | public void WriteStartElement( string str ) 112 | { 113 | xmlWriter.WriteStartElement( str ); 114 | } 115 | 116 | public void WriteElementString( string name, string val ) 117 | { 118 | xmlWriter.WriteElementString( name, val ); 119 | } 120 | 121 | public void WriteEndElement() 122 | { 123 | xmlWriter.WriteEndElement(); 124 | } 125 | 126 | public void WriteEndDocument() 127 | { 128 | xmlWriter.WriteEndDocument(); 129 | } 130 | 131 | public void Save( string fileName ) 132 | { 133 | Close(); 134 | ConvertXML( xmlFileName, xsltFileName, fileName ); 135 | File.Delete( xmlFileName ); 136 | } 137 | 138 | public void Close() 139 | { 140 | xmlWriter.Flush(); 141 | xmlWriter.Close(); 142 | } 143 | 144 | public void writeDataTable( DataTable tb, bool bReplaceColumn = false ) 145 | { 146 | if( xmlWriter == null || tb == null ) 147 | return; 148 | 149 | MemoryStream stream = new MemoryStream(); 150 | tb.WriteXml( stream ); 151 | string str = ConvertBytesToString( stream.ToArray() ); 152 | str = str.Replace( "", "" ); 153 | str = str.Replace( "", "" ); 154 | 155 | if( bReplaceColumn ) 156 | { 157 | for( int ii = 1; ii < tb.Columns.Count + 1; ++ii ) 158 | { 159 | string strCol = ""; 160 | string strCol2 = ""; 161 | str = str.Replace( strCol, "" ); 162 | str = str.Replace( strCol2, "" ); 163 | } 164 | } 165 | xmlWriter.WriteRaw( str ); 166 | } 167 | 168 | public void writeTableTitle( string nodeType, List strFields, bool bForSection = false ) 169 | { 170 | if( xmlWriter == null || nodeType == null || strFields == null ) 171 | return; 172 | 173 | string str = nodeType + "Info"; 174 | xmlWriter.WriteStartElement( str ); 175 | 176 | xmlWriter.WriteElementString( "SectionNumber", ReportResource.section ); 177 | 178 | if( !bForSection ) 179 | xmlWriter.WriteElementString( nodeType + "TotalPressuerLoss", ReportResource.totalPressureLoss ); 180 | else 181 | xmlWriter.WriteElementString( nodeType + "TotalPressuerLoss", ReportResource.sectionPressureLoss ); 182 | 183 | DataTable sectionDetailInfoTBTitle = new DataTable( nodeType + "DetailInfo" ); 184 | PressureLossReportHelper.instance.getTableTitle( sectionDetailInfoTBTitle, strFields, true ); 185 | writeDataTable( sectionDetailInfoTBTitle, true ); 186 | 187 | xmlWriter.WriteEndElement(); 188 | } 189 | 190 | public void writeTable( string nodeType, DataTable tb, string number, string totalPL ) 191 | { 192 | if( tb == null || nodeType == null || number == null || totalPL == null ) 193 | return; 194 | 195 | WriteStartElement( nodeType + "Info" ); 196 | WriteElementString( "SectionNumber", number ); 197 | WriteElementString( nodeType + "TotalPressuerLoss", totalPL ); 198 | writeDataTable( tb, true ); 199 | WriteEndElement(); 200 | } 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/MEPSystemInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Data; 28 | using Autodesk.Revit; 29 | using Autodesk.Revit.DB; 30 | using Autodesk.Revit.DB.Plumbing; 31 | using Autodesk.Revit.DB.Mechanical; 32 | 33 | namespace UserPressureLossReport 34 | { 35 | class MEPSystemInfo : ReportInfo 36 | { 37 | private MEPSystem system; 38 | 39 | public MEPSystemInfo(MEPSystem systemElem) 40 | { 41 | system = systemElem; 42 | if (system == null) 43 | return; 44 | 45 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 46 | if (helper == null) 47 | return; 48 | 49 | MEPSystemType sysType = helper.Doc.GetElement(system.GetTypeId()) as MEPSystemType; 50 | if (sysType != null) 51 | helper.SystemClassification = sysType.SystemClassification; 52 | 53 | 54 | } 55 | 56 | public override void writeToHTML(HtmlStreamWriter writer) 57 | { 58 | if (writer == null || system == null) 59 | return; 60 | 61 | //system name 62 | string sysName = system.Name; 63 | if (sysName.Length > 0) 64 | writer.WriteElementString("SystemName", sysName); 65 | 66 | //system info 67 | if (needToWrite()) 68 | { 69 | DataTable tb = new DataTable("SystemInfo"); 70 | getInfoDataTable(tb); 71 | writer.WriteElementString("SystemInfoTitle", ReportResource.systemInformation); 72 | writer.writeDataTable(tb); 73 | } 74 | } 75 | 76 | public override void writeToCsv(CsvStreamWriter writer) 77 | { 78 | if (writer == null || system == null) 79 | return; 80 | 81 | //system name 82 | string sysName = system.Name; 83 | if (sysName.Length > 0) 84 | { 85 | writer.addTitleRow(sysName); 86 | writer.addOneEmptyRow(); 87 | } 88 | 89 | if (needToWrite()) 90 | { 91 | writer.addTitleRow(ReportResource.systemInformation); 92 | DataTable tb = new DataTable(); 93 | getInfoDataTable(tb); 94 | writer.AddData(tb, 1); 95 | } 96 | } 97 | 98 | public void getInfoDataTable(DataTable systemTB) 99 | { 100 | if (systemTB == null || system == null) 101 | return; 102 | 103 | systemTB.Columns.Add("SystemInfoName"); 104 | systemTB.Columns.Add("SystemInfoValue"); 105 | 106 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 107 | if (helper == null) 108 | return; 109 | 110 | MEPSystemType sysType = helper.Doc.GetElement(system.GetTypeId()) as MEPSystemType; 111 | if (sysType != null) 112 | { 113 | systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM), system.get_Parameter(BuiltInParameter.RBS_SYSTEM_CLASSIFICATION_PARAM).AsString()); 114 | 115 | if (helper.Domain == ReportResource.ductDomain) 116 | systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM), sysType.Name); 117 | else 118 | systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM), sysType.Name); 119 | systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_NAME_PARAM), system.Name); 120 | systemTB.Rows.Add(LabelUtils.GetLabelFor(BuiltInParameter.RBS_SYSTEM_ABBREVIATION_PARAM), sysType.Abbreviation); 121 | 122 | if (helper.Domain == ReportResource.pipeDomain) // need to list fluid info 123 | { 124 | //Fluid type is an element id 125 | ElementId elemId = sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).AsElementId(); 126 | string strFluidType = ""; 127 | if (elemId != null) 128 | { 129 | Element elem = helper.Doc.GetElement(elemId); 130 | if (elem != null) 131 | strFluidType = elem.Name; 132 | } 133 | systemTB.Rows.Add(sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TYPE_PARAM).Definition.Name, strFluidType); 134 | helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_TEMPERATURE_PARAM), false); 135 | helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_VISCOSITY_PARAM), false); 136 | helper.addParameterNameAndValueToTable(systemTB, sysType.get_Parameter(BuiltInParameter.RBS_PIPE_FLUID_DENSITY_PARAM), false); 137 | } 138 | } 139 | 140 | return; 141 | } 142 | 143 | public override bool needToWrite() 144 | { 145 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 146 | if (helper.ReportData == null || helper.ReportData.DisplaySysInfo == false) 147 | return false; 148 | 149 | return true; 150 | } 151 | 152 | static public void getSectionsFromSystem(MEPSystem system, List sections) 153 | { 154 | if (system == null || sections == null) 155 | return; 156 | 157 | int nSection = system.SectionsCount; 158 | 159 | if (nSection > 0) 160 | { 161 | for (int ii = 1; ii < nSection + 1; ++ii) //section number start from 1 162 | { 163 | MEPSection section = system.GetSectionByNumber(ii); 164 | if (section == null) 165 | continue; 166 | 167 | sections.Add(section); 168 | } 169 | } 170 | } 171 | 172 | static public string getCriticalPath(MEPSystem elemSystem) 173 | { 174 | string strPath = ""; 175 | if (elemSystem != null) 176 | { 177 | IList paths = elemSystem.GetCriticalPathSectionNumbers(); 178 | if (paths != null) 179 | { 180 | int nIndex = 0; 181 | foreach (int nn in paths) 182 | { 183 | nIndex++; 184 | strPath += nn; 185 | if (nIndex < paths.Count) 186 | strPath += ReportConstants.emptyValue; 187 | } 188 | } 189 | 190 | } 191 | return strPath; 192 | } 193 | 194 | static public string getCriticalPathPressureLoss(MEPSystem elemSystem) 195 | { 196 | string strVal = ""; 197 | if (elemSystem != null) 198 | { 199 | if (PressureLossReportHelper.instance.Domain == ReportResource.pipeDomain) 200 | strVal = FormatUtils.Format(PressureLossReportHelper.instance.Doc, UnitType.UT_Piping_Pressure, elemSystem.PressureLossOfCriticalPath); 201 | else 202 | strVal = FormatUtils.Format(PressureLossReportHelper.instance.Doc, UnitType.UT_HVAC_Pressure, elemSystem.PressureLossOfCriticalPath); 203 | 204 | } 205 | return strVal; 206 | } 207 | 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/ReportInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Data; 28 | 29 | namespace UserPressureLossReport 30 | { 31 | public abstract class ReportInfo 32 | { 33 | public virtual void writeToHTML(HtmlStreamWriter writer) 34 | { 35 | 36 | } 37 | public virtual void writeToCsv(CsvStreamWriter writer) 38 | { 39 | 40 | } 41 | public virtual bool needToWrite() 42 | { 43 | return true; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/ReportProjectInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Data; 28 | using Autodesk.Revit; 29 | using Autodesk.Revit.DB; 30 | 31 | namespace UserPressureLossReport 32 | { 33 | class ReportProjectInfo : ReportInfo 34 | { 35 | public override void writeToHTML(HtmlStreamWriter writer) 36 | { 37 | if (writer == null || !needToWrite()) 38 | return; 39 | 40 | DataTable tb = new DataTable("ProjectInfo"); 41 | getInfoDataTable(tb); 42 | writer.writeDataTable(tb); 43 | 44 | } 45 | 46 | public override void writeToCsv(CsvStreamWriter writer) 47 | { 48 | if (writer == null || !needToWrite()) 49 | return; 50 | 51 | DataTable tb = new DataTable(); 52 | getInfoDataTable(tb); 53 | writer.AddData(tb, 1); 54 | } 55 | 56 | public void getInfoDataTable(DataTable projectInfoTB) 57 | { 58 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 59 | if (helper == null || helper.Doc == null || projectInfoTB == null) 60 | return; 61 | 62 | //2 columns 63 | projectInfoTB.Columns.Add("ProjectInfoName"); 64 | projectInfoTB.Columns.Add("ProjectInfoValue"); 65 | 66 | ProjectInfo proInfo = helper.Doc.ProjectInformation; 67 | if (proInfo == null) 68 | return; 69 | 70 | List basicProjInfoParams = new List(); 71 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_NAME)); 72 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_ISSUE_DATE)); 73 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_STATUS)); 74 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.CLIENT_NAME)); 75 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_ADDRESS)); 76 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_NUMBER)); 77 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_ORGANIZATION_NAME)); 78 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_ORGANIZATION_DESCRIPTION)); 79 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_BUILDING_NAME)); 80 | basicProjInfoParams.Add(proInfo.get_Parameter(BuiltInParameter.PROJECT_AUTHOR)); 81 | 82 | List names = new List(); 83 | 84 | foreach (Parameter param in basicProjInfoParams) 85 | { 86 | if (param == null) 87 | continue; 88 | 89 | helper.addParameterNameAndValueToTable(projectInfoTB, param, false); 90 | names.Add(param.Definition.Name); 91 | } 92 | 93 | foreach (Parameter param in helper.Doc.ProjectInformation.Parameters) 94 | { 95 | if (param == null || names.Contains(param.Definition.Name)) 96 | continue; 97 | 98 | if (param.StorageType != StorageType.None) 99 | helper.addParameterNameAndValueToTable(projectInfoTB, param, false); 100 | } 101 | 102 | if (helper.ReportData.DisplayRunTime) 103 | projectInfoTB.Rows.Add(ReportResource.runTime, DateTime.Now.ToString()); 104 | 105 | return; 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /PressureLossReport/GenerateReport/SaveData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Collections; 28 | using System.IO; 29 | using System.Data; 30 | using System.Xml.Xsl; 31 | using System.Xml; 32 | using Autodesk.Revit.DB; 33 | using Autodesk.Revit.UI; 34 | using Autodesk.Revit.DB.Mechanical; 35 | 36 | namespace UserPressureLossReport 37 | { 38 | /// 39 | /// Base class providing interface to save report data to a file. 40 | /// 41 | public abstract class SaveData 42 | { 43 | public virtual bool save(string fileName, PressureLossReportData reportData) 44 | { 45 | return false; 46 | } 47 | } 48 | 49 | /// 50 | /// Save report data to a HTML file. 51 | /// 52 | public class SaveDataToHTML : SaveData 53 | { 54 | public override bool save(string fileName, PressureLossReportData reportData) 55 | { 56 | HtmlStreamWriter writer = new HtmlStreamWriter(); 57 | try 58 | { 59 | // Check if the xslt file exists 60 | 61 | if (!File.Exists(writer.XsltFileName)) 62 | { 63 | string subMsg = ReportResource.xsltFileSubMsg 64 | .Replace("%FULLPATH%", writer.XsltFileName ); 65 | 66 | UIHelperFunctions.postWarning( 67 | ReportResource.htmlGenerateTitle, 68 | ReportResource.xsltFileMsg, subMsg ); 69 | 70 | return false; 71 | } 72 | 73 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 74 | if (helper == null) 75 | return false; 76 | 77 | //xml head 78 | writer.WriteStartDocument(false); 79 | 80 | //root node 81 | string transXML = "UserPressureLossReport"; 82 | writer.WriteStartElement(transXML); 83 | 84 | //title 85 | writer.WriteElementString("Title", ReportResource.reportName); 86 | 87 | //domain 88 | if (helper.Domain == ReportResource.pipeDomain) 89 | writer.WriteElementString("DomainName", ReportResource.pipeReportName); 90 | else 91 | writer.WriteElementString("DomainName", ReportResource.ductReportName); 92 | 93 | //write project info 94 | ReportProjectInfo proInfo = new ReportProjectInfo(); 95 | proInfo.writeToHTML(writer); 96 | 97 | //each system 98 | List systems = helper.getSortedSystems(); 99 | if (systems == null || systems.Count < 1) 100 | return false; 101 | 102 | foreach (MEPSystem sysElem in systems) 103 | { 104 | if (sysElem == null) 105 | continue; 106 | 107 | //system node 108 | string xmlString = "System"; 109 | writer.WriteStartElement(xmlString); 110 | 111 | //system info: name and info 112 | MEPSystemInfo systemInfo = new MEPSystemInfo(sysElem); 113 | systemInfo.writeToHTML(writer); 114 | 115 | //critical path 116 | if (helper.ReportData.DisplayCriticalPath) 117 | { 118 | string criticalInfo =ReportResource.criticalPath + " : " + MEPSystemInfo.getCriticalPath(sysElem); 119 | criticalInfo += " ; "+ ReportResource.totalPressureLoss + " : " + MEPSystemInfo.getCriticalPathPressureLoss(sysElem); 120 | writer.WriteElementString("CriticalPath", criticalInfo); 121 | } 122 | 123 | List sections = new List(); 124 | MEPSystemInfo.getSectionsFromSystem(sysElem, sections); 125 | 126 | //sections: title and info 127 | SectionsInfo sectionInfo = new SectionsInfo(sections); 128 | sectionInfo.writeToHTML(writer); 129 | 130 | //segments: title and info 131 | SegmentsInfo segmentsInfo = new SegmentsInfo(sections); 132 | segmentsInfo.writeToHTML(writer); 133 | 134 | //fittings: title and info 135 | FittingsInfo fittingsInfo = new FittingsInfo(sections); 136 | fittingsInfo.writeToHTML(writer); 137 | 138 | writer.WriteEndElement(); 139 | } 140 | 141 | writer.WriteEndElement(); 142 | writer.WriteEndDocument(); 143 | 144 | writer.Save(fileName); 145 | return true; 146 | } 147 | catch 148 | { 149 | writer.Close(); 150 | //delete xml 151 | File.Delete(writer.XmlFileName); 152 | UIHelperFunctions.postWarning(ReportResource.htmlGenerateTitle, ReportResource.htmlMsg); 153 | return false; 154 | } 155 | } 156 | } 157 | 158 | /// 159 | /// Save report data to a CSV file. 160 | /// 161 | public class SaveDataToCSV : SaveData 162 | { 163 | // TODO 164 | public override bool save(string fileName, PressureLossReportData reportData) 165 | { 166 | 167 | try 168 | { 169 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 170 | CsvStreamWriter writer = new CsvStreamWriter(); 171 | 172 | //title 173 | string strTitle = ReportResource.reportName; 174 | if (helper.Domain == ReportResource.pipeDomain) 175 | strTitle = ReportResource.pipeReportName; 176 | else 177 | strTitle = ReportResource.ductReportName; 178 | 179 | DataTable titleTB = new DataTable(); 180 | titleTB.Columns.Add(); 181 | titleTB.Rows.Add(strTitle); 182 | writer.AddData(titleTB, 1); 183 | writer.addOneEmptyRow(); 184 | 185 | DataTable tbTitle = new DataTable(); 186 | DataTable tb = new DataTable(); 187 | 188 | //Project info 189 | ReportProjectInfo proInfo = new ReportProjectInfo(); 190 | proInfo.writeToCsv(writer); 191 | 192 | writer.addOneEmptyRow(); 193 | 194 | //each system 195 | List systems = helper.getSortedSystems(); 196 | if (systems == null || systems.Count < 1) 197 | return false; 198 | foreach (MEPSystem sysElem in systems) 199 | { 200 | if (sysElem == null) 201 | continue; 202 | 203 | //system name and info 204 | MEPSystemInfo systemInfo = new MEPSystemInfo(sysElem); 205 | systemInfo.writeToCsv(writer); 206 | 207 | if (systemInfo.needToWrite()) 208 | writer.addOneEmptyRow(); 209 | 210 | List sections = new List(); 211 | MEPSystemInfo.getSectionsFromSystem(sysElem, sections); 212 | 213 | //sections: title and info 214 | SectionsInfo sectionInfo = new SectionsInfo(sections); 215 | sectionInfo.writeToCsv(writer); 216 | 217 | if (reportData.DisplayCriticalPath) 218 | { 219 | string criticalInfo = ReportResource.criticalPath + " : " + MEPSystemInfo.getCriticalPath(sysElem); 220 | criticalInfo += " ; " + ReportResource.totalPressureLoss + " : " + MEPSystemInfo.getCriticalPathPressureLoss(sysElem); 221 | 222 | writer.addTitleRow(criticalInfo); 223 | } 224 | 225 | writer.addOneEmptyRow(); 226 | 227 | //segments: title and info 228 | SegmentsInfo segmentsInfo = new SegmentsInfo(sections); 229 | segmentsInfo.writeToCsv(writer); 230 | if (segmentsInfo.needToWrite()) 231 | writer.addOneEmptyRow(); 232 | 233 | //fittings: title and info 234 | FittingsInfo fittingsInfo = new FittingsInfo(sections); 235 | fittingsInfo.writeToCsv(writer); 236 | if (fittingsInfo.needToWrite()) 237 | writer.addOneEmptyRow(); 238 | } 239 | 240 | writer.Save(fileName); 241 | return true; 242 | } 243 | catch(Exception e) 244 | { 245 | if (e.Message == ReportConstants.failed_to_delete) 246 | { 247 | string subMsg = ReportResource.csvSubMsg.Replace("%FULLPATH%", fileName); 248 | UIHelperFunctions.postWarning(ReportResource.csvGenerateTitle, ReportResource.csvMsg, subMsg); 249 | } 250 | else 251 | UIHelperFunctions.postWarning(ReportResource.csvGenerateTitle, ReportResource.csvMsg); 252 | return false; 253 | } 254 | } 255 | } 256 | } 257 | 258 | 259 | -------------------------------------------------------------------------------- /PressureLossReport/PressureLossReport.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | None 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 8.0.30703 12 | 2.0 13 | {E2422FD6-DB9B-4C84-AFD9-277B9B2F9044} 14 | Library 15 | Properties 16 | UserPressureLossReport 17 | UserPressureLossReport 18 | v4.0 19 | 512 20 | prompt 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | False 32 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPI.dll 33 | False 34 | 35 | 36 | False 37 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPIUI.dll 38 | False 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Form 53 | 54 | 55 | ReportSystemSelectorDlg.cs 56 | 57 | 58 | Form 59 | 60 | 61 | ReportSystemTypeFilterDlg.cs 62 | 63 | 64 | 65 | 66 | 67 | 68 | Form 69 | 70 | 71 | PartialReportSettingsDlg.cs 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Form 85 | 86 | 87 | ReportFormatNameDlg.cs 88 | 89 | 90 | 91 | 92 | Form 93 | 94 | 95 | WholeReportSettingsDlg.cs 96 | 97 | 98 | True 99 | True 100 | ReportResource.resx 101 | 102 | 103 | 104 | 105 | 106 | PartialReportSettingsDlg.cs 107 | 108 | 109 | ReportFormatNameDlg.cs 110 | 111 | 112 | ReportSystemSelectorDlg.cs 113 | 114 | 115 | ReportSystemTypeFilterDlg.cs 116 | 117 | 118 | WholeReportSettingsDlg.cs 119 | 120 | 121 | ResXFileCodeGenerator 122 | ReportResource.Designer.cs 123 | 124 | 125 | 126 | 129 | 130 | 131 | 132 | 133 | 140 | -------------------------------------------------------------------------------- /PressureLossReport/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System.Reflection; 24 | using System.Runtime.CompilerServices; 25 | using System.Runtime.InteropServices; 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("UserPressureLossReport")] 31 | [assembly: AssemblyDescription("")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("Autodesk, Inc.")] 34 | [assembly: AssemblyProduct("UserPressureLossReport")] 35 | [assembly: AssemblyCopyright("© 2012 Autodesk, Inc. All rights reserved.")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // Setting ComVisible to false makes the types in this assembly not visible 40 | // to COM components. If you need to access a type in this assembly from 41 | // COM, set the ComVisible attribute to true on that type. 42 | [assembly: ComVisible(false)] 43 | 44 | // The following GUID is for the ID of the typelib if this project is exposed to COM 45 | [assembly: Guid("3491f612-5f39-4bb6-adaf-49aaa4fda347")] 46 | 47 | // Version information for an assembly consists of the following four values: 48 | // 49 | // Major Version 50 | // Minor Version 51 | // Build Number 52 | // Revision 53 | // 54 | // You can specify all the values or you can default the Build and Revision Numbers 55 | // by using the '*' as shown below: 56 | // [assembly: AssemblyVersion("1.0.*")] 57 | [assembly: AssemblyVersion("2014.0.0.0")] 58 | [assembly: AssemblyFileVersion("2014.0.0.0")] 59 | -------------------------------------------------------------------------------- /PressureLossReport/ReportSettings/PressureLossReportData.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using Autodesk.Revit.DB; 28 | 29 | namespace UserPressureLossReport 30 | { 31 | public class PressureLossReportFormats : List 32 | { 33 | //Intended to be empty for now. 34 | } 35 | 36 | [Serializable] 37 | public class PressureLossParameter 38 | { 39 | private string name; 40 | private bool selected; 41 | private int displayOrder; 42 | private int getFrom; //SectionMemberType 43 | private bool display; 44 | 45 | public PressureLossParameter() 46 | { 47 | name = ""; 48 | selected = false; 49 | displayOrder = -1; 50 | getFrom = 0; 51 | display = true; 52 | } 53 | public PressureLossParameter(Parameter _pa) 54 | { 55 | name = _pa.Definition.Name; 56 | selected = false; 57 | displayOrder = -1; 58 | getFrom = 0; 59 | display = true; 60 | } 61 | 62 | public PressureLossParameter(string strName) 63 | { 64 | name = strName; 65 | selected = false; 66 | displayOrder = -1; 67 | getFrom = 0; 68 | display = true; 69 | } 70 | 71 | public PressureLossParameter(string strName, bool bSelected) 72 | { 73 | name = strName; 74 | selected = bSelected; 75 | displayOrder = -1; 76 | getFrom = 0; 77 | display = true; 78 | } 79 | 80 | public PressureLossParameter(string strName, bool bSelected, int nDisplayOrder, int nGetFrom = 0, bool bDisplay = true) 81 | { 82 | name = strName; 83 | selected = bSelected; 84 | displayOrder = nDisplayOrder; 85 | getFrom = nGetFrom; 86 | display = bDisplay; 87 | } 88 | 89 | public override bool Equals(object obj) 90 | { 91 | if (obj is PressureLossParameter) 92 | { 93 | PressureLossParameter param = obj as PressureLossParameter; 94 | if (param != null) 95 | { 96 | return (0 == string.Compare(param.Name, name)); 97 | } 98 | return false; 99 | } 100 | return base.Equals(obj); 101 | } 102 | 103 | public override int GetHashCode() 104 | { 105 | return base.GetHashCode(); 106 | } 107 | 108 | public string Name 109 | { 110 | get { return name; } 111 | set { name = value; } 112 | } 113 | 114 | public bool Selected 115 | { 116 | get { return selected; } 117 | set { selected = value; } 118 | } 119 | 120 | public int DisplayOrder 121 | { 122 | get { return displayOrder; } 123 | set { displayOrder = value; } 124 | } 125 | 126 | public int GetFrom 127 | { 128 | get { return getFrom; } 129 | set { getFrom = value; } 130 | } 131 | 132 | public bool Display 133 | { 134 | get { return display; } 135 | set { display = value; } 136 | } 137 | } 138 | 139 | public class PressureLossReportData 140 | { 141 | public static int DataVersion = 4; 142 | 143 | private List availableFields; 144 | private List straightSegFields; 145 | private List fittingFields; 146 | 147 | public PressureLossReportData() 148 | { 149 | Version = DataVersion; 150 | DisplayRunTime = true; 151 | } 152 | 153 | public override bool Equals(object obj) 154 | { 155 | if (obj is PressureLossReportData) 156 | { 157 | PressureLossReportData data = obj as PressureLossReportData; 158 | if (data != null) 159 | { 160 | return (0 == string.Compare(data.Name, Name) && Domain == data.Domain); 161 | } 162 | return false; 163 | } 164 | return base.Equals(obj); 165 | } 166 | public override int GetHashCode() 167 | { 168 | return base.GetHashCode(); 169 | } 170 | 171 | public string Name 172 | { 173 | get; 174 | set; 175 | } 176 | 177 | public string Domain 178 | { 179 | get; 180 | set; 181 | } 182 | 183 | public int Version 184 | { 185 | get; 186 | set; 187 | } 188 | 189 | public bool DisplaySysInfo 190 | { 191 | get; 192 | set; 193 | } 194 | 195 | public bool DisplayCriticalPath 196 | { 197 | get; 198 | set; 199 | } 200 | 201 | public bool DisplayDetailInfoForStraightSeg 202 | { 203 | get; 204 | set; 205 | } 206 | 207 | public bool DisplayFittingLCSum 208 | { 209 | get; 210 | set; 211 | } 212 | 213 | public bool OpenAfterCreated 214 | { 215 | get; 216 | set; 217 | } 218 | 219 | public bool DisplayRunTime 220 | { 221 | get; 222 | set; 223 | } 224 | 225 | public List AvailableFields 226 | { 227 | get { return availableFields; } 228 | set { availableFields = value; } 229 | } 230 | 231 | public List StraightSegFields 232 | { 233 | get { return straightSegFields; } 234 | set { straightSegFields = value; } 235 | } 236 | 237 | public List FittingFields 238 | { 239 | get { return fittingFields; } 240 | set { fittingFields = value; } 241 | } 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /PressureLossReport/ReportSettings/PressureLossReportDataManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | using System.Xml; 28 | using System.Xml.Serialization; 29 | using System.IO; 30 | using Autodesk.Revit; 31 | using Autodesk.Revit.DB; 32 | 33 | namespace UserPressureLossReport 34 | { 35 | public sealed class PressureLossReportDataManager 36 | { 37 | private PressureLossReportDataManager() 38 | { 39 | formatFileName = getReportFormatFullName(); 40 | } 41 | 42 | public static readonly PressureLossReportDataManager Instance = 43 | new PressureLossReportDataManager(); 44 | 45 | private string formatFileName; 46 | public static string lastUsed = "(LastUsed)"; 47 | 48 | public string FormatFileName 49 | { 50 | get { return formatFileName; } 51 | set { formatFileName = value; } 52 | } 53 | 54 | static public string getReportFormatFullName() 55 | { 56 | string filename = ""; 57 | try 58 | { 59 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 60 | if (helper == null || helper.Doc == null) 61 | return filename; 62 | 63 | //same location as record journaling (for journal replaying) 64 | filename = System.IO.Path.GetDirectoryName(helper.Doc.Application.RecordingJournalFilename); 65 | if (filename != null && filename.Length > 0) 66 | { 67 | string tempName = filename + "\\PressureLossReportFormats.xml"; 68 | if (tempName != null && tempName.Length > 0 && File.Exists(tempName)) 69 | return tempName; 70 | 71 | filename = System.IO.Path.GetDirectoryName(filename + ".xml"); 72 | filename = filename + "\\PressureLossReportFormats.xml"; 73 | } 74 | 75 | //same location as RevitDB.dll 76 | if (filename == null || filename.Length < 1 || !File.Exists(filename)) 77 | { 78 | string strTempfilename = System.IO.Path.GetDirectoryName(helper.Doc.Application.DefaultProjectTemplate); 79 | if (strTempfilename != null && strTempfilename.Length > 0) 80 | filename = strTempfilename + "\\PressureLossReportFormats.xml"; 81 | } 82 | } 83 | catch 84 | { 85 | //do nothing 86 | } 87 | return filename; 88 | } 89 | 90 | private bool isReportFormatReadOnly() 91 | { 92 | if (File.Exists(formatFileName)) 93 | { 94 | FileAttributes att = File.GetAttributes(formatFileName); 95 | if (((int)att & (int)FileAttributes.ReadOnly) > 0) 96 | return true; 97 | } 98 | return false; 99 | } 100 | 101 | /// 102 | /// save the data to the xml file, please catch InvalidOperationException to 103 | /// identify the existing file is broken. 104 | /// 105 | /// format data 106 | public void save(PressureLossReportData data) 107 | { 108 | try 109 | { 110 | XmlSerializer serializer = new XmlSerializer(typeof(PressureLossReportFormats)); 111 | PressureLossReportFormats formats = new PressureLossReportFormats(); 112 | if (File.Exists(formatFileName)) 113 | { 114 | formats = getAllFormats(false); 115 | //formats can't been null, it may throw exception. 116 | //this format exists 117 | if (formats != null && formats.Contains(data)) 118 | { 119 | formats.Remove(data); 120 | } 121 | } 122 | 123 | formats.Add(data); 124 | using (TextWriter writer = new StreamWriter(formatFileName)) 125 | { 126 | serializer.Serialize(writer, formats); 127 | } 128 | } 129 | catch 130 | { 131 | //do nothing 132 | } 133 | } 134 | 135 | /// 136 | /// save a data list--it means a PressureLossReportFormats obj 137 | /// 138 | /// 139 | /// 140 | private void save(PressureLossReportFormats formats) 141 | { 142 | foreach (PressureLossReportData data in formats) 143 | { 144 | save(data); 145 | } 146 | } 147 | 148 | /// 149 | /// clear all the formats 150 | /// 151 | private void clear() 152 | { 153 | if (File.Exists(formatFileName)) 154 | File.Delete(formatFileName); 155 | } 156 | 157 | /// 158 | /// deserialize the format xml file to get the PressureLossReportData object. 159 | /// 160 | /// format name 161 | /// 162 | public PressureLossReportData getData(string formatName) 163 | { 164 | PressureLossReportFormats formats = getAllFormats(); 165 | if (formats != null) 166 | { 167 | foreach (PressureLossReportData data in formats) 168 | { 169 | if (0 == string.Compare(data.Name, formatName)) 170 | return data; 171 | } 172 | } 173 | return null; 174 | } 175 | 176 | /// 177 | /// 178 | /// 179 | /// 180 | /// 181 | public PressureLossReportFormats getAllFormats(bool bCheckDomain = true) 182 | { 183 | XmlSerializer serializer = new XmlSerializer(typeof(PressureLossReportFormats)); 184 | PressureLossReportFormats formats = new PressureLossReportFormats(); 185 | if (!File.Exists(formatFileName)) 186 | return null; 187 | 188 | using (TextReader reader = new StreamReader(formatFileName)) 189 | { 190 | try 191 | { 192 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 193 | PressureLossReportFormats allformats = serializer.Deserialize(reader) as PressureLossReportFormats; 194 | if (allformats != null) 195 | { 196 | foreach (PressureLossReportData data in allformats) 197 | { 198 | if ((bCheckDomain && data.Domain == helper.Domain) || !bCheckDomain) 199 | formats.Add(data); 200 | 201 | } 202 | } 203 | 204 | return formats; 205 | } 206 | catch (System.InvalidOperationException) 207 | { 208 | return formats; 209 | } 210 | } 211 | } 212 | 213 | /// 214 | /// 215 | /// 216 | /// 217 | /// 218 | public void remove(string formatName) 219 | { 220 | PressureLossReportFormats formats = getAllFormats(false); 221 | if (formats != null) 222 | { 223 | PressureLossReportHelper helper = PressureLossReportHelper.instance; 224 | foreach (PressureLossReportData data in formats) 225 | { 226 | if (0 == string.Compare(data.Name, formatName) && helper.Domain == data.Domain) 227 | { 228 | formats.Remove(data); 229 | break; 230 | } 231 | } 232 | clear(); 233 | save(formats); 234 | } 235 | } 236 | 237 | public PressureLossReportData getLastUsedReportData() 238 | { 239 | PressureLossReportFormats formats = getAllFormats(); 240 | if (formats != null) 241 | { 242 | foreach (PressureLossReportData data in formats) 243 | { 244 | if (data.Name.Contains(lastUsed)) 245 | return data; 246 | } 247 | } 248 | 249 | return null; 250 | } 251 | 252 | public string getLastUsedReportName() 253 | { 254 | string lastReportName = ""; 255 | PressureLossReportData data = getLastUsedReportData(); 256 | if (data != null) 257 | { 258 | if (data.Name.Contains("(LastUsed)")) 259 | return data.Name.Substring(0, data.Name.LastIndexOf("(LastUsed)")); 260 | } 261 | 262 | return lastReportName; 263 | } 264 | 265 | public void saveLastUseReport(PressureLossReportData data) 266 | { 267 | if (isReportFormatReadOnly()) 268 | return; 269 | 270 | if (data == null) 271 | return; 272 | 273 | PressureLossReportData lastData = getLastUsedReportData(); 274 | if (lastData != null) 275 | remove(lastData.Name); 276 | 277 | data.Name = data.Name + lastUsed; 278 | save(data); 279 | } 280 | } 281 | } 282 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UserMepCalculation 2 | 3 | Revit MEP Calculation External Service Sample 4 | 5 | For more information, please refer to [The Building Coder](http://thebuildingcoder.typepad.com). 6 | 7 | The first article on this add-in was 8 | the [User MEP Calculation Sample](http://thebuildingcoder.typepad.com/blog/2013/07/user-mep-calculation-sample.html), 9 | and the last mention is the summary of Arnošt Löbel's class SD10752 10 | on [Revit External Services](http://thebuildingcoder.typepad.com/blog/2015/12/external-services.html) at Autodesk University 2015 in Las Vegas. 11 | 12 | This sample is now superseded by the [Revit MEP calculation sample](http://thebuildingcoder.typepad.com/blog/2015/12/external-services.html#5) that he presents there. 13 | 14 | 15 | ## Author 16 | 17 | Jeremy Tammik, 18 | [The Building Coder](http://thebuildingcoder.typepad.com) and 19 | [The 3D Web Coder](http://the3dwebcoder.typepad.com), 20 | [ADN](http://www.autodesk.com/adn) 21 | [Open](http://www.autodesk.com/adnopen), 22 | [Autodesk Inc.](http://www.autodesk.com) 23 | 24 | 25 | ## License 26 | 27 | This sample is licensed under the terms of the [Apache License](http://www.apache.org/licenses). 28 | Please see the [LICENSE](LICENSE) file for full details. 29 | -------------------------------------------------------------------------------- /StraightSegmentCalculationServers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System.Reflection; 24 | using System.Runtime.CompilerServices; 25 | using System.Runtime.InteropServices; 26 | 27 | // General Information about an assembly is controlled through the following 28 | // set of attributes. Change these attribute values to modify the information 29 | // associated with an assembly. 30 | [assembly: AssemblyTitle("StraightSegmentCalculationServers")] 31 | [assembly: AssemblyDescription("")] 32 | [assembly: AssemblyConfiguration("")] 33 | [assembly: AssemblyCompany("Autodesk")] 34 | [assembly: AssemblyProduct("StraightSegmentCalculationServers")] 35 | [assembly: AssemblyCopyright("© 2012 Autodesk, Inc. All Rights Reserved.")] 36 | [assembly: AssemblyTrademark("")] 37 | [assembly: AssemblyCulture("")] 38 | 39 | // Setting ComVisible to false makes the types in this assembly not visible 40 | // to COM components. If you need to access a type in this assembly from 41 | // COM, set the ComVisible attribute to true on that type. 42 | [assembly: ComVisible(false)] 43 | 44 | // The following GUID is for the ID of the typelib if this project is exposed to COM 45 | [assembly: Guid("aab3dae9-70c0-465b-9021-2db144406f19")] 46 | 47 | // Version information for an assembly consists of the following four values: 48 | // 49 | // Major Version 50 | // Minor Version 51 | // Build Number 52 | // Revision 53 | // 54 | // You can specify all the values or you can default the Build and Revision Numbers 55 | // by using the '*' as shown below: 56 | // [assembly: AssemblyVersion("1.0.*")] 57 | [assembly: AssemblyVersion("2014.0.0.0")] 58 | [assembly: AssemblyFileVersion("2014.0.0.0")] 59 | -------------------------------------------------------------------------------- /StraightSegmentCalculationServers/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.544 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UserStraightSegmentCalculationServers.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UserStraightSegmentCalculationServers.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to UserDarcy. 65 | /// 66 | internal static string DuctPressureDropMethodName { 67 | get { 68 | return ResourceManager.GetString("DuctPressureDropMethodName", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to User Calculation of duct pressure drop using Darcy method.. 74 | /// 75 | internal static string DuctPressureDropServerDescription { 76 | get { 77 | return ResourceManager.GetString("DuctPressureDropServerDescription", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\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;} 83 | ///{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\fbidi \fswiss [rest of string was truncated]";. 84 | /// 85 | internal static string DuctPressureDropServerDescriptionRTF { 86 | get { 87 | return ResourceManager.GetString("DuctPressureDropServerDescriptionRTF", resourceCulture); 88 | } 89 | } 90 | 91 | /// 92 | /// Looks up a localized string similar to http://wiki.autodesk.com/display/aeceng/MEP2-109. 93 | /// 94 | internal static string DuctPressureDropServerInformationLink { 95 | get { 96 | return ResourceManager.GetString("DuctPressureDropServerInformationLink", resourceCulture); 97 | } 98 | } 99 | 100 | /// 101 | /// Looks up a localized string similar to User Duct Pressure Drop. 102 | /// 103 | internal static string DuctPressureDropServerName { 104 | get { 105 | return ResourceManager.GetString("DuctPressureDropServerName", resourceCulture); 106 | } 107 | } 108 | 109 | /// 110 | /// Looks up a localized string similar to UserDarcy-Weisbach. 111 | /// 112 | internal static string PipePressureDropMethodName { 113 | get { 114 | return ResourceManager.GetString("PipePressureDropMethodName", resourceCulture); 115 | } 116 | } 117 | 118 | /// 119 | /// Looks up a localized string similar to User Calculation of pressure drop using Darcy-Weisbach method.. 120 | /// 121 | internal static string PipePressureDropServerDescription { 122 | get { 123 | return ResourceManager.GetString("PipePressureDropServerDescription", resourceCulture); 124 | } 125 | } 126 | 127 | /// 128 | /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;} 129 | ///{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Helvetica;}{\f10\fbidi \f [rest of string was truncated]";. 130 | /// 131 | internal static string PipePressureDropServerDescriptionRTF { 132 | get { 133 | return ResourceManager.GetString("PipePressureDropServerDescriptionRTF", resourceCulture); 134 | } 135 | } 136 | 137 | /// 138 | /// Looks up a localized string similar to http://wiki.autodesk.com/display/aeceng/MEP2-109. 139 | /// 140 | internal static string PipePressureDropServerInformationLink { 141 | get { 142 | return ResourceManager.GetString("PipePressureDropServerInformationLink", resourceCulture); 143 | } 144 | } 145 | 146 | /// 147 | /// Looks up a localized string similar to User Pipe Pressure Drop. 148 | /// 149 | internal static string PipePressureDropServerName { 150 | get { 151 | return ResourceManager.GetString("PipePressureDropServerName", resourceCulture); 152 | } 153 | } 154 | 155 | /// 156 | /// Looks up a localized string similar to User Plumbing Fixture Flow. 157 | /// 158 | internal static string PlumbingFixtureFlowMethodName { 159 | get { 160 | return ResourceManager.GetString("PlumbingFixtureFlowMethodName", resourceCulture); 161 | } 162 | } 163 | 164 | /// 165 | /// Looks up a localized string similar to User Calculation of flow using the Plumbing Fixture Flow method.. 166 | /// 167 | internal static string PlumbingFixtureFlowServerDescription { 168 | get { 169 | return ResourceManager.GetString("PlumbingFixtureFlowServerDescription", resourceCulture); 170 | } 171 | } 172 | 173 | /// 174 | /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;} 175 | ///{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f4\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Helvetica;}{\f10\fbidi \f [rest of string was truncated]";. 176 | /// 177 | internal static string PlumbingFixtureFlowServerDescriptionRTF { 178 | get { 179 | return ResourceManager.GetString("PlumbingFixtureFlowServerDescriptionRTF", resourceCulture); 180 | } 181 | } 182 | 183 | /// 184 | /// Looks up a localized string similar to http://wiki.autodesk.com/display/aeceng/MEP2-109. 185 | /// 186 | internal static string PlumbingFixtureFlowServerInformationLink { 187 | get { 188 | return ResourceManager.GetString("PlumbingFixtureFlowServerInformationLink", resourceCulture); 189 | } 190 | } 191 | 192 | /// 193 | /// Looks up a localized string similar to User Plumbing Fixture Flow. 194 | /// 195 | internal static string PlumbingFixtureFlowServerName { 196 | get { 197 | return ResourceManager.GetString("PlumbingFixtureFlowServerName", resourceCulture); 198 | } 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /StraightSegmentCalculationServers/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | UserDarcy 122 | 123 | 124 | User Calculation of duct pressure drop using Darcy method. 125 | 126 | 127 | 128 | ..\Duct\DuctPressureDropServerDescription.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 129 | 130 | 131 | http://wiki.autodesk.com/display/aeceng/MEP2-109 132 | 133 | 134 | User Duct Pressure Drop 135 | 136 | 137 | UserDarcy-Weisbach 138 | 139 | 140 | User Calculation of pressure drop using Darcy-Weisbach method. 141 | 142 | 143 | ..\Pipe\PipePressureDropServerDescription.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 144 | 145 | 146 | http://wiki.autodesk.com/display/aeceng/MEP2-109 147 | 148 | 149 | User Pipe Pressure Drop 150 | 151 | 152 | User Plumbing Fixture Flow 153 | 154 | 155 | User Calculation of flow using the Plumbing Fixture Flow method. 156 | 157 | 158 | ..\Pipe\PlumbingFixtureFlowServerDescription.rtf;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 159 | 160 | 161 | http://wiki.autodesk.com/display/aeceng/MEP2-109 162 | 163 | 164 | User Plumbing Fixture Flow 165 | 166 | -------------------------------------------------------------------------------- /StraightSegmentCalculationServers/StraightSegmentCalculationServers.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | None 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 8.0.30703 12 | 2.0 13 | {CC51FFF7-A456-4F3D-AB09-35BB034FFB93} 14 | Library 15 | Properties 16 | UserStraightSegmentCalculationServers 17 | UserStraightSegmentCalculationServers 18 | v4.0 19 | 512 20 | prompt 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | False 33 | ..\..\..\..\..\Program Files\Autodesk\Revit 2014\RevitAPI.dll 34 | False 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | True 51 | True 52 | Resources.resx 53 | 54 | 55 | 56 | 57 | 58 | ResXFileCodeGenerator 59 | Resources.Designer.cs 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 70 | 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /StraightSegmentCalculationServers/StraightSegmentCalculationServersApp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // (C) Copyright 2003-2012 by Autodesk, Inc. 3 | // 4 | // Permission to use, copy, modify, and distribute this software in 5 | // object code form for any purpose and without fee is hereby granted, 6 | // provided that the above copyright notice appears in all copies and 7 | // that both that copyright notice and the limited warranty and 8 | // restricted rights notice below appear in all supporting 9 | // documentation. 10 | // 11 | // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. 12 | // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF 13 | // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. 14 | // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE 15 | // UNINTERRUPTED OR ERROR FREE. 16 | // 17 | // Use, duplication, or disclosure by the U.S. Government is subject to 18 | // restrictions set forth in FAR 52.227-19 (Commercial Computer 19 | // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 20 | // (Rights in Technical Data and Computer Software), as applicable. 21 | // 22 | 23 | using System; 24 | using System.Collections.Generic; 25 | using System.Linq; 26 | using System.Text; 27 | 28 | using Autodesk.Revit; 29 | using Autodesk.Revit.DB; 30 | using Autodesk.Revit.DB.Plumbing; 31 | using Autodesk.Revit.DB.Mechanical; 32 | using Autodesk.Revit.DB.ExternalService; 33 | using Autodesk.Revit.ApplicationServices; 34 | 35 | namespace UserStraightSegmentCalculationServers 36 | { 37 | 38 | /// 39 | /// The external Application for the sever mainly for adding and registering the server to Revit. 40 | /// 41 | public class ServerApp : IExternalDBApplication 42 | { 43 | /// 44 | /// Add and register the sever on Revit startup. 45 | /// 46 | public ExternalDBApplicationResult OnStartup(ControlledApplication application) 47 | { 48 | ExternalService plumbingFixtureService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePlumbingFixtureFlowService); 49 | Pipe.PlumbingFixtureFlowServer flowServer = new Pipe.PlumbingFixtureFlowServer(); 50 | if (plumbingFixtureService != null) 51 | plumbingFixtureService.AddServer(flowServer); 52 | 53 | ExternalService pipePressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.PipePressureDropService); 54 | Pipe.PipePressureDropServer pressureDropServer = new Pipe.PipePressureDropServer(); 55 | if (pipePressureDropService != null) 56 | pipePressureDropService.AddServer(pressureDropServer); 57 | 58 | ExternalService ductPressureDropService = ExternalServiceRegistry.GetService(ExternalServices.BuiltInExternalServices.DuctPressureDropService); 59 | Duct.DuctPressureDropServer ductPressureDropServer = new Duct.DuctPressureDropServer(); 60 | if (ductPressureDropService != null) 61 | ductPressureDropService.AddServer(ductPressureDropServer); 62 | 63 | return ExternalDBApplicationResult.Succeeded; 64 | } 65 | 66 | public ExternalDBApplicationResult OnShutdown(ControlledApplication application) 67 | { 68 | return ExternalDBApplicationResult.Succeeded; 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /UserMepCalculation.addin: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UserFittingAndAccessoryCalculationUIServers 5 | C:\a\vs\UserMepCalculation\DebugWin32\UserFittingAndAccessoryCalculationUIServers.dll 6 | 59050336-9e78-40c7-9a67-3274f0f61b07 7 | UserFittingAndAccessoryCalculationUIServers.ServerApp 8 | USER 9 | Autodesk, www.autodesk.com 10 | 11 | 12 | UserPressureLossReport 13 | C:\a\vs\UserMepCalculation\Debugx64\UserPressureLossReport.dll 14 | 4cd947a8-aae8-4652-b3f4-10279627811d 15 | UserPressureLossReport.UserPressureLossReportApplication 16 | USER 17 | Autodesk, www.autodesk.com 18 | 19 | 20 | UserFittingAndAccessoryCalculationServers 21 | C:\a\vs\UserMepCalculation\DebugWin32\UserFittingAndAccessoryCalculationServers.dll 22 | 2bbf7a50-33d7-4b4e-9eca-7666718eea56 23 | UserFittingAndAccessoryCalculationServers.ServerApp 24 | USER 25 | Autodesk, www.autodesk.com 26 | 27 | 28 | UserStraightSegmentCalculationServers 29 | C:\a\vs\UserMepCalculation\Debugx64\UserStraightSegmentCalculationServers.dll 30 | 7c8ef6bb-e00f-4de2-bf09-7a9a02c08633 31 | UserStraightSegmentCalculationServers.ServerApp 32 | USER 33 | Autodesk, www.autodesk.com 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /VSProps/RevitAdditions.CSharp.Addin.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | $(MSBuildAllProjects);$(SolutionDir)VSProps\RevitAdditions.CSharp.Addin.targets 7 | 8 | 9 | call $(SolutionDir)SignFile.bat $(TargetPath) 10 | $(SolutionDir)..\..\ThirdParty\RevitAPI\Identification\SignData\Release\SignData.exe $(TargetPath) $(SolutionDir)..\..\ThirdParty\RevitAPI\Identification\pair.dat INT 11 | perl $(SolutionDir)PostBuild.pl $(ProjectDir) $(TargetPath) $(Configuration) $(Platform) 12 | 13 | -------------------------------------------------------------------------------- /VSProps/RevitAdditions.CSharp.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | Release 4 | Win32 5 | AnyCPU 6 | $(MSBuildBinPath)\Microsoft.Csharp.targets 7 | $(SolutionDir)Intermediate\$(Configuration)$(Platform)\$(MSBuildProjectName)\ 8 | $(BaseIntermediateOutputPath) 9 | true 10 | full 11 | true 12 | 4 13 | 1668 14 | prompt 15 | AllRules.ruleset 16 | 17 | 18 | TRACE;$(DefineConstants) 19 | false 20 | $(SolutionDir)DebugWin32\ 21 | $(SolutionDir)DebugWin32 22 | 23 | 24 | TRACE;$(DefineConstants) 25 | true 26 | $(SolutionDir)ReleaseWin32\ 27 | $(SolutionDir)ReleaseWin32 28 | 29 | 30 | DEBUG;TRACE;$(DefineConstants) 31 | false 32 | $(SolutionDir)Slow_DebugWin32\ 33 | $(SolutionDir)Slow_DebugWin32 34 | 35 | 36 | TRACE;$(DefineConstants) 37 | false 38 | $(SolutionDir)Debugx64\ 39 | $(SolutionDir)Debugx64 40 | 41 | 42 | TRACE;$(DefineConstants) 43 | true 44 | $(SolutionDir)Releasex64\ 45 | $(SolutionDir)Releasex64 46 | 47 | 48 | DEBUG;TRACE;$(DefineConstants) 49 | false 50 | $(SolutionDir)Slow_Debugx64\ 51 | $(SolutionDir)Slow_Debugx64 52 | 53 | 54 | 61 | 1607 62 | 63 | 64 | 66 | 67 | $(MSBuildAllProjects);$(SolutionDir)VSProps\RevitAdditions.CSharp.targets 68 | 69 | 70 | perl $(SolutionDir)PostBuild.pl $(ProjectDir) $(TargetPath) $(Configuration) $(Platform) 71 | 72 | 73 | -------------------------------------------------------------------------------- /VSProps/RevitAdditions.PathDefinition.props: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | <_ProjectFileVersion>10.0.30319.1 14 | *.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.idb;*.pdb;*.ib*;$(ExtensionsToDeleteOnClean) 15 | $(SolutionDir)$(Configuration)$(PlatformName)\ 16 | $(SolutionDir)Intermediate\$(Configuration)$(PlatformName)\$(ProjectName)\ 17 | $(SolutionDir)$(Configuration)$(PlatformName)\ 18 | $(SolutionDir)Intermediate\$(Configuration)$(PlatformName)\$(ProjectName)\ 19 | $(SolutionDir)ThirdParty\ 20 | 21 | 22 | $(SolutionDir)DebugWin32 23 | $(SolutionDir)ThirdParty\ 24 | 25 | 26 | $(SolutionDir)ReleaseWin32 27 | $(SolutionDir)ThirdParty\ 28 | 29 | 30 | $(SolutionDir)Slow_DebugWin32 31 | $(SolutionDir)ThirdParty\ 32 | 33 | 34 | $(SolutionDir)Debugx64 35 | $(SolutionDir)ThirdParty64\ 36 | 37 | 38 | $(SolutionDir)Releasex64 39 | $(SolutionDir)ThirdParty64\ 40 | 41 | 42 | $(SolutionDir)Slow_Debugx64 43 | $(SolutionDir)ThirdParty64\ 44 | 45 | 46 | 47 | true 48 | 49 | 50 | %(AdditionalOptions) 51 | true 52 | 53 | 54 | $(OutDir);%(AdditionalLibraryDirectories) 55 | 56 | 57 | perl $(SolutionDir)PostBuild.pl $(ProjectDir) $(TargetPath) $(Configuration) $(Platform) 58 | 59 | 60 | 61 | $(IntDir)BuildLog.htm 62 | 63 | --------------------------------------------------------------------------------