added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F554DDCD-744E-4192-9448-0447A06E8AA9}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCE_7_10</RootNamespace>
<AssemblyName>ASCE-7-10</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="CodeChecking">
<HintPath>..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.Storage">
<HintPath>..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.Storage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.UI">
<HintPath>..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework">
<HintPath>..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework.UI">
<HintPath>..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPI">
<HintPath>..\..\..\..\..\References\Revit\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>..\..\..\..\..\References\Revit\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main\LoadCombination.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Main\RevitApplicationDB.cs" />
<Compile Include="Main\RevitApplicationUI.cs" />
<Compile Include="Server\Server.cs" />
<Compile Include="Server\ServerUI.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Addin\ASCE_7_10DB.addin" />
<Content Include="Addin\ASCE_7_10UI.addin" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if exist ..\..\..\..\..\..\..\Tools\BuildEvents\BuildEvents.exe (
..\..\..\..\..\..\..\Tools\BuildEvents\BuildEvents.exe prepare_example $(ProjectDir) $(TargetPath) ..\..\..\..\..\Bin\SDK\CodeChecking\VisualStudio\Examples\$(ProjectName)
)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="DBApplication">
<Name>ASCE_7_10</Name>
<Assembly>AssemblyPath</Assembly>
<AddInId>0908381c-1a11-48ee-9d3d-a5ddf0152903</AddInId>
<FullClassName>ASCE_7_10.RevitApplicationDB</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk,www.Autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>ASCE_7_10UI</Name>
<Assembly>AssemblyPath</Assembly>
<AddInId>acb459a9-5620-4297-9718-41f987a0c0b8</AddInId>
<FullClassName>ASCE_7_10.RevitApplicationUI</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk,www.Autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
namespace ASCE_7_10
{
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("LoadCombination", "68d87b7c-410e-4d19-a59f-1b6f0ded206a")]
public class LoadCombination : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
[SchemaProperty()]
[EnumControl(Presentation=PresentationMode.OptionList,
Item=PresentationItem.Text,
Category="General",
Description="Generation method"
)]
public GenerationMethod Method{get;set;}
public LoadCombination()
{
}
}
public enum GenerationMethod
{
ASD,
LRFD
}
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
namespace ASCE_7_10
{
public class RevitApplicationDB : Autodesk.Revit.DB.IExternalDBApplication
{
#region IExternalDBApplication Members
public Autodesk.Revit.DB.ExternalDBApplicationResult OnShutdown(Autodesk.Revit.ApplicationServices.ControlledApplication application)
{
return Autodesk.Revit.DB.ExternalDBApplicationResult.Succeeded;
}
public Autodesk.Revit.DB.ExternalDBApplicationResult OnStartup(Autodesk.Revit.ApplicationServices.ControlledApplication application)
{
application.ApplicationInitialized += new EventHandler<Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs>(application_ApplicationInitialized);
return Autodesk.Revit.DB.ExternalDBApplicationResult.Succeeded;
}
void application_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
{
Server server = new Server();
Autodesk.Revit.DB.CodeChecking.LoadCombination.Service.AddServer(server);
}
#endregion
}
}
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ASCE_7_10
{
class RevitApplicationUI : Autodesk.Revit.UI.IExternalApplication
{
#region IExternalApplication Members
public Autodesk.Revit.UI.Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
{
return Autodesk.Revit.UI.Result.Succeeded;
}
public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
{
ServerUI server = new ServerUI();
Autodesk.Revit.UI.CodeChecking.LoadCombination.ServiceUI.BindUIServerWithDBServer(Server.ID, server);
return Autodesk.Revit.UI.Result.Succeeded;
}
#endregion
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ASCE_7_10")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Autodesk, Inc.")]
[assembly: AssemblyProduct("ASCE_7_10")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a723a5fb-f3f9-48ca-8a1a-96026e50ccf6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2015.0.0.0")]
[assembly: AssemblyFileVersion("2015.0.0.2464")]
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASCE_7_10.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCE_7_10.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Storage.LoadCombination;
using Autodesk.Revit.DB.CodeChecking.LoadCombination;
using Autodesk.Revit.DB.Structure;
namespace ASCE_7_10
{
public class Server : Autodesk.Revit.DB.CodeChecking.LoadCombination.Server<LoadCombination>
{
public static readonly Guid ID = new Guid("34ce88f1-b265-4ab3-a8c2-ff6a49aef797");
#region ICodeCheckingServer Members
public override List<LoadCombinationPreview> GeneratePreview(Autodesk.Revit.DB.CodeChecking.LoadCombination.ServiceData data)
{
LoadCombinationManager manager = LoadCombinationManager.GetManager(data.Document);
LoadCombination loadCombination = manager.LoadCombinationParams.GetEntity<LoadCombination>(data.Document);
if (loadCombination != null)
{
List<LoadCombinationPreview> combinations = new List<LoadCombinationPreview>();
LoadCaseArray selectedCases = manager.LoadCombinationParams.GetLoadCasesArray(ID);
Dictionary<BuiltInCategory,LoadCaseArray> groups = LoadCombinationUtils.GroupLoadCasesDueToCategory(selectedCases);
List<LoadCaseArray> dead = LoadCombinationUtils.PerformAnd(groups[BuiltInCategory.OST_LoadCasesDead]);
List<LoadCaseArray> earthquake = LoadCombinationUtils.PerformOrExlusive(groups[BuiltInCategory.OST_LoadCasesSeismic]);
List<LoadCaseArray> live = LoadCombinationUtils.PerformOrInclusive(groups[BuiltInCategory.OST_LoadCasesLive]);
List<LoadCaseArray> roof = LoadCombinationUtils.PerformOrInclusive(groups[BuiltInCategory.OST_LoadCasesRoofLive]);
List<LoadCaseArray> snow = LoadCombinationUtils.PerformOrExlusive(groups[BuiltInCategory.OST_LoadCasesSnow]);
List<LoadCaseArray> wind = LoadCombinationUtils.PerformOrExlusive(groups[BuiltInCategory.OST_LoadCasesWind]);
List<LoadCombinationPreview> previews;
if (loadCombination.Method == GenerationMethod.LRFD)
{
//1.4D
previews = LoadCombinationUtils.CreateLoadCombinations("1.4D", dead, 1.4);
combinations.AddRange(previews);
//1.2D+1.6l+0.5(Lr or S)
//+ 1.2D+1.6L+0.5Lr
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6L+0.5Lr", dead, 1.2, live, 1.6, roof, 0.5);
combinations.AddRange(previews);
//+ 1.2D+1.6L+0.5S
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6L+0.5S", dead, 1.2, live, 1.6, snow, 0.5);
combinations.AddRange(previews);
//1.2D+1.6(Lr or S) + (L or 0.5W)
//+1.2D+1.6Lr + L
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6Lr + L",dead, 1.2, roof, 1.6, live, 1.0);
combinations.AddRange(previews);
//+1.2D+1.6Lr + 0.5W
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6Lr + 0.5W",dead, 1.2, roof, 1.6, wind, 0.5);
combinations.AddRange(previews);
//+1.2D+1.6S + L
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6S + L",dead, 1.2, snow, 1.6, live, 1.0);
combinations.AddRange(previews);
//+1.2D+1.6S + 0.5W
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.6S + 0.5W", dead, 1.2, snow, 1.6, wind, 0.5);
combinations.AddRange(previews);
//1.2D+1.0W+L+0.5(Lr or S)
//+1.2D+1.0W+L+0.5Lr
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.0W+L+0.5Lr",dead, 1.2, wind, 1.0, live, 1.0,roof,0.5);
combinations.AddRange(previews);
//+1.2D+1.0W+L+0.5S
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.0W+L+0.5S",dead, 1.2, wind, 1.0, live, 1.0, snow, 0.5);
combinations.AddRange(previews);
//1.2D+1.0E+L+0.2S
previews = LoadCombinationUtils.CreateLoadCombinations("1.2D+1.0E+L+0.2S", dead, 1.2, earthquake, 1.0, live, 1.0, snow, 0.2);
combinations.AddRange(previews);
//0.9D+1.0W
previews = LoadCombinationUtils.CreateLoadCombinations("0.9D+1.0W",dead, 0.9, wind, 1.0);
combinations.AddRange(previews);
//0.9D+1.0E
previews = LoadCombinationUtils.CreateLoadCombinations("0.9D+1.0E", dead, 0.9, earthquake, 1.0);
combinations.AddRange(previews);
}
else
{
//D
previews = LoadCombinationUtils.CreateLoadCombinations("D", dead, 1.0);
combinations.AddRange(previews);
//D+L
previews = LoadCombinationUtils.CreateLoadCombinations("D+L", dead, 1.0,live,1.0);
combinations.AddRange(previews);
//D+(Lr or S)
//+D+Lr
previews = LoadCombinationUtils.CreateLoadCombinations("D+Lr", dead, 1.0, roof,1.0);
combinations.AddRange(previews);
//+D+S
previews = LoadCombinationUtils.CreateLoadCombinations("D+S", dead, 1.0, snow, 1.0);
combinations.AddRange(previews);
//D+0.75L+0.75(Lr or S)
//+D+0.75L+0.75Lr
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.75L+0.75Lr", dead, 1.0, live, 0.75,roof,0.75);
combinations.AddRange(previews);
//+D+0.75L+0.75S
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.75L+0.75S", dead, 1.0, live, 0.75, snow, 0.75);
combinations.AddRange(previews);
//D+(0.6W or 0.7E)
//D+0.6W
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.6W", dead, 1.0, wind, 0.6);
combinations.AddRange(previews);
//D+0.7E
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.7E", dead, 1.0, earthquake, 0.7);
combinations.AddRange(previews);
//D+0.75(0.6W)+0.75L+0.75(Lr or S)
//+D+0.75(0.6W)+0.75L+0.75Lr
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.75(0.6W)+0.75L+0.75Lr", dead, 1.0, wind, 0.75*0.6,live,0.75,roof,0.75);
combinations.AddRange(previews);
//+D+0.75(0.6W)+0.75L+0.75S
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.75(0.6W)+0.75L+0.75S", dead, 1.0, wind, 0.75 * 0.6, live, 0.75, snow, 0.75);
combinations.AddRange(previews);
//D+0.75(0.7E)+0.75L+0.75S
previews = LoadCombinationUtils.CreateLoadCombinations("D+0.75(0.7E)+0.75L+0.75S", dead, 1.0, earthquake, 0.75 * 0.7, live, 0.75, snow, 0.75);
combinations.AddRange(previews);
//0.6D+0.6W
previews = LoadCombinationUtils.CreateLoadCombinations("0.6D+0.6W", dead, 0.6, wind, 0.6);
combinations.AddRange(previews);
//0.6D+0.7E
previews = LoadCombinationUtils.CreateLoadCombinations("0.6D+0.7E", dead, 0.6, earthquake, 0.7);
combinations.AddRange(previews);
}
return combinations;
}
return null;
}
public override bool RemoveLoadCombinations()
{
return true;
}
#endregion
#region IExternalServer Members
public override string GetDescription()
{
return "This is the code which generate load combinations according ASCE-7-10";
}
public override string GetName()
{
return "ASCE-7-10";
}
public override Guid GetServerId()
{
return ID;
}
public override string GetVendorId()
{
return "John Smith";
}
#endregion
}
}
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
namespace ASCE_7_10
{
public class ServerUI : Autodesk.Revit.UI.CodeChecking.LoadCombination.Server<LoadCombination>
{
#region ICodeCheckingServerUI Members
public override string GetResource(string key, string context)
{
string txt = ASCE_7_10.Properties.Resources.ResourceManager.GetString(key);
if (!string.IsNullOrEmpty(txt))
return txt;
return key;
}
public override Uri GetResourceImage(string key, string context)
{
return new Uri(@"pack://application:,,,/ASCE_7_10;component/" + key);
}
#endregion
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="DBApplication">
<Name>CodeCheckingConcreteExample</Name>
<Assembly>AssemblyPath</Assembly>
<AddInId>df183cdb-4099-458c-ac59-4f27302eb40d</AddInId>
<FullClassName>CodeCheckingConcreteExample.RevitApplicationDB</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.Autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>CodeCheckingConcreteExample (UI)</Name>
<Assembly>AssemblyPath</Assembly>
<AddInId>0915e7b9-3fc5-42f9-a082-bf43e5d56071</AddInId>
<FullClassName>CodeCheckingConcreteExample.RevitApplicationUI</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.Autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,63 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
namespace CodeCheckingConcreteExample
{
#pragma warning disable 1591
public class RevitApplicationDB : Autodesk.Revit.DB.IExternalDBApplication
{
#region IExternalDBApplication Members
public Autodesk.Revit.DB.ExternalDBApplicationResult OnShutdown(Autodesk.Revit.ApplicationServices.ControlledApplication application)
{
return Autodesk.Revit.DB.ExternalDBApplicationResult.Succeeded;
}
public Autodesk.Revit.DB.ExternalDBApplicationResult OnStartup(Autodesk.Revit.ApplicationServices.ControlledApplication application)
{
application.ApplicationInitialized += new EventHandler<Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs>(application_ApplicationInitialized);
return Autodesk.Revit.DB.ExternalDBApplicationResult.Succeeded;
}
void application_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
{
Server.Server server = new Server.Server();
Autodesk.Revit.DB.CodeChecking.Service.AddServer(server);
//Updater updater = new Updater();
//UpdaterRegistry.RegisterUpdater(updater);
//UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), new ElementClassFilter(typeof(FamilyInstance)), Element.GetChangeTypeGeometry());
}
#endregion
}
}
@@ -0,0 +1,48 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample
{
class RevitApplicationUI : Autodesk.Revit.UI.IExternalApplication
{
#region IExternalApplication Members
public Autodesk.Revit.UI.Result OnShutdown(Autodesk.Revit.UI.UIControlledApplication application)
{
return Autodesk.Revit.UI.Result.Succeeded;
}
public Autodesk.Revit.UI.Result OnStartup(Autodesk.Revit.UI.UIControlledApplication application)
{
Server.ServerUI server = new Server.ServerUI();
Autodesk.Revit.UI.CodeChecking.ServiceUI.BindUIServerWithDBServer(Server.Server.ID, server);
return Autodesk.Revit.UI.Result.Succeeded;
}
#endregion
}
}
@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{FE7A0A20-C19E-40F9-BEFE-8C30C1CF0D56}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CodeCheckingConcreteExample</RootNamespace>
<AssemblyName>CodeCheckingConcreteExample</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<NoWarn>1587 1570</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\CodeCheckingConcreteExample.XML</DocumentationFile>
<NoWarn>1587</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="CodeChecking">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.Documentation">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.Documentation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.Engineering">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Engineering\CodeChecking.Engineering.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.Storage">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.Storage.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="CodeChecking.UI">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Platform\CodeChecking.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework">
<HintPath>..\..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework.Documentation">
<HintPath>..\..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.Documentation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework.UI">
<HintPath>..\..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.UI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ExtensibleStorageFramework.UI.WPF">
<HintPath>..\..\..\..\..\..\References\ExtensibleStorageFramework\ExtensibleStorageFramework.UI.WPF.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="rcuapiNET">
<HintPath>..\..\..\..\..\..\References\CodeChecking\Engineering\rcuapiNET.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ResultsBuilder">
<HintPath>..\..\..\..\..\..\References\ResultsBuilder\ResultsBuilder.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPI">
<HintPath>..\..\..\..\..\..\References\Revit\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>..\..\..\..\..\..\References\Revit\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Concrete\CalculationUtility.cs" />
<Compile Include="Concrete\ConcreteSectionDesign.cs" />
<Compile Include="Concrete\InternalForcesContainer.cs" />
<Compile Include="Concrete\InternalForcesBase.cs" />
<Compile Include="Concrete\InternalForcesLinear.cs" />
<Compile Include="Concrete\InternalForcesSurface.cs" />
<Compile Include="Concrete\RcTypes.cs" />
<Compile Include="Concrete\RcVerificationHelperUtility.cs" />
<Compile Include="Concrete\Reinforcement.cs" />
<Compile Include="Engine\CommonParametersBase.cs" />
<Compile Include="Engine\ElementDataBase.cs" />
<Compile Include="Engine\Engine.cs" />
<Compile Include="Engine\ICalculationObject.cs" />
<Compile Include="Engine\ICalculationScenario.cs" />
<Compile Include="Engine\IEngineData.cs" />
<Compile Include="Engine\ObjectDataBase.cs" />
<Compile Include="Engine\SectionDataBase.cs" />
<Compile Include="Main\CalculationParameter.cs" />
<Compile Include="Main\Calculation\BeamElement.cs" />
<Compile Include="Main\Calculation\BeamSection.cs" />
<Compile Include="Main\Calculation\ColumnElement.cs" />
<Compile Include="Main\Calculation\ColumnSection.cs" />
<Compile Include="Main\Calculation\CommonParameters.cs" />
<Compile Include="Main\Calculation\EngineData.cs" />
<Compile Include="Main\Calculation\CalculationObjects.cs" />
<Compile Include="Main\Calculation\CalculationScenario.cs" />
<Compile Include="Main\Calculation\FloorElement.cs" />
<Compile Include="Main\Calculation\FloorSection.cs" />
<Compile Include="Main\Calculation\LinearSection.cs" />
<Compile Include="Main\Calculation\SurfaceSection.cs" />
<Compile Include="Main\Calculation\WallElement.cs" />
<Compile Include="Main\Calculation\WallSection.cs" />
<Compile Include="Main\LabelBeam.cs" />
<Compile Include="Main\LabelColumn.cs" />
<Compile Include="Main\LabelFloor.cs" />
<Compile Include="Main\LabelWall.cs" />
<Compile Include="Main\ResultBeam.cs" />
<Compile Include="Main\ResultColumn.cs" />
<Compile Include="Main\ResultFloor.cs" />
<Compile Include="Main\ResultLinearElement.cs" />
<Compile Include="Main\ResultSurfaceElement.cs" />
<Compile Include="Main\ResultWall.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Application\RevitApplicationDB.cs" />
<Compile Include="Application\RevitApplicationUI.cs" />
<Compile Include="Server\Server.cs" />
<Compile Include="Server\ServerResultsLinear.cs" />
<Compile Include="Server\ServerResultsSurface.cs" />
<Compile Include="Server\ServerUI.cs" />
<Compile Include="Updater\Updater.cs" />
<Compile Include="UIComponents\CalculationPointsSelector\CalculationPointsSelectorAttribute.cs" />
<Compile Include="UIComponents\CalculationPointsSelector\CalculationPointsSelectorSchema.cs" />
<Compile Include="UIComponents\CalculationPointsSelector\CalculationPointsSelectorServerUI.cs" />
<Compile Include="UIComponents\RCSteelParameters\RCSteelParametersAttribute.cs" />
<Compile Include="UIComponents\RCSteelParameters\RCSteelParametersSchema.cs" />
<Compile Include="UIComponents\RCSteelParameters\RCSteelParametersServerUI.cs" />
<Compile Include="Utility\MapDataGenerator.cs" />
<Compile Include="Utility\ResultInPointLinear.cs" />
<Compile Include="Utility\ResultInPointSurface.cs" />
<Compile Include="Utility\UnitsConverter.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Addin\CodeCheckingConcreteExampleDB.addin" />
<Content Include="Addin\CodeCheckingConcreteExampleUI.addin" />
<Content Include="UIComponents\Icons\BFX_64.png" />
<Content Include="UIComponents\Icons\BFY_64.png" />
<Content Include="UIComponents\Icons\BFZ_64.png" />
<Content Include="UIComponents\Icons\BMX_64.png" />
<Content Include="UIComponents\Icons\BMY_64.png" />
<Content Include="UIComponents\Icons\BMZ_64.png" />
<Content Include="UIComponents\Icons\CFX_64.png" />
<Content Include="UIComponents\Icons\CFY_64.png" />
<Content Include="UIComponents\Icons\CFZ_64.png" />
<Content Include="UIComponents\Icons\CMX_64.png" />
<Content Include="UIComponents\Icons\CMY_64.png" />
<Content Include="UIComponents\Icons\CMZ_64.png" />
<Resource Include="UIComponents\Icons\WFX_32.png" />
<Content Include="UIComponents\Icons\WFX_64.png" />
<Resource Include="UIComponents\Icons\WFY_32.png" />
<Content Include="UIComponents\Icons\WFY_64.png" />
<Resource Include="UIComponents\Icons\WMY_32.png" />
<Content Include="UIComponents\Icons\WMY_64.png" />
<Resource Include="UIComponents\Icons\FMY_32.png" />
<Content Include="UIComponents\Icons\FMY_64.png" />
<Content Include="UIComponents\Icons\FFX_64.png" />
<Resource Include="UIComponents\Icons\FFX_32.png" />
<Resource Include="UIComponents\Icons\buckling.png" />
<Resource Include="UIComponents\Icons\BFX_32.png" />
<Resource Include="UIComponents\Icons\BFY_32.png" />
<Resource Include="UIComponents\Icons\BFZ_32.png" />
<Resource Include="UIComponents\Icons\BMX_32.png" />
<Resource Include="UIComponents\Icons\BMY_32.png" />
<Resource Include="UIComponents\Icons\BMZ_32.png" />
<Resource Include="UIComponents\Icons\CFX_32.png" />
<Resource Include="UIComponents\Icons\CFY_32.png" />
<Resource Include="UIComponents\Icons\CFZ_32.png" />
<Resource Include="UIComponents\Icons\CMX_32.png" />
<Resource Include="UIComponents\Icons\CMY_32.png" />
<Resource Include="UIComponents\Icons\CMZ_32.png" />
<Resource Include="UIComponents\Icons\BWithSlabBeamInteraction.png" />
<Resource Include="UIComponents\Icons\BWithoutSlabBeamInteraction.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if exist ..\..\..\..\..\..\..\..\Tools\BuildEvents\BuildEvents.exe (
..\..\..\..\..\..\..\..\Tools\BuildEvents\BuildEvents.exe prepare_example $(ProjectDir) $(TargetPath) ..\..\..\..\..\..\Bin\SDK\CodeChecking\VisualStudio\Examples\Concrete\$(ProjectName)
)</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,280 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Linq;
namespace CodeCheckingConcreteExample.Concrete
{
static class CalculationUtility
{
/// <summary>
/// The smallest positive value of force treated as non-zero value.
/// </summary>
private const double toleranceForN = 1.0;
/// <summary>
/// The smallest positive value of moment treated as non-zero value.
/// </summary>
private const double toleranceForM = 1.0;
/// <summary>
/// The smallest positive value of reinforcement treated as non-zero value.
/// </summary>
private const double toleranceForAs = 1.0e-7;
/// <summary>
/// The tolerance for safety factor. The final coefficient should not deviate from the values 1.0 of more than toleranceForSafetyFactor
/// </summary>
private const double toleranceForSafetyFactor = 0.005;
/// <structural_toolkit_2015>
/// <summary>
/// The smallest value of reinforcement for the iterative loops.
/// </summary>
private const double minimumAsIncrease = 10.0 * toleranceForAs;
/// <structural_toolkit_2015>
/// <summary>
/// The lowest acceptable safety factor in the iterative loops.
/// </summary>
private const double minSafetyFactor = 1.0 - toleranceForSafetyFactor;
/// <summary>
/// The biggest acceptable safety factor in the iterative loops.
/// </summary>
private const double maxSafetyFactor = 1.0 + toleranceForSafetyFactor;
/// <summary>
/// The maximum of steps in the iterative loops.
/// </summary>
private const int maximumIterationStep = 100;
/// <summary>
/// Checks with internal accuracy if reinforcement area equals zero
/// </summary>
/// <param name="totalSteelArea">Tested reinforcement area</param>
/// <returns>True if reinforcement is below margin</returns>
static public bool IsZeroReinforcement(double totalSteelArea)
{
if (totalSteelArea > toleranceForAs)
return false;
else
return true;
}
/// <structural_toolkit_2015>
/// <summary>
/// Returns value of minimum increase of reinforcement in the iterative step.
/// </summary>
/// <returns>Minimal reinforcement value</returns>
static public double MinimumIncreaseOfReinforcement()
{
return minimumAsIncrease;
}
/// </structural_toolkit_2015>
/// <summary>
/// Checks with internal accuracy if force equals zero
/// </summary>
/// <param name="n">Tested force value</param>
/// <returns>True if force is below margin zero</returns>
static public bool IsZeroN(double n)
{
if (Math.Abs(n) > toleranceForN)
return false;
else
return true;
}
/// <summary>
/// Checks with internal accuracy if force is greater than zero
/// </summary>
/// <param name="n">Tested force value</param>
/// <returns>True if force is greater than zero</returns>
static public bool GtZeroN(double n)
{
if (n > Double.Epsilon)
return true;
else
return false;
}
/// <summary>
/// Checks with internal accuracy if force is less than zero
/// </summary>
/// <param name="n">Tested force value</param>
/// <returns>True if force is less than zero</returns>
static public bool LtZeroN(double n)
{
if (n < -Double.Epsilon)
return true;
else
return false;
}
/// <summary>
/// Checks with internal accuracy if moment equals zero
/// </summary>
/// <param name="m">Tested moment value</param>
/// <returns>True if moment is below margin zero</returns>
static public bool IsZeroM(double m)
{
if (Math.Abs(m) > toleranceForM)
return false;
else
return true;
}
/// <summary>
/// Checks with internal accuracy if moment is greater than zero
/// </summary>
/// <param name="m">Tested moment value</param>
/// <returns>True if moment is greater than zero</returns>
static public bool GtZeroM(double m)
{
if (m > Double.Epsilon)
return true;
else
return false;
}
/// <summary>
/// Checks with internal accuracy if moment is less than zero
/// </summary>
/// <param name="m">Tested moment value</param>
/// <returns>True if moment is less than zero</returns>
static public bool LtZeroM(double m)
{
if (m < -Double.Epsilon)
return true;
else
return false;
}
/// <summary>
/// Checks if number of iterations exceeded arbitrary maximum number of iterations
/// </summary>
/// <param name="i">Tested number of iterations</param>
/// <returns>True if number of iterations exceeded maximum</returns>
static public bool IsIterEnd(int i)
{
if (i < maximumIterationStep)
return false;
else
return true;
}
/// <summary>
/// Checks if safety factor is above arbitrary minimum
/// </summary>
/// <param name="safetyFactor">Tested safety factor value</param>
/// <returns>True if safety factor is above minimum</returns>
static public bool IsSafety(double safetyFactor)
{
return (safetyFactor >= minSafetyFactor);
}
/// <summary>
/// Checks whether safety factor is within limits of optimal level
/// </summary>
/// <param name="safetyFactor">Tested safety factor value</param>
/// <returns>True if safety factor on optimal level</returns>
static public bool IsSafetyOptimal(double safetyFactor)
{
return (safetyFactor >= minSafetyFactor) && (safetyFactor <= maxSafetyFactor);
}
/// <summary>
/// Returns the value linear function defined by two points in a given point
/// </summary>
/// <param name="x1">x coordinate of the first definition point</param>
/// <param name="y1">y coordinate of the first definition point</param>
/// <param name="x2">x coordinate of the second definition point</param>
/// <param name="y2">y coordinate of the second definition point</param>
/// <param name="x3">x coordinate for which function value is searched</param>
/// <returns>Value (y coordinate) of function</returns>
static public double ValueOfLinearFunction(double x1, double y1, double x2, double y2, double x3)
{
double y3 = float.MaxValue;
if (Math.Abs(x1 - x2) > float.MaxValue)
{
y3 = y1 + (x3 - x1) * (y2 - y1) / (x2 - x1);
}
else if (Math.Abs(y1 - y2) < float.MaxValue)
{
y3 = 0.5 * (y1 + y2);
}
return y3;
}
/// <summary>
/// Finds roots of quadratic equation
/// </summary>
/// <param name="a">equation first parameter</param>
/// <param name="b">equation second parameter</param>
/// <param name="c">equation third parameter</param>
/// <param name="x1">reference to the first root value</param>
/// <param name="x2">reference to the second root value</param>
/// <returns>false if equation has no roots</returns>
static public bool RootsOfQuadraticEquation(double a, double b, double c, ref double x1, ref double x2)
{
bool realRoots = true;
double delta = b * b - 4.0 * a * c;
if (delta < 0)
{
x1 = x2 = Double.NaN;
realRoots = false;
}
else
{
delta = Math.Sqrt(delta);
x1 = (-b + delta) / (2.0 * a);
x2 = (-b - delta) / (2.0 * a);
}
return realRoots;
}
/// <summary>
/// Function created XML format file if rcuapiNet component thrown the exception.
/// File will be created in current user TEMP path. This file will be useful to debug the rcuapiNet.
/// The rcuapiNETSerializer.dll component is necessary.
/// rcuapiNETSerializer.dll and rcuapiNET.dll should be in the same localization.
/// </summary>
/// <param name="exception">The exceprtion from rcuapiNET.dll</param>
static public void SerializeIRCException(Autodesk.CodeChecking.Concrete.IRCException exception)
{
String assemblyName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + "rcuapiNETSerializer.dll";
if (System.IO.File.Exists(assemblyName))
{
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(assemblyName);
Type serializerType = assembly.GetTypes().First(s => s.FullName == "Autodesk.CodeChecking.ConcreteSerializer.Serializer");
System.Reflection.MethodInfo serializeMethod = serializerType.GetMethod("Serialize");
object serializedDoc = serializeMethod.Invoke(null, new object[] { exception });
string docTitle = System.IO.Path.GetTempPath() + "IRCException" + DateTime.Now.Ticks + "_" + System.Threading.Thread.CurrentThread.ManagedThreadId + ".rcx";
(serializedDoc as System.Xml.Linq.XDocument).Save(docTitle);
}
}
}
}
@@ -0,0 +1,61 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.Concrete
{
/// <summary>
/// Base class for internal forces in different structural elements
/// </summary>
abstract class InternalForcesBase
{
/// <summary>
/// Creates default InternalForcesBase
/// </summary>
protected InternalForcesBase() { }
/// <summary>
/// Get or set number of the related load case
/// </summary>
int RelatedCaseId
{
get { return relatedCaseId; }
set { relatedCaseId = value; }
}
/// <summary>
/// Get or set number of the related point
/// </summary>
int RelatedPointId
{
get { return relatedPointId; }
set { relatedPointId = value; }
}
private int relatedCaseId;
private int relatedPointId;
}
}
@@ -0,0 +1,101 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
namespace CodeCheckingConcreteExample.Concrete
{
/// <summary>
/// Simple container class for all possible internal forces in section
/// </summary>
public class InternalForcesContainer
{
/// <summary>
/// Initializes a new instance of InternalForcesContainer object with default 0.0 values.
/// </summary>
public InternalForcesContainer()
{
ForceFx = 0.0; ForceFy = 0.0; ForceFz = 0.0; MomentMx = 0.0; MomentMy = 0.0; MomentMz = 0.0; DeflectionUx = 0.0; DeflectionUy = 0.0; DeflectionUz = 0.0;
LimitState = ForceLimitState.Unknown;
CaseName = "";
}
/// <summary>
/// Gets or sets the force Fx (axial force).
/// </summary>
public double ForceFx { get; set; }
/// <summary>
/// Gets or sets the force Fy.
/// </summary>
public double ForceFy { get; set; }
/// <summary>
/// Gets or sets the force Fz (main shear force).
/// </summary>
public double ForceFz { get; set; }
/// <summary>
/// Gets or sets the moment Mz (torsion moment).
/// </summary>
public double MomentMx { get; set; }
/// <summary>
/// Gets or sets the moment My (main bending moment).
/// </summary>
public double MomentMy { get; set; }
/// <summary>
/// Gets or sets the moment My (main bending moment).
/// </summary>
public double MomentMz { get; set; }
/// <summary>
/// Gets or sets deflection Ux
/// </summary>
public double DeflectionUx { get; set; }
/// <summary>
/// Gets or sets deflection Uy
/// </summary>
public double DeflectionUy { get; set; }
/// <summary>
/// Gets or sets deflection Uz
/// </summary>
public double DeflectionUz { get; set; }
/// <summary>
/// Gets or sets the limit state.
/// </summary>
public ForceLimitState LimitState { get; set; }
/// <summary>
/// Gets or sets description of combination or case.
/// </summary>
public string CaseName { get; set; }
}
}
@@ -0,0 +1,49 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
namespace CodeCheckingConcreteExample.Concrete
{
/// <summary>
/// Class for internal forces in linear elements
/// </summary>
class InternalForcesLinear : InternalForcesBase
{
/// <summary>
/// Creates default
/// </summary>
public InternalForcesLinear()
{
Forces = new InternalForcesContainer();
}
/// <summary>
/// Gets or sets forces container
/// </summary>
public InternalForcesContainer Forces { get; set; }
}
}
@@ -0,0 +1,77 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Concrete
{
class InternalForcesSurface : InternalForcesBase
{
public InternalForcesSurface()
{
ForceFxx = 0.0; ForceFyy = 0.0; ForceFxy = 0.0;
MomentMxx = 0.0; MomentMyy = 0.0; MomentMxy = 0.0;
LimitState = ForceLimitState.Unknown;
ForceDescription = "";
}
public InternalForcesContainer Forces(ConcreteTypes.DimensioningDirection direction)
{
InternalForcesContainer forces = new InternalForcesContainer();
forces.CaseName = ForceDescription;
forces.LimitState = LimitState;
if (direction == ConcreteTypes.DimensioningDirection.X)
{
forces.ForceFx = -ForceFxx; // Due to ResultBuilder conventions of the forces sign.
forces.MomentMy = -MomentMxx; // Due to ResultBuilder conventions of the forces sign.
forces.ForceFz = ForceQxx;
}
else
{
forces.ForceFx = -ForceFyy; // Due to ResultBuilder conventions of the forces sign.
forces.MomentMy = -MomentMyy; // Due to ResultBuilder conventions of the forces sign.
forces.ForceFz = ForceQyy;
}
return forces;
}
public double ForceFxx { get; set; }
public double ForceFyy { get; set; }
public double ForceFxy { get; set; }
public double MomentMxx { get; set; }
public double MomentMyy { get; set; }
public double MomentMxy { get; set; }
public double ForceQxx { get; set; }
public double ForceQyy { get; set; }
public ForceLimitState LimitState { get; set; }
public string ForceDescription { get; set; }
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,240 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System.Collections.Generic;
namespace CodeCheckingConcreteExample
{
namespace ConcreteTypes // todo: move this class to a new project file
{
/// <summary>
/// Classification of available forces
/// </summary>
public enum EnabledInternalForces
{
/// <summary>
/// Axial force. The force acting along the element.
/// </summary>
FX = 0x01,
/// <summary>
/// Shear force. The force acting perpendicular to the element, along Y axia.
/// </summary>
FY = 0x02,
/// <summary>
/// Shear force. The force acting perpendicular to the element along Z axis.
/// </summary>
FZ = 0x04,
/// <summary>
/// Torsional moment.
/// </summary>
MX = 0x08,
/// <summary>
/// Bending moment. Bending around the Y axis.
/// </summary>
MY = 0x10,
/// <summary>
/// Bending moment. Bending around the Z axis.
/// </summary>
MZ = 0x20,
}
/// <structural_toolkit_2015>
/// <summary>
/// Classification of forces direction in the plain object
/// </summary>
public enum DimensioningDirection
{
/// <summary>
/// Main dirction.
/// </summary>
X,
/// <summary>
/// Secondary direction, ortogonal to main.
/// </summary>
Y
}
/// </structural_toolkit_2015>
/// <summary>
/// Classification of typical designs. Design is based on classification of acting forces.
/// </summary>
public enum CalculationType
{
/// <summary>
/// Default value
/// </summary>
Unspecified = 0,
/// <summary>
/// The design of longitudinal reinforcement should be based on full set of forces.
/// </summary>
LongAll = EnabledInternalForces.FX | EnabledInternalForces.MY | EnabledInternalForces.MZ,
/// <summary>
/// Simple bending. Around Y axis.
/// </summary>
BendingY = EnabledInternalForces.MY,
/// <summary>
/// Eccentricyty bending. Axial force and bending around Y axis.
/// </summary>
EccentricBendingY = EnabledInternalForces.FX | EnabledInternalForces.MY,
/// <summary>
/// Simple compression.
/// </summary>
AxialForce = EnabledInternalForces.FX,
/// <summary>
/// The design of transversal reinforcement should be based on full set of forces.
/// </summary>
TransAll = EnabledInternalForces.FY | EnabledInternalForces.FZ | EnabledInternalForces.MX,
/// <summary>
/// Simple shearing.
/// </summary>
ShearingZ = EnabledInternalForces.FZ,
/// <summary>
/// Simple torsion.
/// </summary>
Torsion = EnabledInternalForces.MX,
/// <summary>
/// Simple torsion.
/// </summary>
TorsionWithShearingZ = EnabledInternalForces.FZ | EnabledInternalForces.MX,
}
/// <summary>
/// Type of beam section
/// </summary>
public enum BeamSectionType
{
/// <summary>
/// Section with slab interaction
/// </summary>
WithSlabBeamInteraction,
/// <summary>
/// Section without slab interaction
/// </summary>
WithoutSlabBeamInteraction
}
/// <summary>
/// Type of column structure type
/// </summary>
public enum ColumnStructureType
{
/// <summary>
/// Sway structure
/// </summary>
Sway,
/// <summary>
/// Non-sway structure
/// </summary>
NonSway
}
/// <summary>
/// Converter class
/// </summary>
public static class CalculationTypeHelper
{
/// <summary>
/// Converts a number of EnabledInternalForces flags into CalculationType value indicating type of normal forces
/// </summary>
/// <param name="enabledInternalForces">Collection of EnabledInternalForces flags</param>
/// <returns>CalculationType value describing normal forces in section</returns>
public static CalculationType GetLongitudinalCalculationType( this IEnumerable<EnabledInternalForces> enabledInternalForces)
{
int val = 0;
foreach (CalculationType calculationType in enabledInternalForces)
{
if ((calculationType & CalculationType.LongAll) != 0)
{
val |= (int)calculationType;
}
}
return (CalculationType)val;
}
/// <summary>
/// Converts a number of EnabledInternalForces flags into CalculationType value indicating type of normal transversal forces
/// </summary>
/// <param name="enabledInternalForces">Collection of EnabledInternalForces flags</param>
/// <returns>CalculationType value describing transversal forces in section</returns>
public static CalculationType GetTransversalCalculationType(this IEnumerable<EnabledInternalForces> enabledInternalForces)
{
int val = 0;
foreach (CalculationType calculationType in enabledInternalForces)
{
if ((calculationType & CalculationType.TransAll) != 0)
{
val |= (int)calculationType;
}
}
return (CalculationType)val;
}
/// <structural_toolkit_2015>
/// <summary>
/// Convertion into ForceType
/// </summary>
/// <param name="enabledForce">EnabledForce to be converted</param>
/// <param name="category">Type of element as BuiltInCategory</param>
/// <returns>Forces type as ForceType</returns>
public static Autodesk.Revit.DB.CodeChecking.Engineering.ForceType GetForceType(this EnabledInternalForces enabledForce, Autodesk.Revit.DB.BuiltInCategory category = Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical )
{
switch( category )
{
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
{
switch (enabledForce)
{
default: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Unknown;
case EnabledInternalForces.FX: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Fx;
case EnabledInternalForces.FY: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Fy;
case EnabledInternalForces.FZ: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Fz;
case EnabledInternalForces.MX: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Mx;
case EnabledInternalForces.MY: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.My;
case EnabledInternalForces.MZ: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Mz;
}
}
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
switch (enabledForce)
{
default: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Unknown;
case EnabledInternalForces.FX: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Fxx;
case EnabledInternalForces.FY: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Fyy;
case EnabledInternalForces.MX: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Mxx;
case EnabledInternalForces.MY: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Myy;
}
}
default: return Autodesk.Revit.DB.CodeChecking.Engineering.ForceType.Unknown;
}
}
/// </structural_toolkit_2015>
}
}
}
@@ -0,0 +1,605 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
namespace CodeCheckingConcreteExample.Concrete
{
/// <summary>
/// This class provides helpers to use Autodesk.CodeChecking.Concrete component.
/// </summary>
public class RcVerificationHelperUtility
{
/// <summary>
/// Classification of the cross section side for the distribution of the reinforcement.
/// </summary>
private enum CrossSectionSide
{
/// <summary>
/// Top of cross section
/// </summary>
Top,
/// <summary>
/// Bottom of cross section
/// </summary>
Bottom,
/// <summary>
/// Right of cross section
/// </summary>
Right,
/// <summary>
/// Left of cross section
/// </summary>
Left
}
const double geometryEpsilon = 1e-6; // tolerance for polyline which describes of section
int noTopBottom; // the number of bars on the top or bottom side with corner bars
int noLeftRight; // the number of bars on the top or bottom side without corner bars
List<Rebar> rebars; // list of rebars in the cross-section
List<CrossSectionSide> rebarsSide; // list of bars position in the cross-section
SectionShapeType crossSectionType; // the type of cross-section
double rebarCoverTop; // top cover from the edge to the gravity center of bars
double rebarCoverBottom; // bottom cover from the edge to the gravity center of bars
double rebarCover; // the greater cover from the edge to the gravity center of bars
Geometry solverGeometry; // geometry of cross section for solver object
RCSolver solver; // solver
double totalHeight; // the height of the cross section
double totalWidth; // the width of the cross section
double geometryMinX; // minimum x-coordinate on the geometry of the cross section
double geometryMinY; // minimum y-coordinate on the geometry of the cross section
double geometryMaxX; // maximum x-coordinate on the geometry of the cross section
double geometryMaxY; // maximum y-coordinate on the geometry of the cross section
/// <structural_toolkit_2015>
/// <summary>
/// Link between edges of cross section and reinforcement bars.
/// </summary>
Dictionary<CrossSectionSide, Tuple<int,int>> edgesForReinforcement; //
/// <summary>
/// Compares position (coordinates) using a tolerance of geometry.
/// </summary>
/// <param name="FirstPosition">First position of geometry</param>
/// <param name="SecondPosition">Second position of geometry</param>
/// <returns>
/// Less than zero - FirstPosition is less than SecondPosition.
/// Zero - FirstPosition is equal to SecondPosition
/// Greater than zero - FirstPosition is greater than SecondPosition.
/// </returns>
static int CompareGeomety(double FirstPosition, double SecondPosition)
{
int compare = -1;
if (Math.Abs(FirstPosition - SecondPosition) < geometryEpsilon)
compare = 0;
else if (FirstPosition > SecondPosition)
compare = 1;
return compare;
}
/// </structural_toolkit_2015>
/// <summary>
/// Initializes a new instance of the new RC calculation helper object.
/// </summary>
/// <param name="type">The type of the cross-section</param>
/// <param name="rcGeometry">Set of geometry parameters.</param>
/// <param name="coverTop">The top cover - to the reinforcement ceneter.</param>
/// <param name="coverBottom">The top cover - to the reinforcement ceneter.</param>
private RcVerificationHelperUtility(SectionShapeType type, ref Geometry rcGeometry, double coverTop, double coverBottom)
{
totalHeight = 0; // initial value of the height of the cross section
totalWidth = 0; // initial value of the width of the cross section
noTopBottom = 5; // initial value of the number of bars on top and bottom
noLeftRight = noTopBottom - 2; // initial value of the number of bars on left and right
solverGeometry = new Geometry(); // initialization of new geometry
rebars = new List<Rebar>(); // initialization of rebars list
rebarsSide = new List<CrossSectionSide>(); // initialization of bars position list
crossSectionType = type; // set of section type
rebarCover = Math.Max(coverTop, coverBottom); // set of maximum cover
rebarCoverTop = coverTop; // set of top cover
rebarCoverBottom = coverBottom; // set of bottom cover
/// <structural_toolkit_2015>
edgesForReinforcement = new Dictionary<CrossSectionSide, Tuple<int, int>>();
geometryMinX = Double.MaxValue;
geometryMinY = Double.MaxValue;
geometryMaxX = Double.MinValue;
geometryMaxY = Double.MinValue;
/// </structural_toolkit_2015>
// Top,bottom, lreft and right edges are searched, based on maximum and minimum values for x and y coordinates
/// <structural_toolkit_2015>
solverGeometry = rcGeometry;
int count = solverGeometry.Count;
Point2D p = new Point2D(0, 0);
// The orientation is changed if it is necessary.
if (solverGeometry.isClockwiseOrientation()) // clockwise direction
{
Geometry tmpGeometry = new Geometry();
p = solverGeometry.Point(0);
tmpGeometry.Add(p.X, p.Y);
for (int i = count-1; i > 0; i--)
{
p = solverGeometry.Point(i);
tmpGeometry.Add(p.X, p.Y);
}
solverGeometry = tmpGeometry;
}
foreach (Point2D p2D in solverGeometry)
{
geometryMinX = Math.Min(geometryMinX, p2D.X);
geometryMinY = Math.Min(geometryMinY, p2D.Y);
geometryMaxX = Math.Max(geometryMaxX, p2D.X);
geometryMaxY = Math.Max(geometryMaxY, p2D.Y);
}
Tuple<int, int> curentTuple = null;
for (int i = 0; i < count; i++)
{
p = solverGeometry.Point(i);
// Left
if (CompareGeomety(geometryMinX,p.X) >= 0)
{
if (!edgesForReinforcement.ContainsKey(CrossSectionSide.Left) || CompareGeomety(geometryMinX,p.X) > 0)
curentTuple = new Tuple<int, int>(i, i);
else
{
if (CompareGeomety(p.Y, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Left].Item2).Y) > 0)
curentTuple = new Tuple<int, int>(edgesForReinforcement[CrossSectionSide.Left].Item1, i);
else if (CompareGeomety(p.Y, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Left].Item1).Y) < 0)
curentTuple = new Tuple<int, int>(i, edgesForReinforcement[CrossSectionSide.Left].Item2);
}
edgesForReinforcement.Remove(CrossSectionSide.Left);
edgesForReinforcement.Add(CrossSectionSide.Left, curentTuple);
}
// Right
if (CompareGeomety(geometryMaxX,p.X) <= 0)
{
if (!edgesForReinforcement.ContainsKey(CrossSectionSide.Right) || CompareGeomety(geometryMaxX,p.X) < 0)
curentTuple = new Tuple<int, int>(i, i);
else
{
if (CompareGeomety(p.Y, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Right].Item2).Y) > 0)
curentTuple = new Tuple<int, int>(edgesForReinforcement[CrossSectionSide.Right].Item1, i);
else if (CompareGeomety(p.Y, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Right].Item1).Y) < 0)
curentTuple = new Tuple<int, int>(i, edgesForReinforcement[CrossSectionSide.Right].Item2);
}
edgesForReinforcement.Remove(CrossSectionSide.Right);
edgesForReinforcement.Add(CrossSectionSide.Right, curentTuple);
}
// Top
if (CompareGeomety(geometryMaxY,p.Y) <= 0)
{
if (!edgesForReinforcement.ContainsKey(CrossSectionSide.Top) || CompareGeomety(geometryMaxY,p.Y) < 0)
{
curentTuple = new Tuple<int, int>(i, i);
}
else
{
if (CompareGeomety(p.X, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Top].Item2).X) > 0)
curentTuple = new Tuple<int, int>(edgesForReinforcement[CrossSectionSide.Top].Item1, i);
else if (CompareGeomety(p.X, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Top].Item1).X) < 0)
curentTuple = new Tuple<int, int>(i, edgesForReinforcement[CrossSectionSide.Top].Item2);
}
edgesForReinforcement.Remove(CrossSectionSide.Top);
edgesForReinforcement.Add(CrossSectionSide.Top, curentTuple);
}
// Bottom
if (CompareGeomety(geometryMinY,p.Y) >= 0)
{
if (!edgesForReinforcement.ContainsKey(CrossSectionSide.Bottom) || CompareGeomety(geometryMinY,p.Y) > 0)
{
curentTuple = new Tuple<int, int>(i, i);
}
else
{
if (CompareGeomety(p.X, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Bottom].Item2).X) > 0)
curentTuple = new Tuple<int, int>(edgesForReinforcement[CrossSectionSide.Bottom].Item1, i);
else if (CompareGeomety(p.X, solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Bottom].Item1).X) < 0)
curentTuple = new Tuple<int, int>(i, edgesForReinforcement[CrossSectionSide.Bottom].Item2);
}
edgesForReinforcement.Remove(CrossSectionSide.Bottom);
edgesForReinforcement.Add(CrossSectionSide.Bottom, curentTuple);
}
}
/// </structural_toolkit_2015>
totalHeight = (geometryMaxY - geometryMinY);
totalWidth = (geometryMaxX - geometryMinX);
solver = RCSolver.CreateNewSolver(solverGeometry); // solver with geometry redy to use.
}
/// <summary>
/// Create the new RC calculation object.
/// </summary>
/// <param name="type">The type of the cross-section</param>
/// <param name="rcGeometry">Set of geometry parameters.</param>
/// <param name="coverTop">The top cover - to the reinforcement ceneter.</param>
/// <param name="coverBottom">The top cover - to the reinforcement ceneter.</param>
/// <returns>New RcVerificationHelperUtility object.</returns>
public static RcVerificationHelperUtility CreateRcVerificationHelperUtility(SectionShapeType type, ref Geometry rcGeometry, double coverTop, double coverBottom)
{
if (SectionShapeType.RectangularBar != type && SectionShapeType.T != type)
throw new Exception("CreateRcVerificationHelperUtility.Unhandled cross section type. 3th party parameterization are necessary.");
// If you need to take into account other section you should modyfy SetReinforcementAsBar & GetReinforcementLine before you remove this exception!
RcVerificationHelperUtility newUtility = new RcVerificationHelperUtility(type, ref rcGeometry, coverTop, coverBottom);
return newUtility;
}
/// <summary>
/// Set reinforcement on every cross-section corner.
/// </summary>
/// <param name="oneRebarArea">Area of each rebar.</param>
public void SetCornerReinforcement(double oneRebarArea)
{
SetReinforcementAsBar(oneRebarArea, oneRebarArea, 0.0, 0.0, 2, 2, 0, 0);
}
/// <summary>
/// Set reinforcement on the top and bottom of the section.
/// </summary>
/// <param name="topReinf">Area of top reinforcment.</param>
/// <param name="bottomReinf">Area of bottom reinforcment.</param>
public void SetReinforcement(double topReinf, double bottomReinf)
{
SetReinforcementAsBar(0.5 * topReinf, 0.5 * bottomReinf, 0.0, 0.0, 2, 2, 0, 0);
}
/// <summary>
/// Set reinforcemenet on every side of cross-section.
/// </summary>
/// <param name="topReinf">Area of top reinforcment.</param>
/// <param name="bottomReinf">Area of bottom reinforcment.</param>
/// <param name="rightReinf">Area of right reinforcment.</param>
/// <param name="leftReinf">Area of left reinforcment.</param>
public void SetReinforcement(double topReinf, double bottomReinf, double rightReinf, double leftReinf)
{
int barNo = rebars.Count();
int noRebarMax = 2 * (noTopBottom + noLeftRight);
topReinf /= (double)noTopBottom;
bottomReinf /= (double)noTopBottom;
rightReinf /= (double)noLeftRight;
leftReinf /= (double)noLeftRight;
if (barNo == noRebarMax && Math.Abs(topReinf * bottomReinf * rightReinf * leftReinf) > Double.Epsilon)
{
for (int i = 0; i < barNo; i++)
{
switch (rebarsSide[i])
{
case CrossSectionSide.Top:
rebars[i].Area = topReinf;
break;
case CrossSectionSide.Bottom:
rebars[i].Area = bottomReinf;
break;
case CrossSectionSide.Right:
rebars[i].Area = rightReinf;
break;
case CrossSectionSide.Left:
rebars[i].Area = leftReinf;
break;
}
}
solver.SetRebars(rebars);
}
else
{
SetReinforcementAsBar(topReinf, bottomReinf, rightReinf, leftReinf, noTopBottom, noTopBottom, noLeftRight, noLeftRight);
}
}
/// <summary>
/// Set the concrete parameters for calculation.
/// </summary>
/// <param name="concrete">Set of reinforcement concrete parameters.</param>
public void SetConcrete(Autodesk.CodeChecking.Concrete.Concrete concrete)
{
solver.SetConcrete(concrete);
}
/// <summary>
/// Set the concrete parameters for calculation.
/// </summary>
/// <param name="stressStrainType">Stress-strain relationship. The type of the concrete mechanical behaviour.</param>
/// <param name="strenght">Concrete strenght.</param>
/// <param name="youngModulus">Modulus of elasticyty - Young modulus for concrete.</param>
public void SetConcrete(Autodesk.CodeChecking.Concrete.StressDiagramType stressStrainType, double strenght, double youngModulus)
{
Autodesk.CodeChecking.Concrete.Concrete newConcrete = new Autodesk.CodeChecking.Concrete.Concrete();
double MaximumStrain = 0.0035; // The variable dependent to RC code.!
double CompressionReductionFactor = 0.8; // The variable dependent to RC code. Only for D_REC stressStrainType!
switch (stressStrainType)
{
case Autodesk.CodeChecking.Concrete.StressDiagramType.Linear:
newConcrete.SetStrainStressModelLinear(strenght, strenght / youngModulus, youngModulus);
break;
case Autodesk.CodeChecking.Concrete.StressDiagramType.Rectangular:
newConcrete.SetStrainStressModelRectangular(strenght, MaximumStrain, youngModulus, CompressionReductionFactor);
break;
default:
// Other cases could be necessary for some design codes.
// Other variables dependent to RC code could be necessary for parameterization!
throw new Exception("SetConcrete. Unhandled type. 3th party implementation are necessary in this point.");
}
SetConcrete(newConcrete);
}
/// <summary>
/// Set the reinforcement steel parameters for calculation.
/// </summary>
/// <param name="strenght">Steel strenght.</param>
/// <param name="modulusOfElasticity">Modulus of elasticyty - Young modulus for steel.</param>
/// <param name="strainUltimateLimit">Limit of strain - maximum steel strain.</param>
/// <param name="hardeningFactor">Hardening factor - increase of strength on the plastic behaviour part.</param>
public void SetSteel(double strenght, double modulusOfElasticity, double strainUltimateLimit, double hardeningFactor)
{
Autodesk.CodeChecking.Concrete.Steel newSteel = new Autodesk.CodeChecking.Concrete.Steel();
newSteel.ModulusOfElasticity = modulusOfElasticity;
newSteel.DesignStrength = strenght;
newSteel.HardeningFactor = hardeningFactor; // The variable dependent to RC code.!
// Sometimes 1.0 value(without Hardening) is makes some problems with iteration process.
// Little value bigger the 1.0 is removed this problems and is safer.
newSteel.StrainUltimateLimit = strainUltimateLimit; // The variable dependent to RC code.!
solver.SetSteel(newSteel);
double yieldStrain = newSteel.DesignStrength / newSteel.ModulusOfElasticity;
int minStep = (int)Math.Ceiling(newSteel.StrainUltimateLimit / yieldStrain);
//noTopBottom = 2*Math.Max(5, minStep);
//noLeftRight = minStep - 2;
}
/// <summary>
/// Set identical rebars in the concrete cross section.
/// </summary>
/// <param name="oneBarArea">The area of a single bar.</param>
/// <param name="noBarBottom">The number of bars placed on the bottom.</param>
/// <param name="noBarTop">The number of bars placed on the top.</param>
/// <param name="noBarLeft">The number of bars placed on the left</param>
/// <param name="noBarRight">The number of bars placed on the right</param>
void SetReinforcementAsBar(double oneBarArea, int noBarTop, int noBarBottom, int noBarRight, int noBarLeft)
{
SetReinforcementAsBar(oneBarArea * noBarTop, oneBarArea * noBarBottom, oneBarArea * noBarRight, oneBarArea * noBarLeft, noBarTop, noBarBottom, noBarRight, noBarLeft);
}
/// <summary>
/// Set rebars in the concrete cross section.
/// </summary>
/// <param name="bottomBarArea">The area of reinforcement on the bottom of section.</param>
/// <param name="topBarArea">The area of reinforcement on the top of section.</param>
/// <param name="leftBarArea">The area of reinforcement on the left of section.</param>
/// <param name="rightBarArea">The area of reinforcement on the right of section.</param>
/// <param name="noBarBottom">The number of bars placed on the bottom.</param>
/// <param name="noBarTop">The number of bars placed on the top.</param>
/// <param name="noBarLeft">The number of bars placed on the left</param>
/// <param name="noBarRight">The number of bars placed on the right</param>
void SetReinforcementAsBar(double topBarArea, double bottomBarArea, double rightBarArea, double leftBarArea, int noBarTop, int noBarBottom, int noBarRight, int noBarLeft)
{
rebars.Clear();
rebarsSide.Clear();
Point2D BeginLinePoint = new Point2D(0, 0);
Point2D EndLinePoint = new Point2D(0, 0);
/// <structural_toolkit_2015>
//BOTTOM
if (bottomBarArea > 0.0)
{
BeginLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Bottom].Item1);
EndLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Bottom].Item2);
BeginLinePoint.X += rebarCover;
EndLinePoint.X -= rebarCover;
BeginLinePoint.Y += rebarCoverBottom;
EndLinePoint.Y += rebarCoverBottom;
SetReinforcementBarsOnLine(ref BeginLinePoint, ref EndLinePoint, ref bottomBarArea, ref noBarBottom, false, CrossSectionSide.Bottom);
}
//RIGHT
if (rightBarArea > 0.0)
{
BeginLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Right].Item1);
EndLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Right].Item2);
BeginLinePoint.X -= rebarCover;
EndLinePoint.X -= rebarCover;
BeginLinePoint.Y += rebarCoverBottom;
EndLinePoint.Y -= rebarCoverTop;
SetReinforcementBarsOnLine(ref BeginLinePoint, ref EndLinePoint, ref rightBarArea, ref noBarRight, true, CrossSectionSide.Right);
}
//TOP
if (topBarArea > 0.0)
{
BeginLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Top].Item1);
EndLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Top].Item2);
BeginLinePoint.X += rebarCover;
EndLinePoint.X -= rebarCover;
BeginLinePoint.Y -= rebarCoverTop;
EndLinePoint.Y -= rebarCoverTop;
SetReinforcementBarsOnLine(ref BeginLinePoint, ref EndLinePoint, ref topBarArea, ref noBarTop, false, CrossSectionSide.Top);
}
//LEFT
if (leftBarArea > 0.0)
{
BeginLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Left].Item1);
EndLinePoint = solverGeometry.Point(edgesForReinforcement[CrossSectionSide.Left].Item2);
BeginLinePoint.X += rebarCover;
EndLinePoint.X += rebarCover;
BeginLinePoint.Y += rebarCoverBottom;
EndLinePoint.Y -= rebarCoverTop;
SetReinforcementBarsOnLine(ref BeginLinePoint, ref EndLinePoint, ref leftBarArea, ref noBarLeft, true, CrossSectionSide.Left);
}
solver.SetRebars(rebars);
}
/// <summary>
/// Set the rebar beetwin two points.
/// </summary>
/// <param name="beginPoint">First point of reinforcing line.</param>
/// <param name="endPoint">Last point of reinforcing line.</param>
/// <param name="oneBarArea">The area of reinforcement.</param>
/// <param name="noBars">The number of bars placed on the line.</param>
/// <param name="hasNoCornerBars">If true the rebar will be placed on the ends of line.</param>
/// <param name="position">The information about classification of the rebar as top, bottom, right or left.</param>
void SetReinforcementBarsOnLine(ref Point2D beginPoint, ref Point2D endPoint, ref double oneBarArea, ref int noBars, bool hasNoCornerBars, CrossSectionSide position)
{
if (noBars > 0 && oneBarArea > 0.0)
{
int noSpace = noBars + (hasNoCornerBars ? 1 : -1);
double fdX = (endPoint.X - beginPoint.X);
double fdY = (endPoint.Y - beginPoint.Y);
fdX /= noSpace;
fdY /= noSpace;
if (hasNoCornerBars)
{
for (int i = 1; i < noSpace; i++)
{
Rebar bar = new Rebar(beginPoint.X + i * fdX, beginPoint.Y + i * fdY, oneBarArea);
rebars.Add(bar);
rebarsSide.Add(position);
}
}
else
{
for (int i = 0; i <= noSpace; i++)
{
Rebar bar = new Rebar(beginPoint.X + i * fdX, beginPoint.Y + i * fdY, oneBarArea);
rebars.Add(bar);
rebarsSide.Add(position);
}
}
}
}
/// <summary>
/// Calculates the safety factor.
/// </summary>
/// <param name="inNMM">The acting forces.</param>
/// <returns>Safety factor. Resistance forces to acting forces ratio.</returns>
public double SafetyFactor(InternalForcesContainer inNMM)
{
double safetyFactor = -1.0;
try
{
solver.SolveResistance(inNMM.ForceFx, -inNMM.MomentMy, inNMM.MomentMz);
}
catch (Exception e)
{
throw e;
}
SetOfForces solveNMM = solver.GetInternalForces(Autodesk.CodeChecking.Concrete.ResultType.Section);
if (Math.Abs(inNMM.ForceFx) > Math.Abs(inNMM.MomentMy))
{
if (Math.Abs(inNMM.ForceFx) > Math.Abs(inNMM.MomentMz))
safetyFactor = solveNMM.AxialForce / inNMM.ForceFx;
else
safetyFactor = solveNMM.MomentY / inNMM.MomentMz;
}
else if (Math.Abs(inNMM.MomentMy) > Math.Abs(inNMM.MomentMz))
{
safetyFactor = solveNMM.MomentX / -inNMM.MomentMy;
}
else
{
safetyFactor = solveNMM.MomentY / inNMM.MomentMz;
}
return safetyFactor;
}
/// <summary>
/// Calculates the safety factor and sets additional result in the lists.
/// </summary>
/// <param name="inNMM">The acting forces.</param>
/// <param name="concreteStresses">
/// Reference to modify object. The list is set after safety factor calculation. Includes stresses on every corner of the cross section.
/// </param>
/// <param name="steelStresses">
/// Reference to modify object. The list is set after safety factor calculation. Includes stresses on every rebar.
/// </param>
/// <returns>Safety factor. Resistance forces to acting forces ratio.</returns>
public double SafetyFactor(InternalForcesContainer inNMM, ref List<double> concreteStresses, ref List<double> steelStresses)
{
double safetyFactor = SafetyFactor(inNMM);
int no = solverGeometry.Count;
double stress = 0;
for (int i = 0; i < no; i++)
{
stress = solver.GetStress(Autodesk.CodeChecking.Concrete.ResultType.Concrete, i);
concreteStresses.Add(stress);
}
no = solver.GetRebars().Count;
for (int i = 0; i < no; i++)
{
stress = solver.GetStress(Autodesk.CodeChecking.Concrete.ResultType.Rebars, i);
steelStresses.Add(stress);
}
return safetyFactor;
}
/// <structural_toolkit_2015>
/// <summary>
/// Calculate the moment of inertia for cracking section.
/// </summary>
/// <param name="inNMM">The acting forces.</param>
/// <returns>Returns moment of inertia for cracking section.</returns>
public double InertiaOfCrackingSection(InternalForcesContainer inNMM)
{
double momentOfInertiaCrackingConcreteSection = 0.0;
SafetyFactor(inNMM);
SetOfForces solverNMM = solver.GetInternalForces(Autodesk.CodeChecking.Concrete.ResultType.Section);
double neutralAxisDist = solver.GetNeutralAxisDistance();
double stressArea = solver.GetConcreteStressArea();
double comprHeight = 0.5 * totalHeight + neutralAxisDist;
Steel steel = solver.GetSteel();
Autodesk.CodeChecking.Concrete.Concrete concrete = solver.GetConcrete();
double n = steel.ModulusOfElasticity / concrete.ModulusOfElasticity;
switch (crossSectionType)
{
case SectionShapeType.RectangularBar:
{
momentOfInertiaCrackingConcreteSection = comprHeight * comprHeight * stressArea / 3.0; // bh^3/12 + b*h*(0.5*h)^2, b*h=stressArea
}
break;
default:
throw new Exception("InertiaOfCrackingSection. Unhandled cross section type. Only rectangular cross-section can be used on this path. 3th party implementation is necessary.");
}
foreach (Rebar bar in solver.GetRebars())
{
momentOfInertiaCrackingConcreteSection += n * bar.Area * Math.Pow((bar.Y + neutralAxisDist),2);
}
return momentOfInertiaCrackingConcreteSection;
}
/// <summary>
/// Calculate the acting forces to Cracking forces ratio.
/// </summary>
/// <param name="inNMM">The acting forces.</param>
/// <param name="crackingStress">Stress limit for cracking/uncracking section.</param>
/// <returns>Acting forces to cracking forces ratio</returns>
public double ForcesToCrackingForces(InternalForcesContainer inNMM, double crackingStress)
{
double forcesToCrackigForces = 0;
if (!CalculationUtility.IsZeroM(inNMM.MomentMz))
{
throw new Exception("Deflection calculation is not aviable for biaxial bending.");
}
double actingForcesStress = 0;
if(!CalculationUtility.IsZeroM(inNMM.MomentMy))
{
double w = solverGeometry.MomentOfInertiaX;
w /= inNMM.MomentMy > 0.0 ? (geometryMaxY - solverGeometry.CenterOfInertia.Y) : (solverGeometry.CenterOfInertia.Y - geometryMinY);
actingForcesStress += Math.Abs(inNMM.MomentMy) / w;
}
if (!CalculationUtility.IsZeroN(inNMM.ForceFx))
{
actingForcesStress += -inNMM.ForceFx / solverGeometry.Area;
}
if (actingForcesStress >= 0)
{
forcesToCrackigForces = actingForcesStress / crackingStress ;
}
return forcesToCrackigForces;
}
/// </structural_toolkit_2015>
}
}
@@ -0,0 +1,175 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.Concrete
{
/// <summary>
/// Class describe reinforcement data and results.
/// </summary>
public class Reinforcement
{
private double spacing, asTop, asBottom, asRight, asLeft;
private double strength;
private double designStrength;
private double transversalDensity;
private Reinforcement() { }
/// <summary>
/// Create reinforcement object based on steel parameters.
/// </summary>
/// <param name="steelStrenght">The design strenght of steel.</param>
public Reinforcement(double steelStrenght)
{
Reset();
strength = steelStrenght;
designStrength = strength;
ModulusOfElasticity = 200e9;
}
/// <summary>
/// Set all variables in the <see cref="Reinforcement"/> object to defult valus: areas to 0.0 spacig to float.MaxValue
/// </summary>
public void Reset()
{
spacing = float.MaxValue;
asTop = asBottom = asRight = asLeft = 0.0;
CurrentAsTop = CurrentAsBottom = CurrentAsRight = CurrentAsLeft = 0.0;
CurrentSpacing = float.MaxValue;
}
/// <summary>
/// Gets or sets the current (temporary) stirupp spacing.
/// </summary>
public double CurrentSpacing { get; set; }
/// <summary>
/// Gets or sets the current (temporary) area of top reinforcement.
/// </summary>
public double CurrentAsTop { get; set; }
/// <summary>
/// Gets or sets the current (temporary) area of bottom reinforcement.
/// </summary>
public double CurrentAsBottom { get; set; }
/// <summary>
/// Gets or sets the current (temporary) area of right reinforcement.
/// </summary>
public double CurrentAsRight { get; set; }
/// <summary>
/// Gets or sets the current (temporary) area of left reinforcement.
/// </summary>
public double CurrentAsLeft { get; set; }
/// <summary>
/// Gets or sets the modulus of elasticyty (Young modulus).
/// </summary>
public double ModulusOfElasticity { get; set; }
/// <summary>
/// Gets the stirupp spacing (finial).
/// </summary>
public double Spacing { get { return spacing; } }
/// <summary>
/// Gets the area of top reinforcement (finial).
/// </summary>
public double AsTop { get { return asTop; } }
/// <summary>
/// Gets the area of bottom reinforcement (finial).
/// </summary>
public double AsBottom { get { return asBottom; } }
/// <summary>
/// Gets the area of right reinforcement (finial).
/// </summary>
public double AsRight { get { return asRight; } }
/// <summary>
/// Gets the area of left reinforcement (finial).
/// </summary>
public double AsLeft { get { return asLeft; } }
/// <summary>
/// Gets the design strenght.
/// </summary>
public double Strength { get { return designStrength; } }
/// <summary>
/// Sets design strength according to current limit state. The strength is divided by safety factor.
/// </summary>
/// <param name="factor">Safety factor</param>
public void SetStrenghtPartialFactor(double factor)
{
designStrength = strength / factor;
}
/// <summary>
/// Sets trensversal reinforcement density acording to number of stirrupas arms, transversal bar area and spacuing.
/// </summary>
/// <param name="numberOfStirrupsArms">The number of arms in one frame of stirrup.</param>
/// <param name="oneArmArea">The area of one transversal bar. One of stirrups arms.</param>
public void SetTransversalDensity(int numberOfStirrupsArms, double oneArmArea)
{
transversalDensity = (oneArmArea * numberOfStirrupsArms) / spacing;
}
/// <summary>
/// Gets the stirrups dencity
/// </summary>
public double TransversalDensity { get { return transversalDensity; } }
/// <summary>
/// Calculates total reinforcement area.
/// </summary>
/// <returns>Returns sum of reinforcement area.</returns>
public double TotalSectionReinforcement()
{
return asTop + asBottom + asRight + asLeft;
}
/// <summary>
/// Sets finial resulat <see cref="Spacing"/>, <see cref="AsTop"/>, <see cref="AsBottom"/>, <see cref="AsRight"/>, <see cref="AsLeft"/> ) based on curent valus.
/// </summary>
/// <remarks>
/// <para>For longitudinal reinforcement: the final areas are set as maksimum of current value and previous final value. </para>
/// <para>For transversal reinforcement: the final areas are set as sum of current value and previous final value,
/// final spacing is set as minimum of current spacing and previous final spacing.</para>
/// </remarks>
public void CurrentToFinial()
{
spacing = Math.Min(CurrentSpacing, spacing);
asTop = Math.Max(CurrentAsTop, asTop);
asBottom = Math.Max(CurrentAsBottom, asBottom);
asRight = Math.Max(CurrentAsRight, asRight);
asLeft = Math.Max(CurrentAsLeft, asLeft);
}
}
}
@@ -0,0 +1,107 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Storage;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents common parameters.
/// </summary>
public class CommonParametersBase
{
/// <summary>
/// Initializes a new instance of the CommonParametersBase object with list of parameters.
/// </summary>
/// <param name="listElementStatus">List identyficators of elements with result status.</param>
/// <param name="listCombinationId">List load combinations identificators</param>
/// <param name="activePackageGuid">Identificator of active package with results.</param>
/// <param name="calculationParameters">Calculation parameters.</param>
public CommonParametersBase(List<Tuple<ElementId, ResultStatus>> listElementStatus,
List<ElementId> listCombinationId,
Guid activePackageGuid,
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass calculationParameters)
{
listElemStatus = listElementStatus;
listCombId = listCombinationId;
this.activePackageGuid = activePackageGuid;
calcParams = calculationParameters;
}
/// <summary>
/// Initializes a new instance of the CommonParametersBase from an existing one.
/// </summary>
/// <param name="param">Common parameters to copy.</param>
public CommonParametersBase(CommonParametersBase param)
{
listElemStatus = param.ListElementStatus;
listCombId = param.ListCombinationId;
activePackageGuid = param.activePackageGuid;
calcParams = param.CalculationParameter;
}
private CommonParametersBase() { }
/// <summary>
/// Gets the list of elements identificators.
/// </summary>
public List<Tuple<ElementId, ResultStatus>> ListElementStatus
{
get { return listElemStatus; }
}
/// <summary>
/// Gets the list of load combinations identificators.
/// </summary>
public List<ElementId> ListCombinationId
{
get { return listCombId; }
}
/// <summary>
/// Gets the calculation parameters.
/// </summary>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass CalculationParameter
{
get { return calcParams; }
}
/// <summary>
/// Gets the identificator of an active package with results.
/// </summary>
public Guid ActivePackageGuid
{
get { return activePackageGuid; }
}
private Guid activePackageGuid;
private List<Tuple<ElementId, ResultStatus>> listElemStatus;
private List<ElementId> listCombId;
private Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass calcParams;
}
}
@@ -0,0 +1,142 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Storage;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents a base of element data.
/// </summary>
public class ElementDataBase : ObjectDataBase
{
/// <summary>
/// Initializes a new instance of the ElementDataBase object with list of parameters.
/// </summary>
/// <param name="elementResult">Element results schema.</param>
/// <param name="listcalcPoint">List of the element's calculation points.</param>
/// <param name="listSectionData">List of sections' data.</param>
/// <param name="elementStatus">Element result status.</param>
/// <param name="document">Acces to cref="Document".</param>
/// <param name="data">Object with base parameters for the element.</param>
public ElementDataBase(Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass elementResult,
List<CalcPoint> listcalcPoint,
List<SectionDataBase> listSectionData,
Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus elementStatus,
Document document,
ObjectDataBase data)
: base(data)
{
Result = elementResult;
calcPoints = listcalcPoint;
listSectData = listSectionData;
Status = elementStatus;
this.document = document;
}
/// <summary>
/// Initializes a new instance of the ElementDataBase from an existing one.
/// </summary>
/// <param name="elementDataBase">Element data to copy.</param>
public ElementDataBase(ElementDataBase elementDataBase)
: base(elementDataBase as ObjectDataBase)
{
Result = elementDataBase.Result;
calcPoints = elementDataBase.ListCalcPoints;
listSectData = elementDataBase.ListSectionData;
Status = elementDataBase.Status;
document = elementDataBase.document;
}
private ElementDataBase() { }
/// <summary>
/// Result schema of the element.
/// </summary>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass Result { get; set; }
/// <summary>
/// List of calculation points cref="CalcPoint" of the element.
/// </summary>
public List<CalcPoint> ListCalcPoints
{
get { return calcPoints; }
}
/// <summary>
/// List of sections data of the element.
/// </summary>
public List<SectionDataBase> ListSectionData
{
get { return listSectData; }
}
/// <summary>
/// Gets and sets the element's result status.
/// </summary>
public Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus Status { get; set; }
/// <summary>
/// Adds the formated error to cref="Status".
/// </summary>
/// <param name="message">The message.</param>
/// <param name="notify">if set to <c>true</c> [notify].</param>
public void AddFormatedError(ResultStatusMessage message, bool notify = true)
{
Status.AddError(message, document, notify);
}
/// <summary>
/// Adds the formated info to cref="Status".
/// </summary>
/// <param name="message">The message.</param>
/// <param name="notify">if set to <c>true</c> [notify].</param>
public void AddFormatedInfo(ResultStatusMessage message, bool notify = true)
{
Status.AddInfo(message, document, notify);
}
/// <summary>
/// Adds the formated warning to cref="Status".
/// </summary>
/// <param name="message">The message.</param>
/// <param name="notify">if set to <c>true</c> [notify].</param>
public void AddFormatedWarning(ResultStatusMessage message, bool notify = true)
{
Status.AddWarning(message, document, notify);
}
List<CalcPoint> calcPoints;
private List<SectionDataBase> listSectData;
/// <summary>
/// Revit document
/// </summary>
protected Document document;
}
}
@@ -0,0 +1,444 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using Autodesk.Revit.DB.CodeChecking;
using Autodesk.Revit.DB.CodeChecking.Documentation;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.ExtensibleStorage.Framework;
using Autodesk.Revit.DB.CodeChecking.Storage;
using CodeCheckingConcreteExample.Server;
using CodeCheckingConcreteExample.Properties;
using System.Threading;
using System.Threading.Tasks;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents the main calculation loop.
/// </summary>
public class Engine
{
private IEngineData EngineData;
private Engine() { }
/// <summary>
/// Initializes a new instance of the Engine class.
/// </summary>
/// <param name="engineData">The interface cref="IEngineData" needed to parametrize Engine.</param>
public Engine(IEngineData engineData)
{
EngineData = engineData;
}
/// <summary>
/// Runs calculation for elements served in user implementation of cref="IEngineData".
/// </summary>
/// <param name="server">Acces to cref="Server".</param>
/// <param name="data">Acces to cref="ServiceData".</param>
public void Calculate(Server.Server server, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
List<Tuple<ElementId, ResultStatus>> listElementStatus = ReadListElementIdWithStatus(server, data);
if (listElementStatus.Count > 0)
CalculateSetOfElements(listElementStatus, server, data);
}
/// <summary>
/// Reads from Revit information about selected elements, next Calculates the list of elements, at the end saves calculation results in Revit Data Base.
/// </summary>
/// <param name="listElementStatus">List identyficators of elements with result status.</param>
/// <param name="server">Acces to cref="Server".</param>
/// <param name="data">Acces to cref="ServiceData".</param>
protected void CalculateSetOfElements(List<Tuple<ElementId, ResultStatus>> listElementStatus, Server.Server server, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
// reading from Revit Api
CommonParametersBase parameters = ReadCommonParameters(listElementStatus, server, data);
List<ObjectDataBase> listElementData = ReadListElementData(data, listElementStatus, parameters);
if (NotificationService.ProgressBreakInvoked() == false)
EngineData.ReadFromRevitDB(listElementData, parameters, data);
int maxNumberOfThreads = EngineData.GetNumberOfThreads(data);
if (maxNumberOfThreads < 1)
maxNumberOfThreads = 1;
// pure calculation (without any connection with Revit api)
List<ObjectDataBase> listElementFiltered = EngineData.FilterElementForCalculation(listElementData);
if (NotificationService.ProgressBreakInvoked() == false)
/// <structural_toolkit_2015>
CalculateElementList(listElementFiltered, parameters, maxNumberOfThreads, server);
/// </structural_toolkit_2015>
// writing to Revit Api
if (NotificationService.ProgressBreakInvoked() == false)
{
SaveListElementData(data, listElementData);
EngineData.SaveToRevitDB(listElementData, parameters, data);
}
}
/// <structural_toolkit_2015>
/// <summary>
/// Gets list of elements with the given category.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <param name="listElementData">List of elements objects</param>
List<ObjectDataBase> GetListElementForCategory(BuiltInCategory category, StructuralAssetClass material, List<ObjectDataBase> listElementData)
{
List<ObjectDataBase> list = new List<ObjectDataBase>();
foreach (ObjectDataBase obj in listElementData)
if (obj.Category == category && obj.Material == material)
list.Add(obj);
return list;
}
/// </structural_toolkit_2015>
/// <structural_toolkit_2015>
/// <summary>
/// Calculates list of elements according to calculation scenario returned by cref="CreateCalculationScenario".
/// </summary>
/// <param name="listElementData">List of elements objects</param>
/// <param name="parameters">Common parameters</param>
/// <param name="maxNumberOfThreads">Maximal namber of threads.</param>
/// <param name="server">Acces to cref="Server".</param>
protected void CalculateElementList(List<ObjectDataBase> listElementData, CommonParametersBase parameters, int maxNumberOfThreads, Server.Server server)
{
ICalculationScenario scenario = EngineData.CreateCalculationScenario(parameters);
int stepsCount = 0;
foreach(Autodesk.Revit.DB.StructuralAssetClass material in server.GetSupportedMaterials())
foreach (BuiltInCategory category in server.GetSupportedCategories(material))
{
List<ICalculationObject> scenarioList = scenario.CalculationScenarioList(category, material);
foreach (ICalculationObject calcObj in scenarioList)
{
foreach (ElementDataBase elemData in listElementData)
{
if (elemData.Category == category && elemData.Material == material && calcObj.Categories.Contains(elemData.Category))
{
if (calcObj.Type == CalculationObjectType.Element)
stepsCount++;
else
stepsCount += elemData.ListSectionData.Count;
}
}
}
}
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("Calculation"), 100);
int stepNbr = 0;
if (maxNumberOfThreads < 2)
{
foreach(Autodesk.Revit.DB.StructuralAssetClass material in server.GetSupportedMaterials())
foreach (BuiltInCategory category in server.GetSupportedCategories(material))
{
List<ObjectDataBase> listElement = GetListElementForCategory(category, material, listElementData);
List<ICalculationObject> scenarioList = scenario.CalculationScenarioList(category,material);
foreach (ICalculationObject calcObj in scenarioList)
calcObj.Parameters = parameters;
foreach (ObjectDataBase element in listElement)
{
bool errorOccured = false;
foreach (ICalculationObject calcObj in scenarioList)
{
if (calcObj.Categories.Contains(element.Category))
{
if (calcObj.Type == CalculationObjectType.Element)
{
if (NotificationService.ProgressBreakInvoked())
break;
stepNbr++;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
if (!errorOccured || calcObj.ErrorResponse == ErrorResponse.RunOnError)
if (!calcObj.Run(element))
errorOccured = true;
}
else
{
List<SectionDataBase> listSections = (element as ElementDataBase).ListSectionData;
int sectionSteps = listSections.Count;
if (!errorOccured || calcObj.ErrorResponse == ErrorResponse.RunOnError)
{
foreach (SectionDataBase section in listSections)
{
if (NotificationService.ProgressBreakInvoked())
break;
stepNbr++;
sectionSteps--;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
if (!calcObj.Run(section))
{
errorOccured = true;
if (calcObj.ErrorResponse == ErrorResponse.SkipOnError)
break;
}
}
}
while (sectionSteps > 0)
{
stepNbr++;
sectionSteps--;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
}
}
}
}
if (NotificationService.ProgressBreakInvoked())
break;
}
}
}
else
{
foreach(Autodesk.Revit.DB.StructuralAssetClass material in server.GetSupportedMaterials())
foreach (BuiltInCategory category in server.GetSupportedCategories(material))
{
List<ObjectDataBase> listElement = GetListElementForCategory(category, material, listElementData);
List<ICalculationObject> scenarioList = scenario.CalculationScenarioList(category,material);
foreach (ICalculationObject calcObj in scenarioList)
calcObj.Parameters = parameters;
object oStepNbr = (object)stepNbr;
Parallel.ForEach(listElement, new ParallelOptions() { MaxDegreeOfParallelism = maxNumberOfThreads }, (element, elLoopState) =>
{
bool errorOccured = false;
foreach (ICalculationObject calcObj in scenarioList)
{
if (calcObj.Categories.Contains(element.Category))
{
if (calcObj.Type == CalculationObjectType.Element)
{
if (NotificationService.ProgressBreakInvoked())
elLoopState.Break();
lock (oStepNbr)
{
stepNbr++;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
}
if (!errorOccured || calcObj.ErrorResponse == ErrorResponse.RunOnError)
if (!calcObj.Run(element))
errorOccured = true;
}
else
{
List<SectionDataBase> listSections = (element as ElementDataBase).ListSectionData;
int sectionSteps = listSections.Count;
if (!errorOccured || calcObj.ErrorResponse == ErrorResponse.RunOnError)
{
Parallel.ForEach(listSections, new ParallelOptions() { MaxDegreeOfParallelism = maxNumberOfThreads }, (section, secLoopState) =>
{
if (NotificationService.ProgressBreakInvoked())
secLoopState.Break();
lock (oStepNbr)
{
stepNbr++;
sectionSteps--;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
}
if (!calcObj.Run(section))
{
errorOccured = true;
if (calcObj.ErrorResponse == ErrorResponse.SkipOnError)
secLoopState.Break();
}
});
}
while (sectionSteps > 0)
{
stepNbr++;
sectionSteps--;
if ((int)((stepNbr - 1) * 100 / stepsCount) != (int)(stepNbr * 100 / stepsCount))
NotificationService.ProgressStep(string.Format("{0:d}%", stepNbr * 100 / stepsCount));
}
}
}
}
if (NotificationService.ProgressBreakInvoked())
elLoopState.Break();
});
}
}
}
/// </structural_toolkit_2015>
/// <summary>
/// Read from Revit parameters common for all selected elements and stores them in cref="CommonParametersBase".
/// </summary>
/// <param name="listElementStatus">List identyficators of elements with result status.</param>
/// <param name="server">Acces to cref="Server".</param>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>Common parameters.</returns>
protected CommonParametersBase ReadCommonParameters(List<Tuple<ElementId, ResultStatus>> listElementStatus, Server.Server server, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
Guid activePackageId = storageDocument.CalculationParamsManager.CalculationParams.GetInputResultPackageId(server.GetServerId());
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass calcParams = EngineData.ReadCalculationParameter(data);
List<ElementId> listCombinationId = new List<ElementId>();
if (server.LoadCasesAndCombinationsSupport())
listCombinationId = storageDocument.CalculationParamsManager.CalculationParams.GetLoadCasesAndCombinations(Server.Server.ID);
CommonParametersBase parameBase = new CommonParametersBase(listElementStatus, listCombinationId, activePackageId, calcParams);
CommonParametersBase parameters = EngineData.CreateCommonParameters(data, parameBase);
return parameters;
}
/// <summary>
/// Reads from Revit selected elements identificators and collect in the list only that which has apprppriate label, material and category.
/// </summary>
/// <param name="server">Acces to cref="Server".</param>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>List identyficators of elements with result status.</returns>
protected List<Tuple<ElementId, ResultStatus>> ReadListElementIdWithStatus(Server.Server server, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
Guid activePackageId = storageDocument.CalculationParamsManager.CalculationParams.GetInputResultPackageId(server.GetServerId());
List<Tuple<ElementId, ResultStatus>> listElementId = new List<Tuple<ElementId, ResultStatus>>();
foreach (Element element in data.Selection)
{
Autodesk.Revit.DB.CodeChecking.Storage.Label ccLabel = storageDocument.LabelsManager.GetLabel(element);
if (ccLabel != null)
{
Autodesk.Revit.DB.BuiltInCategory category = (Autodesk.Revit.DB.BuiltInCategory)element.Category.Id.IntegerValue;
StructuralAssetClass material = ccLabel.Material;
if (server.GetSupportedMaterials().Contains(material) &&
server.GetSupportedCategories(material).Contains(category))
{
ElementId id = new ElementId(element.Id.IntegerValue);
SchemaClass label = EngineData.ReadElementLabel(category, material, ccLabel, data);
ResultStatus status = new Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus(Server.Server.ID, activePackageId);
EngineData.VerifyElementLabel(category, material, label, ref status);
listElementId.Add(new Tuple<ElementId, ResultStatus>(id, status));
}
}
}
return listElementId;
}
/// <summary>
/// Reads from Revit information about selected elements and store it in the list with elements data.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="listElementStatus">List identyficators of elements with result status.</param>
/// <param name="parameters">Common parameters.</param>
/// <returns>List of elements data.</returns>
protected List<ObjectDataBase> ReadListElementData(Autodesk.Revit.DB.CodeChecking.ServiceData data, List<Tuple<ElementId, ResultStatus>> listElementStatus, CommonParametersBase parameters)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
List<ObjectDataBase> listElementData = new List<ObjectDataBase>();
foreach (Tuple<ElementId, ResultStatus> elemStatus in listElementStatus)
{
Element element = data.Document.GetElement(elemStatus.Item1);
if (element != null)
{
Autodesk.Revit.DB.CodeChecking.Storage.Label ccLabel = storageDocument.LabelsManager.GetLabel(element);
if (ccLabel != null)
{
Autodesk.Revit.DB.BuiltInCategory category = (Autodesk.Revit.DB.BuiltInCategory)element.Category.Id.IntegerValue;
StructuralAssetClass material = ccLabel.Material;
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label = EngineData.ReadElementLabel(category, material, ccLabel, data);
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass result = EngineData.CreateElementResult(category, material);
ObjectDataBase objectData = new ObjectDataBase(elemStatus.Item1, category, material, label);
List<SectionDataBase> listSectionsData = new List<SectionDataBase>();
List<CalcPoint> listCalcPoints = EngineData.CreateCalcPointsForElement(data, parameters, elemStatus.Item1);
foreach (CalcPoint p in listCalcPoints)
{
SectionDataBase sectBase = new SectionDataBase(p, objectData);
SectionDataBase sectData = EngineData.CreateSectionData(sectBase);
listSectionsData.Add(sectData);
}
ElementDataBase elemBase = new ElementDataBase(result, listCalcPoints, listSectionsData, elemStatus.Item2, data.Document, objectData);
ElementDataBase elemData = EngineData.CreateElementData(elemBase);
listElementData.Add(elemData);
}
}
}
return listElementData;
}
/// <summary>
/// Saves in Revit data base information collected in the list elements data.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="listElementData">List of elements data.</param>
protected void SaveListElementData(Autodesk.Revit.DB.CodeChecking.ServiceData data, List<ObjectDataBase> listElementData)
{
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("DataSaving"), listElementData.Count);
int step = 0;
foreach (ElementDataBase elemData in listElementData)
{
SaveElementResult(elemData.ElementId, elemData.Result, elemData.Status, data);
step++;
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStep(string.Format("{0:d}%", step * 100 / listElementData.Count));
}
}
/// <summary>
/// Saves in Revit the result object of an element.
/// </summary>
/// <param name="elementId">Identificator of an element.</param>
/// <param name="resultSchema">Result object.</param>
/// <param name="status">Status of element's results.</param>
/// <param name="data">Acces to cref="ServiceData".</param>
protected void SaveElementResult(ElementId elementId, Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass resultSchema, Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
Element element = data.Document.GetElement(elementId);
if (resultSchema != null)
storageDocument.ResultsManager.SetResult(resultSchema.GetEntity(), element, status, true);
}
}
}
@@ -0,0 +1,88 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents type of a calculation object.
/// </summary>
public enum CalculationObjectType
{
/// <summary>
/// Designed for elements objects.
/// </summary>
Element,
/// <summary>
/// Designed for sections objects.
/// </summary>
Section,
}
/// <summary>
/// Represents type of a calculation object.
/// </summary>
public enum ErrorResponse
{
/// <summary>
/// Execute the Run method when "false" value was returned in previus Run methods.
/// </summary>
RunOnError,
/// <summary>
/// Skip the Run method when "false" value was returned in previus Run methods.
/// </summary>
SkipOnError,
}
/// <summary>
/// Base interface for calculation objects.
/// </summary>
public interface ICalculationObject
{
/// <summary>
/// Runs calculation\operations for an element cref="ElementDataBase" object or for a section object cref="SectionDataBase".
/// </summary>
/// <param name="obj">An element object or a section object</param>
/// <returns>Result of calculation.</returns>
bool Run(ObjectDataBase obj);
/// <summary>
/// Sets and gets common parameters.
/// </summary>
CommonParametersBase Parameters { get; set; }
/// <summary>
/// Gets and sets type of the calculation object.
/// </summary>
CalculationObjectType Type { get; set; }
/// <summary>
/// Gets and sets a type of error response of the calculation object.
/// </summary>
ErrorResponse ErrorResponse { get; set; }
/// <summary>
/// Gets and sets categories for the calculation object.
/// </summary>
IList<Autodesk.Revit.DB.BuiltInCategory> Categories { get; set; }
}
}
@@ -0,0 +1,47 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Base interface for calculation scenario.
/// </summary>
public interface ICalculationScenario
{
/// <structural_toolkit_2015>
/// <summary>
/// Gets list of calculation objects cref="ICalculationObject".
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <returns>List of calculation objects.</returns>
List<ICalculationObject> CalculationScenarioList(Autodesk.Revit.DB.BuiltInCategory category, Autodesk.Revit.DB.StructuralAssetClass material);
/// </structural_toolkit_2015>
}
}
@@ -0,0 +1,137 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Base interface for the main loop class. Parameter of the constructor of the cref="Engine" class.
/// </summary>
public interface IEngineData
{
/// <summary>
/// Gets the unit system
/// </summary>
/// <returns>cref="DisplayUnit"</returns>
DisplayUnit GetInputDataUnitSystem();
/// <summary>
/// Gets number of available threads or processors.
/// </summary>
/// <param name="data">Service data.</param>
/// <returns>Number of threads</returns>
int GetNumberOfThreads(Autodesk.Revit.DB.CodeChecking.ServiceData data);
/// <structural_toolkit_2015>
/// <summary>
/// Creates user imlementation of cref="ICalculationScenario" which consists list of calculation objects cref="ICalculatinObject".
/// </summary>
/// <param name="parameters">Instance of base class with common parameters.</param>
/// <returns>The new instance of cref="ICalculationScenario"</returns>
ICalculationScenario CreateCalculationScenario(CommonParametersBase parameters);
/// </structural_toolkit_2015>
/// <summary>
/// Creates new instance of a class with common parameters.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="parameters">Instance of base class with common parameters.</param>
/// <returns>New instance of user implementation of class derived from cref="CommonParametersBase".</returns>
CommonParametersBase CreateCommonParameters(Autodesk.Revit.DB.CodeChecking.ServiceData data, CommonParametersBase parameters);
/// <summary>
/// Creates new instance of class with list of calculation points.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="parameters">User object with common parameters.</param>
/// <param name="elementId">Id of an element.</param>
/// <returns>List of calculation points.</returns>
List<CalcPoint> CreateCalcPointsForElement(Autodesk.Revit.DB.CodeChecking.ServiceData data, CommonParametersBase parameters, ElementId elementId);
/// <summary>
/// Creates new instance of user class which represents a section of a structure element.
/// </summary>
/// <param name="sectionDataBase">Instance of base class for the section.</param>
/// <returns>New instance of user implementation of section class derived from cref="SectionDataBase".</returns>
SectionDataBase CreateSectionData(SectionDataBase sectionDataBase);
/// <summary>
/// Creates new instance of user class which represents a structure element.
/// </summary>
/// <param name="elementDataBase">Instance of base class for the element.</param>
/// <returns>New instance of user implementation of element class derived from cref="ElementDataBase".</returns>
ElementDataBase CreateElementData(ElementDataBase elementDataBase);
/// <summary>
/// Creates new instance of class with results for the element.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <returns>User result schema object for the element.</returns>
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass CreateElementResult(Autodesk.Revit.DB.BuiltInCategory category, StructuralAssetClass material);
/// <summary>
/// Reads calculation parameters from revit data base.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>User calculation parameters schema object.</returns>
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass ReadCalculationParameter(Autodesk.Revit.DB.CodeChecking.ServiceData data);
/// <summary>
/// Reads parameters of user element label.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <param name="label">Acces to the Revit storage with labels."</param>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>User label of the element.</returns>
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass ReadElementLabel(Autodesk.Revit.DB.BuiltInCategory category, StructuralAssetClass material, Autodesk.Revit.DB.CodeChecking.Storage.Label label, Autodesk.Revit.DB.CodeChecking.ServiceData data);
/// <summary>
/// Verify parameters of user element label.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <param name="label">Element label."</param>
/// <param name="status">Reference to element's status".</param>
void VerifyElementLabel(Autodesk.Revit.DB.BuiltInCategory category, StructuralAssetClass material, Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label, ref Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status);
/// <summary>
/// Filters list of elements due to e.g. a result status for calculation purposes.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <returns>Filtered list of user element objects.</returns>
List<ObjectDataBase> FilterElementForCalculation(List<ObjectDataBase> listElementData);
/// <summary>
/// Gives possibility to read data from Revit data base and puts them into user element's objects and into user section's objects and into user common parameters.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <param name="parameters">User common parameters.</param>
/// <param name="data">Acces to cref="ServiceData".</param>
void ReadFromRevitDB(List<ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data);
/// <summary>
/// Gives possibility to write data to Revit data base.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <param name="parameters">User common parameters.</param>
/// <param name="data">Acces to cref="ServiceData".</param>
void SaveToRevitDB(List<ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data);
}
}
@@ -0,0 +1,109 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents a base of cref"ElementDataBase" or cref="SectionDataBase".
/// </summary>
public class ObjectDataBase
{
/// <summary>
/// Initializes a new instance of the ObjectDataBase object with list of parameters.
/// </summary>
/// <param name="elementId">Element identificator.</param>
/// <param name="elementCategory">Element category.</param>
/// <param name="elementMaterial">Element material.</param>
/// <param name="elementLabel">Element label.</param>
public ObjectDataBase(ElementId elementId,
Autodesk.Revit.DB.BuiltInCategory elementCategory,
StructuralAssetClass elementMaterial,
Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass elementLabel)
{
category = elementCategory;
material = elementMaterial;
elemId = new ElementId(elementId.IntegerValue); ;
label = elementLabel;
}
/// <summary>
/// Initializes a new instance of the ObjectDataBase from an existing one.
/// </summary>
/// <param name="data">Object data to copy</param>
public ObjectDataBase(ObjectDataBase data)
{
category = data.Category;
material = data.Material;
elemId = data.ElementId;
label = data.Label;
}
/// <summary>
/// Initializes a new instance of the ObjectDataBase.
/// </summary>
public ObjectDataBase() { }
/// <summary>
/// Gets the element's category.
/// </summary>
public Autodesk.Revit.DB.BuiltInCategory Category
{
get { return category; }
}
/// <summary>
/// Gets the element's material.
/// </summary>
public StructuralAssetClass Material
{
get { return material; }
}
/// <summary>
/// Gets the element's identificator.
/// </summary>
public ElementId ElementId
{
get { return elemId; }
}
/// <summary>
/// Gets the element's label schema.
/// </summary>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass Label
{
get { return label; }
}
private Autodesk.Revit.DB.BuiltInCategory category;
private StructuralAssetClass material;
private ElementId elemId;
private Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label;
}
}
@@ -0,0 +1,70 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
namespace CodeCheckingConcreteExample.Engine
{
/// <summary>
/// Represents a base of section data.
/// </summary>
public class SectionDataBase : ObjectDataBase
{
/// <summary>
/// Initializes a new instance of the SectionDataBase object with list of parameters.
/// </summary>
/// <param name="point">Calculation point.</param>
/// <param name="data">Object with base parameters for the section.</param>
public SectionDataBase(CalcPoint point, ObjectDataBase data)
: base(data)
{
calcPoint = point;
}
/// <summary>
/// Initializes a new instance of the SectionDataBase from an existing one.
/// </summary>
/// <param name="sectionDataBase">Section data to copy.</param>
public SectionDataBase(SectionDataBase sectionDataBase)
: base(sectionDataBase as ObjectDataBase)
{
calcPoint = sectionDataBase.CalcPoint;
}
private SectionDataBase() { }
/// <summary>
/// Gets a calculation point cref="CalcPoint".
/// </summary>
public CalcPoint CalcPoint
{
get { return calcPoint; }
}
private CalcPoint calcPoint;
}
}
@@ -0,0 +1,52 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using CodeCheckingConcreteExample.Engine;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's beam element.
/// </summary>
public class BeamElement : ElementDataBase
{
/// <summary>
/// Initializes a new instance of user's beam object.
/// </summary>
/// <param name="elementDataBase">Instance of base element object with predefined parameters to copy.</param>
public BeamElement(ElementDataBase elementDataBase)
: base(elementDataBase)
{
}
/// <summary>
/// Gets and sets cref="ElementInfo" object.
/// </summary>
public ElementInfo Info { get; set; }
}
}
@@ -0,0 +1,62 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's section of a beam element.
/// </summary>
class BeamSection : LinearSection
{
/// <summary>
/// Initializes a new instance of user's section object of beam element.
/// </summary>
/// <param name="sectionDataBase">Instance of base section object with predefined parameters to copy.</param>
public BeamSection(SectionDataBase sectionDataBase)
: base(sectionDataBase)
{
Width = 0.0;
Height = 0.0;
Geometry = new Geometry();
IsTSection = false;
ListInternalForces = new List<InternalForcesBase>();
MinStiffness = 0.0;
}
/// <summary>
/// gets and sets flag for T-shape section.
/// </summary>
public bool IsTSection { get; set; }
}
}
@@ -0,0 +1,136 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeCheckingConcreteExample.Engine;
using Autodesk.Revit.DB;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's calculation scenario.
/// </summary>
public class CalculationScenario : ICalculationScenario
{
#region ICalculationScenario Members
/// <summary>
/// Creates list of cref="ICalculationObject".
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <returns>List of cref="ICalculationObject".</returns>
public List<ICalculationObject> CalculationScenarioList(Autodesk.Revit.DB.BuiltInCategory category, Autodesk.Revit.DB.StructuralAssetClass material)
{
List<ICalculationObject> scenario = new List<ICalculationObject>();
/// <structural_toolkit_2015>
switch (material)
{
case StructuralAssetClass.Concrete:
switch (category)
{
case BuiltInCategory.OST_BeamAnalytical:
case BuiltInCategory.OST_ColumnAnalytical:
{
PrepareSectionData calcObj = new PrepareSectionData();
calcObj.Type = CalculationObjectType.Section;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_BeamAnalytical, BuiltInCategory.OST_ColumnAnalytical };
scenario.Add(calcObj);
}
{
ModifyElementForces calcObj = new ModifyElementForces();
calcObj.Type = CalculationObjectType.Element;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_BeamAnalytical, BuiltInCategory.OST_ColumnAnalytical };
scenario.Add(calcObj);
}
{
CalculateSection calcObj = new CalculateSection();
calcObj.Type = CalculationObjectType.Section;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_BeamAnalytical, BuiltInCategory.OST_ColumnAnalytical };
scenario.Add(calcObj);
}
{
CalculateDeflection calcObj = new CalculateDeflection();
calcObj.Type = CalculationObjectType.Element;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_BeamAnalytical };
scenario.Add(calcObj);
}
{
FillResultData calcObj = new FillResultData();
calcObj.Type = CalculationObjectType.Element;
calcObj.ErrorResponse = ErrorResponse.RunOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_BeamAnalytical, BuiltInCategory.OST_ColumnAnalytical };
scenario.Add(calcObj);
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
PrepareSectionData calcObj = new PrepareSectionData();
calcObj.Type = CalculationObjectType.Section;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_FloorAnalytical, BuiltInCategory.OST_FoundationSlabAnalytical, BuiltInCategory.OST_WallAnalytical };
scenario.Add(calcObj);
}
{
ModifyElementForces calcObj = new ModifyElementForces();
calcObj.Type = CalculationObjectType.Element;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_FloorAnalytical, BuiltInCategory.OST_FoundationSlabAnalytical, BuiltInCategory.OST_WallAnalytical };
scenario.Add(calcObj);
}
{
CalculateSection calcObj = new CalculateSection();
calcObj.Type = CalculationObjectType.Section;
calcObj.ErrorResponse = ErrorResponse.SkipOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_FloorAnalytical, BuiltInCategory.OST_FoundationSlabAnalytical, BuiltInCategory.OST_WallAnalytical };
scenario.Add(calcObj);
}
{
FillResultData calcObj = new FillResultData();
calcObj.Type = CalculationObjectType.Element;
calcObj.ErrorResponse = ErrorResponse.RunOnError;
calcObj.Categories = new List<BuiltInCategory>() { BuiltInCategory.OST_FloorAnalytical, BuiltInCategory.OST_FoundationSlabAnalytical, BuiltInCategory.OST_WallAnalytical };
scenario.Add(calcObj);
}
break;
}
break;
}
/// </structural_toolkit_2015>
return scenario;
}
#endregion
}
}
@@ -0,0 +1,52 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using CodeCheckingConcreteExample.Engine;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's colunn element.
/// </summary>
class ColumnElement : ElementDataBase
{
/// <summary>
/// Initializes a new instance of user's column object.
/// </summary>
/// <param name="elementDataBase">Instance of base element object with predefined parameters to copy.</param>
public ColumnElement(ElementDataBase elementDataBase)
: base(elementDataBase)
{
}
/// <summary>
/// Gets and sets cref="ElementInfo" object.
/// </summary>
public ElementInfo Info { get; set; }
}
}
@@ -0,0 +1,56 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's section of a column element.
/// </summary>
class ColumnSection : LinearSection
{
/// <summary>
/// Initializes a new instance of user's section object of column element.
/// </summary>
/// <param name="sectionDataBase">Instance of base section object with predefined parameters to copy.</param>
public ColumnSection(SectionDataBase sectionDataBase)
: base(sectionDataBase)
{
Width = 0.0;
Height = 0.0;
Geometry = new Geometry();
ListInternalForces = new List<InternalForcesBase>();
MinStiffness = 0.0;
}
}
}
@@ -0,0 +1,53 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Engine;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's object with common parameters.
/// </summary>
public class CommonParameters : CommonParametersBase
{
/// <summary>
/// Initializes a new instance of user's object with common parameters.
/// </summary>
/// <param name="data">Acces to cref="ServiceData"</param>
/// <param name="param">Instance of base common parameters object with predefined parameters to copy.</param>
public CommonParameters(Autodesk.Revit.DB.CodeChecking.ServiceData data, CommonParametersBase param)
: base(param)
{
}
/// <summary>
/// Gets and sets cref="ForceResultsCache" object.
/// </summary>
public ForceResultsCache ResultCache { get; set; }
}
}
@@ -0,0 +1,792 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Engine;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.ConcreteTypes;
using Autodesk.Revit.DB.CodeChecking.Storage;
using CodeCheckingConcreteExample.Properties;
using Autodesk.Revit.DB.CodeChecking;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's implementation of interface for the main loop class. Parameter of the default constructor of the cref="Engine" class.
/// </summary>
public class EngineData : IEngineData
{
#region IEngineData Members
/// <summary>
/// Gets the display unit which user want to use in the project.
/// </summary>
/// <returns>cref="DisplayUnit"</returns>
public Autodesk.Revit.DB.DisplayUnit GetInputDataUnitSystem()
{
DisplayUnit displayUnit = DisplayUnit.IMPERIAL;
if (Server.Server.UnitSystem == Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric)
displayUnit = DisplayUnit.METRIC;
return displayUnit;
}
/// <summary>
/// Gets number of available threads or processors. user could switch off parallel calculation by returning value 1.
/// </summary>
/// <param name="data">Service data.</param>
/// <returns>Number of threads</returns>
public int GetNumberOfThreads(Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
/// <structural_toolkit_2015>
if(Tools.IsJournalPlayback)
return 1;
else
return Environment.ProcessorCount;
/// </structural_toolkit_2015>
}
/// <summary>
/// Gets ForceCalculationDataDescriptor object for the current structure
/// </summary>
/// <param name="data">Service Data</param>
/// <param name="combinations">List of selected combinations ids </param>
/// <param name="elementId">Id of Revit element</param>
/// <returns>Reference to ForceCalculationDataDescriptor</returns>
protected ForceCalculationDataDescriptor GetForceCalculationDataDescriptor(Autodesk.Revit.DB.CodeChecking.ServiceData data, List<ElementId> combinations, ElementId elementId)
{
Tuple<Label,CalculationParameter,BuiltInCategory,Element> intData = GetElementInternalData(data, elementId);
Label ccLabel = intData.Item1;
CalculationParameter calculationParameters = intData.Item2;
BuiltInCategory category = intData.Item3;
Element element = intData.Item4;
List<ForceType> forceTypes = new List<ForceType>();// { ForceType.Fx, ForceType.Fy, ForceType.Fz, ForceType.Mx, ForceType.My, ForceType.Mz };
forceTypes = GetForceTypes(data, new ElementId[] { elementId });
ForceCalculationDataDescriptor descriptor = null;
/// <structural_toolkit_2015>
switch (category)
{
case BuiltInCategory.OST_ColumnAnalytical:
case BuiltInCategory.OST_BeamAnalytical:
{
double elementLength = (element as Autodesk.Revit.DB.Structure.AnalyticalModel).GetCurve().Length;
elementLength = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(elementLength, DisplayUnitType.DUT_METERS);
descriptor = new ForceCalculationDataDescriptorLinear(elementId, 1.0, calculationParameters.CalculationPointsSelector.GetPointCoordinates(data.Document, true, elementLength, elementId, combinations, forceTypes), true, forceTypes);
if (descriptor == null)
{
descriptor = new ForceCalculationDataDescriptorLinear(elementId);
}
}
break;
case BuiltInCategory.OST_FloorAnalytical:
case BuiltInCategory.OST_FoundationSlabAnalytical:
case BuiltInCategory.OST_WallAnalytical:
{
descriptor = new ForceCalculationDataDescriptor(elementId,forceTypes);
}
break;
}
if (descriptor == null)
{
descriptor = new ForceCalculationDataDescriptor(elementId,forceTypes);
}
/// </structural_toolkit_2015>
return descriptor;
}
/// <structural_toolkit_2015>
/// <summary>
/// Creates user imlementation of cref="ICalculationScenario" which consists list of calculation objects cref="ICalculatinObject".
/// </summary>
/// <param name="parameters">User common parameters.</param>
/// <returns>The new instance of cref="ICalculationScenario"</returns>
public ICalculationScenario CreateCalculationScenario(CommonParametersBase parameters)
{
return new CalculationScenario();
}
/// </structural_toolkit_2015>
/// <summary>
/// Creates new instance of user class wich represents a section of a structure element.
/// </summary>
/// <param name="sectionDataBase">Instance of base class for the section.</param>
/// <returns>New instance of user implementation of section class derived from cref="SectionDataBase".</returns>
public SectionDataBase CreateSectionData(SectionDataBase sectionDataBase)
{
switch (sectionDataBase.Material)
{
case StructuralAssetClass.Concrete:
switch (sectionDataBase.Category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
return new ColumnSection(sectionDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
return new BeamSection(sectionDataBase);
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
return new FloorSection(sectionDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
return new FloorSection(sectionDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
return new WallSection(sectionDataBase);
/// </structural_toolkit_2015>
}
break;
case StructuralAssetClass.Metal:
break;
}
return sectionDataBase;
}
/// <summary>
/// Creates new instance of user class wich represents a structure element.
/// </summary>
/// <param name="elementDataBase">Instance of base class for the element.</param>
/// <returns>New instance of user implementation of element class derived from cref="ElementDataBase".</returns>
public ElementDataBase CreateElementData(ElementDataBase elementDataBase)
{
switch (elementDataBase.Material)
{
case StructuralAssetClass.Concrete:
switch (elementDataBase.Category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
return new ColumnElement(elementDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
return new BeamElement(elementDataBase);
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
return new FloorElement(elementDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
return new FloorElement(elementDataBase);
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
return new WallElement(elementDataBase);
/// </structural_toolkit_2015>
}
break;
case StructuralAssetClass.Metal:
break;
}
return elementDataBase;
}
/// <summary>
/// Creates new instance of class with results for the element.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <returns>User result schema object for the element.</returns>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass CreateElementResult(Autodesk.Revit.DB.BuiltInCategory category, Autodesk.Revit.DB.StructuralAssetClass material)
{
switch (material)
{
case StructuralAssetClass.Concrete:
switch (category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
return new ResultBeam();
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
return new ResultColumn();
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
return new ResultFloor();
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
return new ResultFloor();
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
return new ResultWall();
/// </structural_toolkit_2015>
}
break;
case StructuralAssetClass.Metal:
break;
}
return null;
}
/// <summary>
/// Reads calculation parameters from revit data base.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>User calculation parameters schema object.</returns>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass ReadCalculationParameter(Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
CalculationParameter calculationParameter = storageDocument.CalculationParamsManager.CalculationParams.GetEntity<CalculationParameter>(data.Document);
return calculationParameter;
}
/// <summary>
/// Reads parameters of user element label.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <param name="label">Acces to the Revit storage with labels."</param>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <returns>User label of the element.</returns>
public Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass ReadElementLabel(Autodesk.Revit.DB.BuiltInCategory category, Autodesk.Revit.DB.StructuralAssetClass material, Autodesk.Revit.DB.CodeChecking.Storage.Label label, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
if (label != null)
{
switch (material)
{
case StructuralAssetClass.Concrete:
switch (category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical: return label.GetEntity<LabelColumn>(data.Document);
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical: return label.GetEntity<LabelBeam>(data.Document);
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical: return label.GetEntity<LabelFloor>(data.Document);
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical: return label.GetEntity<LabelFloor>(data.Document);
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical: return label.GetEntity<LabelWall>(data.Document);
/// </structural_toolkit_2015>
}
break;
case StructuralAssetClass.Metal:
break;
}
}
return null;
}
/// <summary>
/// Verify parameters of steel in the label.
/// </summary>
/// <param name="steel">Steel properties</param>
/// <param name="longitudinal">Information about the type of reinforcement. True if longitudinal.</param>
/// <returns></returns>
public List<string> VerifySteel(CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema steel, bool longitudinal)
{
List<string> errors = new List<string>();
if (steel.Material == null)
errors.Add(Resources.ResourceManager.GetString(longitudinal ? "ErrReinforcementMaterialL" : "ErrReinforcementMaterialT"));
else if (steel.MinimumYieldStress < Double.Epsilon)
errors.Add(Resources.ResourceManager.GetString(longitudinal ? "ErrReinforcementYieldStressL" : "ErrReinforcementYieldStressT"));
if (steel.RebarBarType == null || steel.BarDiameter < Double.Epsilon || steel.DeformationType == Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Unknown)
errors.Add(Resources.ResourceManager.GetString(longitudinal ? "ErrRebarL" : "ErrRebarT"));
return errors;
}
/// <summary>
/// Verify parameters of user element label.
/// </summary>
/// <param name="category">Category of the element.</param>
/// <param name="material">Material of the element.</param>
/// <param name="label">Element label."</param>
/// <param name="status">Reference to element's status".</param>
public void VerifyElementLabel(Autodesk.Revit.DB.BuiltInCategory category, StructuralAssetClass material, Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label,
ref Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status)
{
if (label != null)
{
switch (material)
{
case StructuralAssetClass.Concrete:
switch (category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
{
LabelColumn labelCol = label as LabelColumn;
if (labelCol != null)
{
if (labelCol.EnabledInternalForces.Count == 0)
status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
List<string> errors = VerifySteel(labelCol.LongitudinalReinforcement, true);
foreach(string s in errors)
status.AddError(s);
errors = VerifySteel(labelCol.TransversalReinforcement, false);
foreach(string s in errors)
status.AddError(s);
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
{
LabelBeam labelBm = label as LabelBeam;
if (labelBm != null)
{
if (labelBm.EnabledInternalForces.Count == 0)
status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
List<string> errors = VerifySteel(labelBm.LongitudinalReinforcement, true);
foreach(string s in errors)
status.AddError(s);
errors = VerifySteel(labelBm.TransversalReinforcement, false);
foreach(string s in errors)
status.AddError(s);
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
{
LabelFloor labelFloor = label as LabelFloor;
if (labelFloor != null)
{
if (labelFloor.EnabledInternalForces.Count == 0)
status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
List<string> errors = VerifySteel(labelFloor.PrimaryReinforcement, true);
foreach (string s in errors)
status.AddError(s);
errors = VerifySteel(labelFloor.SecondaryReinforcement, false);
foreach (string s in errors)
status.AddError(s);
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
LabelWall labelWall = label as LabelWall;
if (labelWall != null)
{
if (labelWall.EnabledInternalForces.Count == 0)
status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
List<string> errors = VerifySteel(labelWall.VerticalReinforcement, true);
foreach (string s in errors)
status.AddError(s);
errors = VerifySteel(labelWall.HorizontalReinforcement, false);
foreach (string s in errors)
status.AddError(s);
}
}
break;
}
break;
case StructuralAssetClass.Metal:
break;
}
}
}
/// <summary>
/// Filters list of elements due to e.g. a result status for calculation purposes.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <returns>Filtered list of user element objects.</returns>
public List<ObjectDataBase> FilterElementForCalculation(List<ObjectDataBase> listElementData)
{
List<ObjectDataBase> listElementFiltered = new List<ObjectDataBase>();
foreach (ObjectDataBase obj in listElementData)
{
ElementDataBase elem = obj as ElementDataBase;
if (elem != null)
{
if (!elem.Status.IsError())
{
listElementFiltered.Add(elem);
}
}
}
return listElementFiltered;
}
/// <summary>
/// Creates new instance of a user's class with common parameters.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="parameters">Instance of base class with common parameters.</param>
/// <returns>New instance of user implementation of class derived from cref="CommonParametersBase".</returns>
public CommonParametersBase CreateCommonParameters(Autodesk.Revit.DB.CodeChecking.ServiceData data, CommonParametersBase parameters)
{
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("DataPreparation"), 1);
CommonParameters commonParameters = new CommonParameters(data, parameters);
List<ForceCalculationDataDescriptor> calculationDataDescriptors = new List<ForceCalculationDataDescriptor>();
foreach (Tuple<ElementId,ResultStatus> elemStatus in commonParameters.ListElementStatus)
{
ForceCalculationDataDescriptor forceCalculationDataDescriptor = GetForceCalculationDataDescriptor(data, parameters.ListCombinationId, elemStatus.Item1);
///<structural_toolkit_2015>
if (forceCalculationDataDescriptor is ForceCalculationDataDescriptorLinear)
{
forceCalculationDataDescriptor.AddBendingForceTypes(new ForceType[] { ForceType.Ux, ForceType.Uy, ForceType.Uz });
}
///</structural_toolkit_2015>
calculationDataDescriptors.Add(forceCalculationDataDescriptor);
if (NotificationService.ProgressBreakInvoked())
break;
}
ForceResultsPackageDescriptor[] vResPackDesc = new ForceResultsPackageDescriptor[] { ForceResultsPackageDescriptor.GetResultPackageDescriptor(data.Document, commonParameters.ActivePackageGuid) };
// Uncomment the code below to dump to a text file the time spent on accessing ResultsBuilder
// Int64 forceResultsCacheAccessTime = System.DateTime.Now.Ticks;
commonParameters.ResultCache = new ForceResultsCache(data.Document, calculationDataDescriptors, vResPackDesc, commonParameters.ListCombinationId, GetInputDataUnitSystem());
// Uncomment the code below to dump to a text file the time spent on accessing ResultsBuilder
// forceResultsCacheAccessTime = System.DateTime.Now.Ticks - forceResultsCacheAccessTime;
foreach (Tuple<ElementId, ResultStatus> elemStatus in commonParameters.ListElementStatus)
{
ForceResultsCache.ElementResultsStatus resultStatus = commonParameters.ResultCache.GetElementResultsStatus(elemStatus.Item1);
if (resultStatus != ForceResultsCache.ElementResultsStatus.ResultsOK)
{
elemStatus.Item2.AddError(Resources.ResourceManager.GetString("ErrStaticResults"));
}
}
// Uncomment the code below to dump to a text file the time spent on accessing ResultsBuilder
// using (System.IO.StreamWriter writer = new System.IO.StreamWriter(data.Document.PathName + ".RBAccessTimeInfo.txt", true))
// {
// string resultBuilderAccessTime = DateTime.Now.ToString() + " Cache: " + (new System.TimeSpan(forceResultsCacheAccessTime)).TotalSeconds + " RB: " + (new System.TimeSpan(commonParameters.ResultCache.ResultBuilderAccessTime)).TotalSeconds;
//
// writer.WriteLine(resultBuilderAccessTime);
// }
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStep("");
return commonParameters;
}
/// <summary>
/// Creates new instance of class with list of calculation points for user's elements.
/// </summary>
/// <param name="data">Acces to cref="ServiceData".</param>
/// <param name="parameters">User object with common parameters.</param>
/// <param name="elementId">Id of an element.</param>
/// <returns>List of calculation points for user's element.</returns>
public List<CalcPoint> CreateCalcPointsForElement(Autodesk.Revit.DB.CodeChecking.ServiceData data, CommonParametersBase parameters, ElementId elementId)
{
List<CalcPoint> calculationPoints = new List<CalcPoint>();
CommonParameters commonParameters = parameters as CommonParameters;
if (commonParameters != null)
calculationPoints = commonParameters.ResultCache.GetCalculationPoints(elementId);
return calculationPoints;
}
/// <summary>
/// Gives possibility to read data from Revit data base and puts them into user element's objects and into user section's objects and into user common parameters.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <param name="parameters">User common parameters.</param>
/// <param name="data">Acces to cref="ServiceData".</param>
public void ReadFromRevitDB(List<ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
// read additional information from Revit data and store them in user objects derived from ElementDataBase and listed in listElementData
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("ReadingGeometry"), listElementData.Count);
ElementAnalyser elementAnalyser = new ElementAnalyser(GetInputDataUnitSystem());
int step = 0;
foreach (ObjectDataBase elemData in listElementData)
{
Element element = data.Document.GetElement(elemData.ElementId);
if (element != null)
{
switch (elemData.Category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
{
ColumnElement elem = elemData as ColumnElement;
if (elem != null && !elem.Status.IsError())
{
elem.Info = elementAnalyser.Analyse(element);
if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon)
elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus"));
MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific;
if (concrete == null || concrete.Compression < Double.Epsilon)
elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression"));
foreach (SectionDataBase sectionDataBase in elem.ListSectionData)
{
ColumnSection sec = sectionDataBase as ColumnSection;
if (sec != null)
sec.Info = elem.Info;
}
}
break;
}
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
{
BeamElement elem = elemData as BeamElement;
if (elem != null && !elem.Status.IsError())
{
elementAnalyser.TSectionAnalysis = false;
LabelBeam labelBeam = elem.Label as LabelBeam;
if (labelBeam != null)
{
elementAnalyser.TSectionAnalysis = ( labelBeam.SlabBeamInteraction == BeamSectionType.WithSlabBeamInteraction );
}
elem.Info = elementAnalyser.Analyse(element);
if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon)
elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus"));
MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific;
if (concrete == null || concrete.Compression < Double.Epsilon)
elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression"));
foreach (SectionDataBase sectionDataBase in elem.ListSectionData)
{
BeamSection sec = sectionDataBase as BeamSection;
if (sec != null)
sec.Info = elem.Info;
}
}
break;
}
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
{
FloorElement slab = elemData as FloorElement;
if (slab != null)
{
slab.Info = elementAnalyser.Analyse(element);
foreach (SectionDataBase secData in slab.ListSectionData)
{
FloorSection sec = secData as FloorSection;
if (sec != null)
sec.Info = slab.Info;
}
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
WallElement wall = elemData as WallElement;
if (wall != null)
{
wall.Info = elementAnalyser.Analyse(element);
foreach (SectionDataBase secData in wall.ListSectionData)
{
WallSection sec = secData as WallSection;
if (sec != null)
sec.Info = wall.Info;
}
}
}
break;
/// </structural_toolkit_2015>
}
}
Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStep(string.Format("{0:d}%", ++step * 100 / listElementData.Count));
if (NotificationService.ProgressBreakInvoked())
break;
}
}
/// <summary>
/// Gives possibility to write data to Revit data base.
/// </summary>
/// <param name="listElementData">List of user element objects.</param>
/// <param name="parameters">User common parameters.</param>
/// <param name="data">Acces to cref="ServiceData".</param>
public void SaveToRevitDB(List<ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.ResultsBuilder.Storage.ResultsPackageBuilder builder = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService().GetStorageDocument(data.Document).CalculationParamsManager.CalculationParams.GetOutputResultPackageBuilder(Server.Server.ID);
ForceResultsWriter resultsWriter = new ForceResultsWriter(data.Document, builder, Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric);
foreach (ObjectDataBase objectDataBase in listElementData)
{
ElementDataBase elementDataBase = objectDataBase as ElementDataBase;
if (!elementDataBase.Status.IsError())
{
switch (elementDataBase.Category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
{
//TBD - RB doesn't support relative coordinates as input
//Begin mod
//IList<double> vx = (from sec in elementDataBase.ListSectionData select (sec as LinearSection).GetCalcResultsInPt()[ResultTypeLinear.X_Rel ]).ToList();
bool isListForces = true;
foreach (LinearSection sec in elementDataBase.ListSectionData)
{
if (sec.ListInternalForces == null || sec.ListInternalForces.Count == 0)
{
isListForces = false;
break;
}
}
if (isListForces)
{
IList<double> xCoordinates = (from sec in elementDataBase.ListSectionData select (sec as LinearSection).GetCalcResultsInPoint()[ResultTypeLinear.X]).ToList();
//End Mod
resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.X, xCoordinates);
ResultTypeLinear[] resultTypesLinear = new ResultTypeLinear[] { ResultTypeLinear.Abottom, ResultTypeLinear.Atop, ResultTypeLinear.Aleft, ResultTypeLinear.Aright };
foreach (ResultTypeLinear forceType in resultTypesLinear)
{
ICollection<double> valuesInPoints = (from LinearSection section in elementDataBase.ListSectionData select section.GetCalcResultsInPoint()[forceType]).ToList();
resultsWriter.AddResultsForElement(elementDataBase.ElementId, forceType.GetResultType(), valuesInPoints);
}
}
}
break;
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
IList<double> vx = (from sec in elementDataBase.ListSectionData select (sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.X]).ToList();
IList<double> vy = (from sec in elementDataBase.ListSectionData select (sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.Y]).ToList();
IList<double> vz = (from sec in elementDataBase.ListSectionData select (sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.Z]).ToList();
resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.X, vx);
resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.Y, vy);
resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.Z, vz);
ResultTypeSurface[] vType = new ResultTypeSurface[] { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AyyTop };
foreach (ResultTypeSurface forceType in vType)
{
ICollection<double> vVal = (from sec in elementDataBase.ListSectionData select (sec as SurfaceSection).GetCalcResultsInPt()[forceType]).ToList();
resultsWriter.AddResultsForElement(elementDataBase.ElementId, forceType.GetResultType(), vVal);
}
break;
/// </structural_toolkit_2015>
}
}
}
resultsWriter.StoreResultsInResultsBuilder("RCCalculationsResults");
}
private Tuple<Label,CalculationParameter,BuiltInCategory,Element> GetElementInternalData(Autodesk.Revit.DB.CodeChecking.ServiceData data, ElementId elementId)
{
Element element = data.Document.GetElement(elementId);
BuiltInCategory category = Autodesk.Revit.DB.CodeChecking.Tools.GetCategoryOfElement(element);
StorageDocument storageDocument = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService().GetStorageDocument(data.Document);
CalculationParameter calculationParameter = storageDocument.CalculationParamsManager.CalculationParams.GetEntity<CalculationParameter>(data.Document);
Label ccLabel = storageDocument.LabelsManager.GetLabel(element);
return new Tuple<Label, CalculationParameter, BuiltInCategory, Element>(ccLabel, calculationParameter, category, element);
}
private List<ForceType> GetForceTypes(Autodesk.Revit.DB.CodeChecking.ServiceData data, IEnumerable<ElementId> elementsIds)
{
List<ForceType> forceTypes = new List<ForceType>();
foreach (ElementId elementId in elementsIds)
{
Tuple<Label, CalculationParameter, BuiltInCategory, Element> elementsInternalData = GetElementInternalData(data, elementId);
BuiltInCategory category = elementsInternalData.Item3;
Label ccLabel = elementsInternalData.Item1;
switch (category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
{
LabelColumn label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelColumn;
if (label != null)
{
forceTypes = label.EnabledInternalForces.Select(s => s.GetForceType()).ToList();
}
break;
}
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
{
LabelBeam label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelBeam;
if (label != null)
{
forceTypes = label.EnabledInternalForces.Select(s => s.GetForceType()).ToList();
}
break;
}
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
{
LabelFloor label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelFloor;
if (label != null)
{
if (label.EnabledInternalForces.Contains(EnabledInternalForces.MY))
{
forceTypes.Add(ForceType.Mxx);
forceTypes.Add(ForceType.Myy);
}
if (label.EnabledInternalForces.Contains(EnabledInternalForces.FX))
{
forceTypes.Add(ForceType.Fyy);
forceTypes.Add(ForceType.Fxx);
}
}
break;
}
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
LabelWall label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelWall;
if (label != null)
{
if (label.EnabledInternalForces.Contains(EnabledInternalForces.FX))
{
forceTypes.Add(ForceType.Fyy);
forceTypes.Add(ForceType.Fxx);
}
if (label.EnabledInternalForces.Contains(EnabledInternalForces.MY))
{
forceTypes.Add(ForceType.Mxx);
forceTypes.Add(ForceType.Myy);
}
}
break;
}
/// </structural_toolkit_2015>
}
}
return forceTypes;
}
#endregion
}
}
@@ -0,0 +1,42 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using CodeCheckingConcreteExample.Engine;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main.Calculation
{
class FloorElement : ElementDataBase
{
public FloorElement(ElementDataBase elementDataBase) : base(elementDataBase)
{
}
public ElementInfo Info { get; set; }
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,51 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.ConcreteTypes;
using DD = CodeCheckingConcreteExample.ConcreteTypes.DimensioningDirection;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main.Calculation
{
class FloorSection : SurfaceSection
{
public FloorSection(SectionDataBase sectionDataBase) : base(sectionDataBase)
{
Width = 0.0;
Height = 0.0;
Geometry = new Geometry();
ListInternalForces = new List<InternalForcesBase>();
MinStiffnes[DD.X] = MinStiffnes[DD.Y] = 0.0;
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,184 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main.Calculation
{
/// <summary>
/// Represents user's section of linear element.
/// </summary>
class LinearSection : SectionDataBase
{
/// <summary>
/// Initializes a new instance of user's section object of linear element.
/// </summary>
/// <param name="sectionDataBase">Instance of base section object with predefined parameters to copy.</param>
public LinearSection(SectionDataBase sectionDataBase)
: base(sectionDataBase)
{
DesignWarning = new List<string>();
DesignInfo = new List<string>();
DesignError = new List<string>();
}
/// <summary>
/// Gets analitical results for RC bar section
/// </summary>
/// <returns>Analitical results in the section.</returns>
public ResultInPointLinear GetCalcResultsInPoint()
{
ResultInPointLinear resultInPoint = null;
if (ListInternalForces != null && ListInternalForces.Count > 0)
{
resultInPoint = new ResultInPointLinear();
resultInPoint[ResultTypeLinear.X] = (CalcPoint as CalcPointLinear).CoordAbsolute;
resultInPoint[ResultTypeLinear.X_Rel] = (CalcPoint as CalcPointLinear).CoordRelative;
IEnumerable<double> vmx = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.MomentMx;
resultInPoint[ResultTypeLinear.MxMax] = vmx.Max();
resultInPoint[ResultTypeLinear.MxMin] = vmx.Min();
IEnumerable<double> vmy = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.MomentMy;
resultInPoint[ResultTypeLinear.MyMax] = vmy.Max();
resultInPoint[ResultTypeLinear.MyMin] = vmy.Min();
IEnumerable<double> vmz = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.MomentMz;
resultInPoint[ResultTypeLinear.MzMax] = vmz.Max();
resultInPoint[ResultTypeLinear.MzMin] = vmz.Min();
IEnumerable<double> vfx = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.ForceFx;
resultInPoint[ResultTypeLinear.FxMax] = vfx.Max();
resultInPoint[ResultTypeLinear.FxMin] = vfx.Min();
IEnumerable<double> vfy = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.ForceFy;
resultInPoint[ResultTypeLinear.FyMax] = vfy.Max();
resultInPoint[ResultTypeLinear.FyMin] = vfy.Min();
IEnumerable<double> vfz = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.ForceFz;
resultInPoint[ResultTypeLinear.FzMax] = vfz.Max();
resultInPoint[ResultTypeLinear.FzMin] = vfz.Min();
resultInPoint[ResultTypeLinear.Abottom] = AsBottom;
resultInPoint[ResultTypeLinear.Atop] = AsTop;
resultInPoint[ResultTypeLinear.Aleft] = AsLeft;
resultInPoint[ResultTypeLinear.Aright] = AsRight;
resultInPoint[ResultTypeLinear.StirrupsSpacing] = System.Math.Min(Spacing, 10.0);
resultInPoint[ResultTypeLinear.TransversalReinforcemenDensity] = TransversalDensity;
IEnumerable<double> vuz = from InternalForcesLinear ifo in ListInternalForces select ifo.Forces.DeflectionUz;
resultInPoint[ResultTypeLinear.UzMax] = vuz.Max();
resultInPoint[ResultTypeLinear.UzMin] = vuz.Min();
resultInPoint[ResultTypeLinear.UzRealMax] = StiffnesCoeff * vuz.Max();
resultInPoint[ResultTypeLinear.UzRealMin] = StiffnesCoeff * vuz.Min();
resultInPoint[ResultTypeLinear.UxRealMax] = resultInPoint[ResultTypeLinear.UxMax] = 0;
resultInPoint[ResultTypeLinear.UxRealMin] = resultInPoint[ResultTypeLinear.UxMin] = 0;
resultInPoint[ResultTypeLinear.UyRealMax] = resultInPoint[ResultTypeLinear.UyMax] = 0;
resultInPoint[ResultTypeLinear.UyRealMin] = resultInPoint[ResultTypeLinear.UyMin] = 0;
}
return resultInPoint;
}
/// <summary>
/// Gets and sets list of internal forces for section.
/// </summary>
public List<InternalForcesBase> ListInternalForces { get; set; }
/// <summary>
/// gets and sets geometry of the section.
/// </summary>
public Geometry Geometry { get; set; }
/// <summary>
/// gets and sets width of the section.
/// </summary>
public double Width { get; set; }
/// <summary>
/// gets and sets height of the section.
/// </summary>
public double Height { get; set; }
/// <summary>
/// Gets and sets bottom reinforcement
/// </summary>
public double AsBottom { get; set; }
/// <summary>
/// Gets and sets top reinforcement
/// </summary>
public double AsTop { get; set; }
/// <summary>
/// Gets and sets left reinforcement
/// </summary>
public double AsLeft { get; set; }
/// <summary>
/// Gets and sets right reinforcement
/// </summary>
public double AsRight { get; set; }
/// <summary>
/// Gets and sets stirrup spacing
/// </summary>
public double Spacing { get; set; }
/// <summary>
/// Gets and sets transversal reinforcement density
/// </summary>
public double TransversalDensity { get; set; }
/// <summary>
/// Gets and sets minimal stiffness property of RC section.
/// </summary>
public double MinStiffness { get; set; }
/// <summary>
/// Gets and sets a list of texts with calculation warnings.
/// </summary>
public double StiffnesCoeff { get; set; }
/// <summary>
/// Gets and sets a list of texts with calculation warnings.
/// </summary>
public List<string> DesignWarning { get; set; }
/// <summary>
/// Gets and sets a list of texts with additional calculation information.
/// </summary>
public List<string> DesignInfo { get; set; }
/// <summary>
/// Gets and sets a list of texts with calculation errors.
/// </summary>
public List<string> DesignError { get; set; }
/// <summary>
/// Gets and sets cref="ElementInfo" object.
/// </summary>
public ElementInfo Info { get; set; }
}
}
@@ -0,0 +1,135 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.ConcreteTypes;
using DD = CodeCheckingConcreteExample.ConcreteTypes.DimensioningDirection;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main.Calculation
{
class SurfaceSection : SectionDataBase
{
/// <summary>
/// Initializes a new instance of user's section object of linear element.
/// </summary>
/// <param name="sectionDataBase">Instance of base section object with predefined parameters to copy.</param>
public SurfaceSection(SectionDataBase sectionDataBase)
: base(sectionDataBase)
{
DesignWarning = new Dictionary<DD, List<string>>() { { DD.X, new List<string>() }, { DD.Y, new List<string>() } };
DesignInfo = new Dictionary<DD, List<string>>() { { DD.X, new List<string>() }, { DD.Y, new List<string>() } };
DesignError = new Dictionary<DD, List<string>>() { { DD.X, new List<string>() }, { DD.Y, new List<string>() } };
}
/// <summary>
/// Gets analitical results for RC surface elements (floor, slab, wall)
/// </summary>
/// <returns>Analitical results in the section.</returns>
public ResultInPointSurface GetCalcResultsInPt()
{
ResultInPointSurface resultInPoint = new ResultInPointSurface();
List<InternalForcesBase> vForces = ListInternalForces;
resultInPoint[ResultTypeSurface.X] = (CalcPoint as CalcPointSurface).Coord.X;
resultInPoint[ResultTypeSurface.Y] = (CalcPoint as CalcPointSurface).Coord.Y;
resultInPoint[ResultTypeSurface.Z] = (CalcPoint as CalcPointSurface).Coord.Z;
IEnumerable<double> vmxx = from ifo in vForces let mxx = (ifo as InternalForcesSurface).MomentMxx select mxx;
resultInPoint[ResultTypeSurface.MxxMax] = vmxx.Max();
resultInPoint[ResultTypeSurface.MxxMin] = vmxx.Min();
IEnumerable<double> vmyy = from ifo in vForces let myy = (ifo as InternalForcesSurface).MomentMyy select myy;
resultInPoint[ResultTypeSurface.MyyMax] = vmyy.Max();
resultInPoint[ResultTypeSurface.MyyMin] = vmyy.Min();
IEnumerable<double> vmxy = from ifo in vForces let mxy = (ifo as InternalForcesSurface).MomentMxy select mxy;
resultInPoint[ResultTypeSurface.MxyMax] = vmxy.Max();
resultInPoint[ResultTypeSurface.MxyMin] = vmxy.Min();
IEnumerable<double> fmxx = from ifo in vForces let fxx = (ifo as InternalForcesSurface).ForceFxx select fxx;
resultInPoint[ResultTypeSurface.FxxMax] = fmxx.Max();
resultInPoint[ResultTypeSurface.FxxMin] = fmxx.Min();
IEnumerable<double> fmyy = from ifo in vForces let fyy = (ifo as InternalForcesSurface).ForceFyy select fyy;
resultInPoint[ResultTypeSurface.FyyMax] = fmyy.Max();
resultInPoint[ResultTypeSurface.FyyMin] = fmyy.Min();
IEnumerable<double> fmxy = from ifo in vForces let fxy = (ifo as InternalForcesSurface).ForceFxy select fxy;
resultInPoint[ResultTypeSurface.FxyMax] = fmxy.Max();
resultInPoint[ResultTypeSurface.FxyMin] = fmxy.Min();
IEnumerable<double> qmxx = from ifo in vForces let qxx = (ifo as InternalForcesSurface).ForceQxx select qxx;
resultInPoint[ResultTypeSurface.QxxMax] = qmxx.Max();
resultInPoint[ResultTypeSurface.QxxMin] = qmxx.Min();
IEnumerable<double> qmyy = from ifo in vForces let qyy = (ifo as InternalForcesSurface).ForceQyy select qyy;
resultInPoint[ResultTypeSurface.QyyMax] = qmyy.Max();
resultInPoint[ResultTypeSurface.QyyMin] = qmyy.Min();
resultInPoint[ResultTypeSurface.AxxBottom] = AsBottom[DD.X];
resultInPoint[ResultTypeSurface.AxxTop] = AsTop[DD.X];
resultInPoint[ResultTypeSurface.AyyBottom] = AsBottom[DD.Y];
resultInPoint[ResultTypeSurface.AyyTop] = AsTop[DD.Y];
return resultInPoint;
}
public List<InternalForcesBase> ListInternalForces { get; set; }
public Geometry Geometry { get; set; }
public double Width { get; set; }
public double Height { get; set; }
public Dictionary<DD, double> AsBottom = new Dictionary<DD, double>() { { DD.X, 0.00 }, { DD.Y, 0.00 } };
public Dictionary<DD, double> AsTop = new Dictionary<DD, double>() { { DD.X, 0.00 }, { DD.Y, 0.00 } };
public Dictionary<DD, double> MinStiffnes = new Dictionary<DD, double>() { { DD.X, 0.0 }, { DD.Y, 0.0 } };
public Dictionary<DD, List<Rebar>> LRebar = new Dictionary<DD, List<Rebar>>() { { DD.X, null }, { DD.Y, null } };
/// <summary>
/// Gets and sets a list of texts with calculation warnings.
/// </summary>
public Dictionary<DD, List<string>> DesignWarning { get; set; }
/// <summary>
/// Gets and sets a list of texts with additional calculation information.
/// </summary>
public Dictionary<DD, List<string>> DesignInfo { get; set; }
/// <summary>
/// Gets and sets a list of texts with calculation errors.
/// </summary>
public Dictionary<DD, List<string>> DesignError { get; set; }
/// <summary>
/// Gets and sets cref="ElementInfo" object.
/// </summary>
public ElementInfo Info { get; set; }
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,40 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeCheckingConcreteExample.Engine;
using Autodesk.Revit.DB.CodeChecking.Engineering;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main.Calculation
{
class WallElement : ElementDataBase
{
public WallElement(ElementDataBase elementDataBase) : base(elementDataBase)
{
}
public ElementInfo Info { get; set; }
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,52 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.CodeChecking.Concrete;
using CodeCheckingConcreteExample.Engine;
using CodeCheckingConcreteExample.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.ConcreteTypes;
using DD = CodeCheckingConcreteExample.ConcreteTypes.DimensioningDirection;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main.Calculation
{
class WallSection : SurfaceSection
{
public WallSection(SectionDataBase sectionDataBase) : base(sectionDataBase)
{
Width = 0.0;
Height = 0.0;
Geometry = new Geometry();
ListInternalForces = new List<InternalForcesBase>();
MinStiffnes[DD.X] = MinStiffnes[DD.Y] = 0.0;
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,55 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for code Calculation parameters
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("CalculationParam", "b3004f6e-cf05-4cad-8945-dba92d09372a")]
public class CalculationParameter : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Calculation points selection component
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "CalcPointSelector")]
[CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector.CalculationPointsSelector(Category = "CalcPointSelector")]
public CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector.CalculationPointsSelectorSchema CalculationPointsSelector { get; set; }
/// <summary>
/// Creates default CalculationParameter
/// </summary>
public CalculationParameter()
{
CalculationPointsSelector = new CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector.CalculationPointsSelectorSchema();
CalculationPointsSelector.ElementDivisionType = CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector.CalculationPointsSelectorSchema.DivisionType.Points;
CalculationPointsSelector.UniformDistribution = 11;
}
}
}
@@ -0,0 +1,171 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.ConcreteTypes;
using CT = CodeCheckingConcreteExample.ConcreteTypes;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Values validator for beam label.
/// </summary>
public class ValueValidatorBeam : IFieldValidator
{
/// <summary>
/// Validates the value.
/// </summary>
/// <param name="entity">The entity.</param>
/// <param name="field">The field.</param>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
/// <returns>Information about data validation.</returns>
public bool ValidateValue(object entity, string field, object value, DisplayUnitType unit)
{
if (field == "CreepCoefficient")
{
return (double)value > 0;
}
return true;
}
}
/// <summary>
/// Container for RC beam element material and calculation options
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("LabelBeam", "969f2bcf-b1b6-44c2-94af-f6aeff453705")]
public class LabelBeam : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Classification of available forces for beam
/// </summary>
public enum EnabledInternalForcesForBeam
{
/// <summary>
/// Axial force. The force acting along the element.
/// </summary>
FX = ConcreteTypes.EnabledInternalForces.FX,
/// <summary>
/// Shear force. The force acting perpendicular to the element along Z axis.
/// </summary>
FZ = ConcreteTypes.EnabledInternalForces.FZ,
/// <summary>
/// Torsional moment.
/// </summary>
MX = ConcreteTypes.EnabledInternalForces.MX,
/// <summary>
/// Bending moment. Bending around the Y axis.
/// </summary>
MY = ConcreteTypes.EnabledInternalForces.MY,
}
/// <summary>
/// Collection of beam simple calculation
/// representing calculation options chosen by the user
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "BeamCalculationType")]
[EnumControl(Description = "EnabledInternalForces", Category = "CalculationOptions", EnumType = typeof(EnabledInternalForcesForBeam), Presentation = PresentationMode.OptionList, Item = PresentationItem.ImageWithText, ImageSize = ImageSize.Medium, Context = "BeamLabel")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ListValue(Name = "EnabledInternalForces", Localizable = true, LocalizableValue = true)]
public List<EnabledInternalForcesForBeam> EnabledInternalForcesBeam { get; set; }
/// <summary>
/// Creep coefficient
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "CreepCoefficient", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "CreepCoefficient", Category = "CalculationOptions", IsVisible = true, IsEnabled = true, Index = -1, Localizable = true, FieldValidator = typeof(ValueValidatorBeam))]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "CreepCoefficient", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double CreepCoefficient { get; set; }
/// <summary>
/// Section type object(flanges/no flanges) representing
/// option chosen by the user
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty]
[EnumControl(Description = "SlabBeamInteraction", Category = "CalculationOptions", Index = -1, EnumType = typeof(ConcreteTypes.BeamSectionType), Presentation = PresentationMode.ToggleButton, Item = PresentationItem.Image, ImageSize = ImageSize.Medium, Context = "BeamLabel")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "SlabBeamInteraction", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public ConcreteTypes.BeamSectionType SlabBeamInteraction { get; set; }
/// <summary>
/// Rebar parameters component for longitudinal reinforcement
///</summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "LongitudinalReinforcement")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "LongitudinalReinforcement")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.SubSchemaElement(LocalizableValue = true, Name = "LongitudinalReinforcement", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema LongitudinalReinforcement { get; set; }
/// <summary>
/// Rebar parameters component for transversal reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "TransversalReinforcement")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "TransversalReinforcement")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.SubSchemaElement(LocalizableValue = true, Name = "TransversalReinforcement", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema TransversalReinforcement { get; set; }
/// <summary>
/// Creates default LabelBeam
/// </summary>
public LabelBeam()
{
LongitudinalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
CreepCoefficient = 2.0;
TransversalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
EnabledInternalForcesBeam = new List<EnabledInternalForcesForBeam>();
EnabledInternalForcesBeam.Add(EnabledInternalForcesForBeam.MY);
EnabledInternalForcesBeam.Add(EnabledInternalForcesForBeam.FZ);
SlabBeamInteraction = ConcreteTypes.BeamSectionType.WithSlabBeamInteraction;
}
/// <summary>
/// Transversal calculation type ( compression, bending, excentric bending....)
/// </summary>
public ConcreteTypes.CalculationType TransversalCalculationType { get { return EnabledInternalForces.GetTransversalCalculationType(); } }
/// <summary>
/// Longitudinal calculation type (shearing, tortion, ...)
/// </summary>
public ConcreteTypes.CalculationType LongitudinalCalculationType { get { return EnabledInternalForces.GetLongitudinalCalculationType(); } }
/// <summary>
/// Returns EnabledInternalForces based on EnabledInternalForcesBeam
/// </summary>
public List<ConcreteTypes.EnabledInternalForces> EnabledInternalForces
{
get
{
List<ConcreteTypes.EnabledInternalForces> EInternalForces = new List<ConcreteTypes.EnabledInternalForces>();
foreach (EnabledInternalForcesForBeam enabledInternalForcesBeam in EnabledInternalForcesBeam)
{
EInternalForces.Add((EnabledInternalForces)enabledInternalForcesBeam);
}
return EInternalForces;
}
}
}
}
@@ -0,0 +1,189 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.ConcreteTypes;
using Autodesk.Revit.DB.ExtensibleStorage.Framework;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Values validator for column label.
/// </summary>
public class ValueValidatorColumn : IFieldValidator
{
/// <summary>
/// Validates the value.
/// </summary>
/// <param name="entity">The entity.</param>
/// <param name="field">The field.</param>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
/// <returns>Information about data validation.</returns>
public bool ValidateValue(object entity, string field, object value, DisplayUnitType unit)
{
if (field == "CreepCoefficient")
{
return (double)value > 0;
}
if (field == "LengthCoefficientY" || field == "LengthCoefficientZ")
{
return (double)value >= 0;
}
return true;
}
}
/// <summary>
/// Container for RC column element material and calculation options
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("LabelColumn", "68099b9b-ed86-443a-859c-49cb40842a50")]
[Categories(new string[] { "CalculationOptions", "Buckling", "LongitudinalReinforcement", "TransversalReinforcement" }, new int[] { 1, 2, 3, 4 })]
public class LabelColumn : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Collection of simple calculation type objects
/// representing calculation options chosen by the user
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "ColumnCalculationType")]
[EnumControl(Description = "EnabledInternalForces", Category = "CalculationOptions", EnumType = typeof(ConcreteTypes.EnabledInternalForces), Presentation = PresentationMode.OptionList, Item = PresentationItem.ImageWithText, ImageSize = ImageSize.Medium, Context = "ColumnLabel")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ListValue(Name = "EnabledInternalForces", Index = 1, Localizable = true, LocalizableValue = true)]
public List<ConcreteTypes.EnabledInternalForces> EnabledInternalForces { get; set; }
/// <summary>
/// Creep coefficient
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "CreepCoefficient", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "CreepCoefficient", Category = "CalculationOptions", IsVisible = true, IsEnabled = true, Index = -1, Localizable = true, FieldValidator = typeof(ValueValidatorColumn))]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "CreepCoefficient", Index = 2, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double CreepCoefficient { get; set; }
/// <summary>
/// Take into account buckling on direction Y when calculating element
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "BucklingDirectionY")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.CheckBox(Category = "Buckling", Description = "BucklingDirectionY", IsVisible = true, IsEnabled = true, Index = 2, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "BucklingDirectionY", Index = 3, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public bool BucklingDirectionY { get; set; }
/// <summary>
/// Value of the buckling coefficietn on direction Y
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "LengthCoefficientY", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Category = "Buckling", Description = "LengthCoefficientY", IsVisible = true, IsEnabled = true, Index = 3, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "LengthCoefficientY", Index = 4, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double LengthCoefficientY { get; set; }
/// <summary>
/// Structure type on direction Y: Sway or No-sway
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "ColumnStructureTypeY")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.EnumControl(EnumType = typeof(ConcreteTypes.ColumnStructureType), Presentation = Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.PresentationMode.Combobox, Item = Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.PresentationItem.Text, Category = "Buckling", Description = "ColumnStructureType", IsVisible = true, IsEnabled = true, Index = 4, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "ColumnStructureType", Index = 5, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public ConcreteTypes.ColumnStructureType ColumnStructureTypeY { get; set; }
/// <summary>
/// Take into account buckling on direction Z when calculating element
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "BucklingDirectionZ")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.CheckBox(Category = "Buckling", Description = "BucklingDirectionZ", IsVisible = true, IsEnabled = true, Index = 5, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "BucklingDirectionZ", Index = 6, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public bool BucklingDirectionZ { get; set; }
/// <summary>
/// Value of the buckling coefficietn on direction Z
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "LengthCoefficientZ", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Category = "Buckling", Description = "LengthCoefficientZ", IsVisible = true, IsEnabled = true, Index = 6, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "LengthCoefficientZ", Index = 7, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double LengthCoefficientZ { get; set; }
/// <summary>
/// Structure type on direction Z: Sway or No-sway
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "ColumnStructureTypeZ")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.EnumControl(EnumType = typeof(ConcreteTypes.ColumnStructureType), Presentation = Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.PresentationMode.Combobox, Item = Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.PresentationItem.Text, Category = "Buckling", Description = "ColumnStructureType", IsVisible = true, IsEnabled = true, Index = 7, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "ColumnStructureType", Index = 8, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public ConcreteTypes.ColumnStructureType ColumnStructureTypeZ { get; set; }
/// <summary>
/// Rebar parameters component for longitudinal reinforcement
///</summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "LongitudinalReinforcement")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "LongitudinalReinforcement")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.SubSchemaElement(LocalizableValue = true, Name = "LongitudinalReinforcement", Index = 9, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema LongitudinalReinforcement { get; set; }
/// <summary>
/// Rebar parameters component for transversal reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "TransversalReinforcement")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "TransversalReinforcement")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.SubSchemaElement(LocalizableValue = true, Name = "TransversalReinforcement", Index = 10, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema TransversalReinforcement { get; set; }
/// <summary>
/// Creates default LabelColumn
/// </summary>
public LabelColumn()
{
LongitudinalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
CreepCoefficient = 2.0;
TransversalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
EnabledInternalForces = new List<ConcreteTypes.EnabledInternalForces>();
EnabledInternalForces.Add(ConcreteTypes.EnabledInternalForces.MY);
EnabledInternalForces.Add(ConcreteTypes.EnabledInternalForces.FX);
LengthCoefficientY = 1.0;
LengthCoefficientZ = 1.0;
BucklingDirectionY = true;
BucklingDirectionZ = true;
ColumnStructureTypeY = ConcreteTypes.ColumnStructureType.NonSway;
ColumnStructureTypeZ = ConcreteTypes.ColumnStructureType.NonSway;
}
/// <summary>
/// Transversal calculation type ( compression, bending, excentric bending....)
/// </summary>
public ConcreteTypes.CalculationType TransversalCalculationType
{
get { return EnabledInternalForces.GetTransversalCalculationType(); }
}
/// <summary>
/// Longitudinal calculation type (shearing, tortion, ...)
/// </summary>
public ConcreteTypes.CalculationType LongitudinalCalculationType
{
get { return EnabledInternalForces.GetLongitudinalCalculationType(); }
}
}
}
@@ -0,0 +1,147 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.ConcreteTypes;
using CT = CodeCheckingConcreteExample.ConcreteTypes;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample
{
/// <summary>
/// Values validator for beam label.
/// </summary>
public class ValueValidatorFloor : IFieldValidator
{
/// <summary>
/// Validates the value.
/// </summary>
/// <param name="entity">The entity.</param>
/// <param name="field">The field.</param>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
/// <returns>Information about data validation.</returns>
public bool ValidateValue(object entity, string field, object value, DisplayUnitType unit)
{
if (field == "CreepCoefficient")
{
return (double)value > 0;
}
return true;
}
}
/// <summary>
/// Container for RC floor and slab foundation elements material and calculation options
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("LabelFloor", "7606E4E9-7A81-4975-A231-0052599F6939")]
public class LabelFloor : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Classification of available forces for column
/// </summary>
public enum EnabledInternalForcesForFloor
{
/// <summary>
/// Axial force. The force acting along the element.
/// </summary>
FX = ConcreteTypes.EnabledInternalForces.FX,
/// <summary>
/// Bending moment. Bending around the Y axis.
/// </summary>
MY = ConcreteTypes.EnabledInternalForces.MY,
}
/// <summary>
/// Collection of beam simple calculation
/// representing calculation options chosen by the user
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "FloorCalculationType")]
[EnumControl(Description = "EnabledInternalForces", Category = "CalculationOptions", EnumType = typeof(EnabledInternalForcesForFloor), Presentation = PresentationMode.OptionList, Item = PresentationItem.ImageWithText, ImageSize = ImageSize.Medium, Context = "FloorLabel")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ListValue(Name = "EnabledInternalForces", Index = 1, Localizable=true, LocalizableValue = true)]
public List<EnabledInternalForcesForFloor> EnabledInternalForcesFloor { get; set; }
/// <summary>
/// Rebar parameters component for primary reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "PrimaryRnfSteelParameters")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "PrimaryRnfSteelParameters")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "PrimaryRnfSteelParameters", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema PrimaryReinforcement { get; set; }
/// <summary>
/// Rebar parameters component for secondary reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "SecondaryRnfSteelParameters")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "SecondaryRnfSteelParameters")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "SecondaryRnfSteelParameters", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema SecondaryReinforcement { get; set; }
/// <summary>
/// Creep coefficient
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "CreepCoefficient", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "CreepCoefficient", Category = "CalculationOptions", IsVisible = true, IsEnabled = true, Index = -1, Localizable = true, FieldValidator = typeof(ValueValidatorFloor))]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "CreepCoefficient", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double CreepCoefficient { get; set; }
/// <summary>
/// Longitudinal calculation type (shearing, tortion, ...)
/// </summary>
public ConcreteTypes.CalculationType LongitudinalCalculationType { get { return EnabledInternalForces.GetLongitudinalCalculationType(); } }
/// <summary>
/// Returns EnabledInternalForces based on EnabledInternalForcesFloor
/// </summary>
public List<ConcreteTypes.EnabledInternalForces> EnabledInternalForces
{
get
{
List<ConcreteTypes.EnabledInternalForces> EInternalForces = new List<ConcreteTypes.EnabledInternalForces>();
foreach (EnabledInternalForcesForFloor enabledInternalForcesFloor in EnabledInternalForcesFloor)
{
EInternalForces.Add((ConcreteTypes.EnabledInternalForces)enabledInternalForcesFloor);
}
return EInternalForces;
}
}
/// <summary>
/// Creates default LabelFloor
/// </summary>
public LabelFloor()
{
PrimaryReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
SecondaryReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
CreepCoefficient = 2.0;
EnabledInternalForcesFloor = new List<EnabledInternalForcesForFloor>();
EnabledInternalForcesFloor.Add(EnabledInternalForcesForFloor.MY);
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,144 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.ConcreteTypes;
using CT = CodeCheckingConcreteExample.ConcreteTypes;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
namespace CodeCheckingConcreteExample
{
/// <structural_toolkit_2015>
/// <summary>
/// Values validator for beam label.
/// </summary>
public class ValueValidatorWall : IFieldValidator
{
/// <summary>
/// Validates the value.
/// </summary>
/// <param name="entity">The entity.</param>
/// <param name="field">The field.</param>
/// <param name="value">The value.</param>
/// <param name="unit">The unit.</param>
/// <returns></returns>
public bool ValidateValue(object entity, string field, object value, DisplayUnitType unit)
{
if (field == "CreepCoefficient")
{
return (double)value > 0;
}
return true;
}
}
/// <summary>
/// Represents labels.
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("LabelWall", "47899fc7-3396-4c02-b8a1-98d720d540d2")]
public class LabelWall : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Classification of available forces for column
/// </summary>
public enum EnabledInternalForcesForWall
{
/// <summary>
/// Axial force. Fxx and Fyy.
/// </summary>
FX = ConcreteTypes.EnabledInternalForces.FX,
MX = ConcreteTypes.EnabledInternalForces.MY,
}
/// <summary>
/// Collection of beam simple calculation
/// representing calculation options chosen by the user
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "WallCalculationType")]
[EnumControl(Description = "EnabledInternalForces", Category = "CalculationOptions", EnumType = typeof(EnabledInternalForcesForWall), Presentation = PresentationMode.OptionList, Item = PresentationItem.ImageWithText, ImageSize = ImageSize.Medium, Context = "WallLabel")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ListValue(Name = "EnabledInternalForces", Index = 1, Localizable=true, LocalizableValue = true)]
public List<EnabledInternalForcesForWall> EnabledInternalForcesWall { get; set; }
/// <summary>
/// Rebar parameters component for vertical reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "VerticalRnfSteelParameters")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "VerticalRnfSteelParameters")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "VerticalRnfSteelParameters", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema VerticalReinforcement { get; set; }
/// <summary>
/// Rebar parameters component for horizontal reinforcement
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "HorizontalRnfSteelParameters")]
[CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParameters(Category = "HorizontalRnfSteelParameters")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "HorizontalRnfSteelParameters", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema HorizontalReinforcement { get; set; }
/// <summary>
/// Creep coefficient
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "CreepCoefficient", Unit = Autodesk.Revit.DB.UnitType.UT_Number, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_GENERAL)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "CreepCoefficient", Category = "CalculationOptions", IsVisible = true, IsEnabled = true, Index = -1, Localizable = true, FieldValidator = typeof(ValueValidatorWall))]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "CreepCoefficient", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double CreepCoefficient { get; set; }
/// <summary>
/// Longitudinal calculation type (shearing, tortion, ...)
/// </summary>
public ConcreteTypes.CalculationType LongitudinalCalculationType { get { return EnabledInternalForces.GetLongitudinalCalculationType(); } }
/// <summary>
/// Returns EnabledInternalForces based on EnabledInternalForcesFloor
/// </summary>
public List<ConcreteTypes.EnabledInternalForces> EnabledInternalForces
{
get
{
List<ConcreteTypes.EnabledInternalForces> EInternalForces = new List<ConcreteTypes.EnabledInternalForces>();
foreach (EnabledInternalForcesForWall enabledInternalForcesWall in EnabledInternalForcesWall)
{
EInternalForces.Add((ConcreteTypes.EnabledInternalForces)enabledInternalForcesWall);
}
return EInternalForces;
}
}
/// <summary>
/// Creates default LabelWall
/// </summary>
public LabelWall()
{
VerticalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
HorizontalReinforcement = new CodeCheckingConcreteExample.UIComponents.RCSteelParameters.RCSteelParametersSchema();
CreepCoefficient = 2.0;
EnabledInternalForcesWall = new List<EnabledInternalForcesForWall>();
EnabledInternalForcesWall.Add(EnabledInternalForcesForWall.FX);
EnabledInternalForcesWall.Add(EnabledInternalForcesForWall.MX);
}
}
/// </structural_toolkit_2015>
}
@@ -0,0 +1,49 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for RC beam results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultBeam", "37824421-6bfb-44a5-b1e7-1d382e5e8ee1")]
public class ResultBeam : ResultLinearElement
{
/// <summary>
/// Creates default ResultBeam
/// </summary>
public ResultBeam()
: base()
{
}
}
}
@@ -0,0 +1,49 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for RC column results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultColumn", "7952996a-4318-4be9-ac18-9fa090ce8be1")]
public class ResultColumn : ResultLinearElement
{
/// <summary>
/// Creates default ResultColumn
/// </summary>
public ResultColumn()
: base()
{
}
}
}
@@ -0,0 +1,49 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Utility;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for RC floor and slab foundation results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultFloor", "1EC6295D-BDED-4B07-8713-45D985339AB3")]
public class ResultFloor : ResultSurfaceElement
{
/// <summary>
/// Creates default ResultFloor
/// </summary>
public ResultFloor()
: base()
{
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,76 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for RC linear element results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultLinearElement", "94c5ab24-8e77-47a2-b437-750f43451b23")]
public class ResultLinearElement : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Collection of values representing element results in raw format
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(Unit = Autodesk.Revit.DB.UnitType.UT_Length, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_METERS)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ListValue(Name = "ValuesInPoints", LocalizableValue = false, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = false)]
public List<Double> ValuesInPointsData { get; set; }
/// <summary>
/// Gets results in point formatted as a list of ResultInPointLinear elements
/// </summary>
/// <returns>List of ResultInPointLinear</returns>
public List<ResultInPointLinear> GetResultsInPointsCollection()
{
IEnumerable<ResultTypeLinear> linearResultTypes = Enum.GetValues(typeof(ResultTypeLinear)).OfType<ResultTypeLinear>();
int numberOfResultTypes = linearResultTypes.Count(),
numberOfPoints = ValuesInPointsData.Count / numberOfResultTypes;
List<ResultInPointLinear> resultsInPoints = new List<ResultInPointLinear>();
for (int ptId = 0; ptId < numberOfPoints; ptId++)
{
resultsInPoints.Add(new ResultInPointLinear(ValuesInPointsData.GetRange(ptId * numberOfResultTypes, numberOfResultTypes)));
}
return resultsInPoints;
}
/// <summary>
/// Creates default ResultLinearElement
/// </summary>
public ResultLinearElement()
{
ValuesInPointsData = new List<double>();
}
}
}
@@ -0,0 +1,130 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using CodeCheckingConcreteExample.Utility;
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for surface element results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultSurface", "37147943-1A9A-44E8-8BAC-20628BC26896")]
public class ResultSurfaceElement : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
/// <summary>
/// Collection of values representing element results in raw format
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(Unit = Autodesk.Revit.DB.UnitType.UT_Length, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_METERS)]
public List<Double> ValuesInPointsData { get; set; }
/// <summary>
/// Information that the surface object is multilayer.
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty()]
public bool MultiLayer { get; set; }
/// <summary>
/// Collection of layer thickness
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(Unit = Autodesk.Revit.DB.UnitType.UT_Length, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_METERS)]
public List<Double> StructuralLayersThickness { get; set; }
/// <summary>
/// Collection of layer materials name
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty()]
public List<String> StructuralLayersMaterialName { get; set; }
/// <summary>
/// Informationa about structural layers for multilayers object
/// </summary>
/// <returns>List of names and thickness of structural layers</returns>
public List<Tuple<string, double>> GetStructuralLayers()
{
int numberOfLayers = StructuralLayersThickness.Count();
if (numberOfLayers != StructuralLayersMaterialName.Count())
throw new Exception("Invalid layers properties");
List<Tuple<string, double>> layers = new List<Tuple<string, double>>();
for (int layersId = 0; layersId < numberOfLayers; layersId++)
{
layers.Add(new Tuple<string, double>(StructuralLayersMaterialName[layersId],StructuralLayersThickness[layersId]));
}
return layers;
}
/// <summary>
/// Removing information about all structural layers
/// </summary>
public void ClearStructuralLayers()
{
StructuralLayersThickness.Clear();
StructuralLayersMaterialName.Clear();
}
/// <summary>
/// Adds new structural layer
/// </summary>
/// <param name="materialName">Material name for layer</param>
/// <param name="thickness">Thickness of layer</param>
public void AddStructuralLayer(string materialName, double thickness)
{
StructuralLayersThickness.Add(thickness);
StructuralLayersMaterialName.Add(materialName);
}
/// <summary>
/// Gets results in point formatted as a list of ResultInPointSurface elements
/// </summary>
/// <returns>List of ResultInPointSurface</returns>
public List<ResultInPointSurface> GetResultsInPointsCollection()
{
IEnumerable<ResultTypeSurface> vType = Enum.GetValues(typeof(ResultTypeSurface)).OfType<ResultTypeSurface>();
int numberOfValsInPoint = vType.Count(),
numberOfPoints = ValuesInPointsData.Count / numberOfValsInPoint;
List<ResultInPointSurface> resultsInPoints = new List<ResultInPointSurface>();
for (int ptId = 0; ptId < numberOfPoints; ptId++)
{
resultsInPoints.Add(new ResultInPointSurface(ValuesInPointsData.GetRange(ptId * numberOfValsInPoint, numberOfValsInPoint)));
}
return resultsInPoints;
}
/// <summary>
/// Creates default ResultSurfaceElement
/// </summary>
public ResultSurfaceElement()
{
ValuesInPointsData = new List<double>();
StructuralLayersThickness = new List<double>();
StructuralLayersMaterialName = new List<string>();
MultiLayer = false;
}
}
}
@@ -0,0 +1,46 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Main
{
/// <summary>
/// Container for RC wall results data
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("ResultWall", "31828720-0F98-47B2-BD7E-F4C5C12C43BD")]
public class ResultWall : ResultSurfaceElement
{
/// <summary>
/// Creates default ResultWall
/// </summary>
public ResultWall()
: base()
{
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CodeCheckingConcreteExample")]
[assembly: AssemblyDescription("www.autodesk.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ADSK")]
[assembly: AssemblyProduct("CodeCheckingConcreteExample")]
[assembly: AssemblyCopyright("Copyright © ADSK. 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a723a5fb-f3f9-48ca-8a1a-96026e50ccf6")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2015.0.0.0")]
[assembly: AssemblyFileVersion("2015.0.0.2464")]
@@ -0,0 +1,720 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CreepCoefficient" xml:space="preserve">
<value>Creep coefficient</value>
</data>
<data name="LongitudinalReinforcement" xml:space="preserve">
<value>Longitudinal reinforcement</value>
</data>
<data name="TransversalReinforcement" xml:space="preserve">
<value>Transverse reinforcement</value>
</data>
<data name="RebarBarType" xml:space="preserve">
<value>Rebar bar</value>
</data>
<data name="BarDiameter" xml:space="preserve">
<value>Bar diameter</value>
</data>
<data name="Material" xml:space="preserve">
<value>Material</value>
</data>
<data name="MinimumYieldStress" xml:space="preserve">
<value>Minimum yield stress</value>
</data>
<data name="DeformationType" xml:space="preserve">
<value>Deformation</value>
</data>
<data name="SlabBeamInteraction" xml:space="preserve">
<value>Slab-beam interaction</value>
</data>
<data name="EnabledInternalForces" xml:space="preserve">
<value>Calculation for</value>
</data>
<data name="CalculationOptions" xml:space="preserve">
<value>Calculation parameters</value>
</data>
<data name="CalcPointSelector" xml:space="preserve">
<value>Calculation points for linear elements</value>
</data>
<data name="BeamFX" xml:space="preserve">
<value>Axial load</value>
</data>
<data name="BeamFY" xml:space="preserve">
<value>Lateral shear force</value>
</data>
<data name="BeamFZ" xml:space="preserve">
<value>Shear force</value>
</data>
<data name="IsPointsOfExtremeValues" xml:space="preserve">
<value>Add points at maximum calculated forces</value>
</data>
<data name="UserSegmentDivision" xml:space="preserve">
<value>Segment length</value>
</data>
<data name="BeamMX" xml:space="preserve">
<value>Torsional moment</value>
</data>
<data name="BeamMY" xml:space="preserve">
<value>Bending moment</value>
</data>
<data name="BeamMZ" xml:space="preserve">
<value>Lateral bending moment</value>
</data>
<data name="UniformDistribution" xml:space="preserve">
<value>Number of points</value>
</data>
<data name="Buckling" xml:space="preserve">
<value>Buckling</value>
</data>
<data name="BucklingDirectionY" xml:space="preserve">
<value>Buckling in Y direction</value>
</data>
<data name="BucklingDirectionZ" xml:space="preserve">
<value>Buckling in Z direction</value>
</data>
<data name="LengthCoefficientY" xml:space="preserve">
<value>Length coefficient Y</value>
</data>
<data name="LengthCoefficientZ" xml:space="preserve">
<value>Length coefficient Z</value>
</data>
<data name="ColumnStructureType" xml:space="preserve">
<value>Structure</value>
</data>
<data name="NonSway" xml:space="preserve">
<value>Non-sway</value>
</data>
<data name="Sway" xml:space="preserve">
<value>Sway</value>
</data>
<data name="ColumnFX" xml:space="preserve">
<value>Axial load</value>
</data>
<data name="ColumnFY" xml:space="preserve">
<value>Shear force</value>
</data>
<data name="ColumnFZ" xml:space="preserve">
<value>Shear force</value>
</data>
<data name="ColumnMX" xml:space="preserve">
<value>Torsional moment</value>
</data>
<data name="ColumnMY" xml:space="preserve">
<value>Bending moment</value>
</data>
<data name="ColumnMZ" xml:space="preserve">
<value>Bending moment</value>
</data>
<data name="Points" xml:space="preserve">
<value>Constant number of points</value>
</data>
<data name="Segments" xml:space="preserve">
<value>Constant segment length</value>
</data>
<data name="CurrentPackageName" xml:space="preserve">
<value>Result package</value>
</data>
<data name="Abottom" xml:space="preserve">
<value>Bottom</value>
</data>
<data name="Aleft" xml:space="preserve">
<value>Left</value>
</data>
<data name="Aright" xml:space="preserve">
<value>Right</value>
</data>
<data name="Atop" xml:space="preserve">
<value>Top</value>
</data>
<data name="FxMax" xml:space="preserve">
<value>Fx envelope (Max)</value>
</data>
<data name="FxMin" xml:space="preserve">
<value>Fx envelope (Min)</value>
</data>
<data name="FyMax" xml:space="preserve">
<value>Fy envelope (Max)</value>
</data>
<data name="FyMin" xml:space="preserve">
<value>Fy envelope (Min)</value>
</data>
<data name="FzMax" xml:space="preserve">
<value>Fz envelope (Max)</value>
</data>
<data name="FzMin" xml:space="preserve">
<value>Fz envelope (Min)</value>
</data>
<data name="MxMax" xml:space="preserve">
<value>Mx envelope (Max)</value>
</data>
<data name="MxMin" xml:space="preserve">
<value>Mx envelope (Min)</value>
</data>
<data name="MyMax" xml:space="preserve">
<value>My envelope (Max)</value>
</data>
<data name="MyMin" xml:space="preserve">
<value>My envelope (Min)</value>
</data>
<data name="MzMax" xml:space="preserve">
<value>Mz envelope (Max)</value>
</data>
<data name="MzMin" xml:space="preserve">
<value>Mz envelope (Min)</value>
</data>
<data name="StirrupsSpacing" xml:space="preserve">
<value>Stirrups spacing</value>
</data>
<data name="TransversalReinforcemenDensity" xml:space="preserve">
<value>Transverse density</value>
</data>
<data name="UxMax" xml:space="preserve">
<value>Ux displacement envelope (Max)</value>
</data>
<data name="UxMin" xml:space="preserve">
<value>Ux displacement envelope (Min)</value>
</data>
<data name="UxRealMax" xml:space="preserve">
<value>fx deflection envelope (Max)</value>
</data>
<data name="UxRealMin" xml:space="preserve">
<value>fx deflection envelope (Min)</value>
</data>
<data name="UyMax" xml:space="preserve">
<value>Uy displacement envelope (Max)</value>
</data>
<data name="UyMin" xml:space="preserve">
<value>Uy displacement envelope (Min)</value>
</data>
<data name="UyRealMax" xml:space="preserve">
<value>fy deflection envelope (Max)</value>
</data>
<data name="UyRealMin" xml:space="preserve">
<value>fy deflection envelope (Min)</value>
</data>
<data name="UzMax" xml:space="preserve">
<value>Uz displacement envelope (Max)</value>
</data>
<data name="UzMin" xml:space="preserve">
<value>Uz displacement envelope (Min)</value>
</data>
<data name="UzRealMax" xml:space="preserve">
<value>fz deflection envelope (Max)</value>
</data>
<data name="UzRealMin" xml:space="preserve">
<value>fz deflection envelope (Min)</value>
</data>
<data name="X_" xml:space="preserve">
<value>Distance</value>
</data>
<data name="X_Rel" xml:space="preserve">
<value>Relative distance</value>
</data>
<data name="LoadCases" xml:space="preserve">
<value>Load cases</value>
</data>
<data name="LoadCombinations" xml:space="preserve">
<value>Load combinations</value>
</data>
<data name="LoadsAndCombinations" xml:space="preserve">
<value>Loads cases and combinations</value>
</data>
<data name="Internal_Moments" xml:space="preserve">
<value>Internal moment envelopes</value>
</data>
<data name="Long_Reinforcement" xml:space="preserve">
<value>Longitudinal reinforcement charts</value>
</data>
<data name="Real___Deflection" xml:space="preserve">
<value>RC deflection</value>
</data>
<data name="DeflectionEnvelope" xml:space="preserve">
<value>Deflection envelope</value>
</data>
<data name="Internal_Forces" xml:space="preserve">
<value>Internal force envelopes</value>
</data>
<data name="Trans_Reinforcement" xml:space="preserve">
<value>Transverse reinforcement</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
<data name="NoneSelected" xml:space="preserve">
<value>None selected</value>
</data>
<data name="NotTakenIntoConsideration" xml:space="preserve">
<value>Not taken into consideration</value>
</data>
<data name="DataPreparation" xml:space="preserve">
<value>Preparing data</value>
</data>
<data name="ReadingGeometry" xml:space="preserve">
<value>Reading geometry</value>
</data>
<data name="Deflection" xml:space="preserve">
<value>Deflection</value>
</data>
<data name="InternalForces" xml:space="preserve">
<value>Internal forces</value>
</data>
<data name="LongReinforcementBottom" xml:space="preserve">
<value>Bottom longitudinal reinforcement</value>
</data>
<data name="LongReinforcementLeft" xml:space="preserve">
<value>Left longitudinal reinforcement</value>
</data>
<data name="LongReinforcementRight" xml:space="preserve">
<value>Right longitudinal reinforcement</value>
</data>
<data name="LongReinforcementTop" xml:space="preserve">
<value>Top longitudinal reinforcement</value>
</data>
<data name="Reinforcement" xml:space="preserve">
<value>Reinforcement</value>
</data>
<data name="MaximumLongitudinalReinforcement" xml:space="preserve">
<value>Maximum longitudinal reinforcement</value>
</data>
<data name="MaximumStirrupsSpacing" xml:space="preserve">
<value>Maximum stirrups spacing</value>
</data>
<data name="MeanReinforcemenDensityLongitudinal" xml:space="preserve">
<value>Mean longitudinal reinforcement density</value>
</data>
<data name="MeanTransversalReinforcemenDensity" xml:space="preserve">
<value>Mean transverse reinforcement density</value>
</data>
<data name="MinimumLongitudinalReinforcement" xml:space="preserve">
<value>Minimum longitudinal reinforcement</value>
</data>
<data name="MinimumStirrupsSpacing" xml:space="preserve">
<value>Minimum stirrups spacing</value>
</data>
<data name="SectionAtDistance" xml:space="preserve">
<value>Section at distance</value>
</data>
<data name="Summary" xml:space="preserve">
<value>Summary</value>
</data>
<data name="AppliesToSections" xml:space="preserve">
<value>Applies to the following sections: </value>
</data>
<data name="Calculation" xml:space="preserve">
<value>Calculating</value>
</data>
<data name="DataSaving" xml:space="preserve">
<value>Saving data</value>
</data>
<data name="BeamFX_Note" xml:space="preserve">
<value>Axial load (Fx)</value>
</data>
<data name="BeamFY_Note" xml:space="preserve">
<value>Lateral shear force (Fy)</value>
</data>
<data name="BeamFZ_Note" xml:space="preserve">
<value>Shear force (Fz)</value>
</data>
<data name="BeamMX_Note" xml:space="preserve">
<value>Torsional moment (Mx)</value>
</data>
<data name="BeamMY_Note" xml:space="preserve">
<value>Bending moment (My)</value>
</data>
<data name="BeamMZ_Note" xml:space="preserve">
<value>Lateral bending moment (Mz)</value>
</data>
<data name="ColumnFX_Note" xml:space="preserve">
<value>Axial load (Fx)</value>
</data>
<data name="ColumnFY_Note" xml:space="preserve">
<value>Shear force (Fy)</value>
</data>
<data name="ColumnFZ_Note" xml:space="preserve">
<value>Shear force (Fz)</value>
</data>
<data name="ColumnMX_Note" xml:space="preserve">
<value>Torsional moment (Mx)</value>
</data>
<data name="ColumnMY_Note" xml:space="preserve">
<value>Bending moment (My)</value>
</data>
<data name="ColumnMZ_Note" xml:space="preserve">
<value>Bending moment (Mz)</value>
</data>
<data name="ErrNoChosenInternalForces" xml:space="preserve">
<value>Element Settings: No internal forces are selected.</value>
</data>
<data name="ErrReinforcementMaterialL" xml:space="preserve">
<value>Element Settings: Incorrect material type is selected for longitudinal rebar.</value>
</data>
<data name="AxisArea" xml:space="preserve">
<value>Area</value>
</data>
<data name="AxisDisplacmentDeflection" xml:space="preserve">
<value>Displacment/Deflection</value>
</data>
<data name="AxisForce" xml:space="preserve">
<value>Force</value>
</data>
<data name="AxisHeight" xml:space="preserve">
<value>Height</value>
</data>
<data name="AxisLength" xml:space="preserve">
<value>Length</value>
</data>
<data name="AxisMoment" xml:space="preserve">
<value>Moment</value>
</data>
<data name="AxisSpacing" xml:space="preserve">
<value>Spacing</value>
</data>
<data name="AxisDencity" xml:space="preserve">
<value>Dencity</value>
</data>
<data name="ErrConcreteCompression" xml:space="preserve">
<value>Materials: Concrete compression is not properly defined.</value>
</data>
<data name="ErrCover" xml:space="preserve">
<value>Rebar Cover: Cover is not properly defined.</value>
</data>
<data name="ErrRebarL" xml:space="preserve">
<value>Element Settings: No bars are selected for longitudinal rebar.</value>
</data>
<data name="ErrReinforcementYieldStressL" xml:space="preserve">
<value>Element Settings: Minimum yield stress is not properly defined for longitudinal rebar.</value>
</data>
<data name="ErrSectionNotSupported" xml:space="preserve">
<value>Types: Element cross section is not supported by this code.</value>
</data>
<data name="ErrStaticResults" xml:space="preserve">
<value>Code Settings: Input package does not contain static results for the element.</value>
</data>
<data name="ErrYoungModulus" xml:space="preserve">
<value>Materials: Youngs Modulus is not properly defined.</value>
</data>
<data name="Displacement" xml:space="preserve">
<value>Displacement</value>
</data>
<data name="ErrRebarT" xml:space="preserve">
<value>Element Settings: No bars are selected for transverse rebar.</value>
</data>
<data name="ErrReinforcementMaterialT" xml:space="preserve">
<value>Element Settings: Incorrect material type is selected for transverse rebar.</value>
</data>
<data name="ErrReinforcementYieldStressT" xml:space="preserve">
<value>Element Settings: Minimum yield stress is not properly defined for transverse rebar.</value>
</data>
<data name="DisplacementEnvelope" xml:space="preserve">
<value>Displacement envelope</value>
</data>
<data name="ElementDivisionType" xml:space="preserve">
<value>Division type</value>
</data>
<data name="HorizontalRnfSteelParameters" xml:space="preserve">
<value>Horizontal reinforcement</value>
</data>
<data name="PrimaryRnfSteelParameters" xml:space="preserve">
<value>Primary reinforcement</value>
</data>
<data name="SecondaryRnfSteelParameters" xml:space="preserve">
<value>Secondary reinforcement</value>
</data>
<data name="UseForcesType" xml:space="preserve">
<value>Use the internal forces</value>
</data>
<data name="VerticalRnfSteelParameters" xml:space="preserve">
<value>Vertical reinforcement</value>
</data>
<data name="EnvelopeF" xml:space="preserve">
<value>Envelope of axial forces</value>
</data>
<data name="EnvelopeM" xml:space="preserve">
<value>Envelope of bending moments</value>
</data>
<data name="FxxMax" xml:space="preserve">
<value>Fxx (Max)</value>
</data>
<data name="FxxMin" xml:space="preserve">
<value>Fxx (Min)</value>
</data>
<data name="FyyMax" xml:space="preserve">
<value>Fyy (Max)</value>
</data>
<data name="FyyMin" xml:space="preserve">
<value>Fyy (Min)</value>
</data>
<data name="MeanPrimaryReinforcementDensity" xml:space="preserve">
<value>Mean primary reinforcement density</value>
</data>
<data name="MeanSecondaryReinforcementDensity" xml:space="preserve">
<value>Mean secondary reinforcement density</value>
</data>
<data name="MxxMax" xml:space="preserve">
<value>Mxx (Max)</value>
</data>
<data name="MxxMin" xml:space="preserve">
<value>Mxx (Min)</value>
</data>
<data name="MyyMax" xml:space="preserve">
<value>Myy (Max)</value>
</data>
<data name="MyyMin" xml:space="preserve">
<value>Myy (Min)</value>
</data>
<data name="AxxBottom" xml:space="preserve">
<value>Primary bottom</value>
</data>
<data name="AxxTop" xml:space="preserve">
<value>Primary top</value>
</data>
<data name="AyyBottom" xml:space="preserve">
<value>Secondary bottom</value>
</data>
<data name="AyyTop" xml:space="preserve">
<value>Secondary top</value>
</data>
<data name="X" xml:space="preserve">
<value>X</value>
</data>
<data name="Y" xml:space="preserve">
<value>Y</value>
</data>
<data name="Z" xml:space="preserve">
<value>Z</value>
</data>
<data name="ExtremeValuesOfReinforcement" xml:space="preserve">
<value>Extreme values of reinforcement</value>
</data>
<data name="ExtremeAxialForces" xml:space="preserve">
<value>Extreme values of axial forces</value>
</data>
<data name="ExtremeBendingMoments" xml:space="preserve">
<value>Extreme values of bending moments</value>
</data>
<data name="ReinforcementMaps" xml:space="preserve">
<value>Reinforcement maps</value>
</data>
<data name="FloorF" xml:space="preserve">
<value>Axial load (Fxx/Fyy)</value>
</data>
<data name="FloorF_Note" xml:space="preserve">
<value>Axial load (Fxx/Fyy)</value>
</data>
<data name="FloorM" xml:space="preserve">
<value>Bending moment (Mxx/Myy)</value>
</data>
<data name="FloorM_Note" xml:space="preserve">
<value>Bending moment (Mxx/Myy)</value>
</data>
<data name="FloorQ" xml:space="preserve">
<value>Shear force (Fzz)</value>
</data>
<data name="FloorQ_Note" xml:space="preserve">
<value>Shear force (Fzz)</value>
</data>
<data name="HorizontalReinforcement" xml:space="preserve">
<value>Horizontal reinforcement</value>
</data>
<data name="PrimaryReinforcement" xml:space="preserve">
<value>Primary reinforcement</value>
</data>
<data name="SecondaryReinforcement" xml:space="preserve">
<value>Secondary reinforcement</value>
</data>
<data name="VerticalReinforcement" xml:space="preserve">
<value>Vertical reinforcement</value>
</data>
<data name="WallF" xml:space="preserve">
<value>Axial load (Fxx/Fyy)</value>
</data>
<data name="WallF_Note" xml:space="preserve">
<value>Axial load (Fxx/Fyy)</value>
</data>
<data name="WallM" xml:space="preserve">
<value>Bending moment (Mxx/Myy)</value>
</data>
<data name="WallM_Note" xml:space="preserve">
<value>Bending moment (Mxx/Myy)</value>
</data>
<data name="WallQ" xml:space="preserve">
<value>Shear force (Fzz)</value>
</data>
<data name="WallQ_Note" xml:space="preserve">
<value>Shear force (Fzz)</value>
</data>
<data name="Layers" xml:space="preserve">
<value>Layers</value>
</data>
<data name="LayerTakenIntoConsideration" xml:space="preserve">
<value>Element consist with more then one layer. The Layer taken into consideration in the calculation:</value>
</data>
<data name="ThicknessTakenIntoConsideration" xml:space="preserve">
<value>Thickness taken into consideration in the calculation</value>
</data>
<data name="AllSections" xml:space="preserve">
<value>all sections</value>
</data>
<data name="DimensioningDirectionXFloor" xml:space="preserve">
<value>Main direction</value>
</data>
<data name="DimensioningDirectionXWall" xml:space="preserve">
<value>Vertical direction</value>
</data>
<data name="DimensioningDirectionYFloor" xml:space="preserve">
<value>Secondary direction</value>
</data>
<data name="DimensioningDirectionYWall" xml:space="preserve">
<value>Horizontal direction</value>
</data>
<data name="FloorAxxBottom" xml:space="preserve">
<value>Primary bottom</value>
</data>
<data name="FloorAxxTop" xml:space="preserve">
<value>Primary top</value>
</data>
<data name="FloorAyyBottom" xml:space="preserve">
<value>Secondary bottom</value>
</data>
<data name="FloorAyyTop" xml:space="preserve">
<value>Secondary top</value>
</data>
<data name="WallAxxBottom" xml:space="preserve">
<value>Vertical internal</value>
</data>
<data name="WallAxxTop" xml:space="preserve">
<value>Vertical external</value>
</data>
<data name="WallAyyBottom" xml:space="preserve">
<value>Horizontal internal</value>
</data>
<data name="WallAyyTop" xml:space="preserve">
<value>Horizontal external</value>
</data>
<data name="MeanHorizontalReinforcementDensity" xml:space="preserve">
<value>Mean horizontal reinforcement density</value>
</data>
<data name="MeanVerticallReinforcementDensity" xml:space="preserve">
<value>Mean vertical reinforcement density</value>
</data>
</root>
@@ -0,0 +1,643 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking;
using Autodesk.Revit.DB.CodeChecking.Documentation;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.Main;
using CodeCheckingConcreteExample.Properties;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
#pragma warning disable 1591
namespace CodeCheckingConcreteExample.Server
{
[Autodesk.Revit.DB.CodeChecking.Attributes.CalculationParamsStructure(typeof(CalculationParameter))]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelBeam), BuiltInCategory.OST_BeamAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelColumn), BuiltInCategory.OST_ColumnAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.ResultStructure(typeof(ResultBeam), BuiltInCategory.OST_BeamAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.ResultStructure(typeof(ResultColumn), BuiltInCategory.OST_ColumnAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
/// <structural_toolkit_2015>
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelWall), BuiltInCategory.OST_WallAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelFloor), BuiltInCategory.OST_FloorAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelFloor), BuiltInCategory.OST_FoundationSlabAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.ResultStructure(typeof(ResultWall), BuiltInCategory.OST_WallAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.ResultStructure(typeof(ResultFloor), BuiltInCategory.OST_FloorAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.ResultStructure(typeof(ResultFloor), BuiltInCategory.OST_FoundationSlabAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
/// </structural_toolkit_2015>
public partial class Server : Autodesk.Revit.DB.CodeChecking.Documentation.MultiStructureServer
{
public static readonly Autodesk.Revit.DB.ResultsBuilder.UnitsSystem UnitSystem = Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric;
public static readonly Guid ID = new Guid("1d3d13ad-4330-4b4a-bfe3-067ff87a72b1");
#region ICodeCheckingServer Members
public override Entity GetDefaultLabel(Autodesk.Revit.DB.Document document, StructuralAssetClass material, BuiltInCategory category)
{
switch (material)
{
case StructuralAssetClass.Concrete:
switch (category)
{
default:
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
{
IList<ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
if (materials.Count > 0)
{
IList<ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
if (barsIds.Count > 0)
{
LabelColumn label = new LabelColumn();
label.LongitudinalReinforcement.Material = document.GetElement(materials[0]) as Material;
label.LongitudinalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
label.TransversalReinforcement.Material = label.LongitudinalReinforcement.Material;
label.TransversalReinforcement.RebarBarType = label.LongitudinalReinforcement.RebarBarType;
return label.GetEntity();
}
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
{
IList<ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
if (materials.Count > 0)
{
IList<ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
if (barsIds.Count > 0)
{
LabelBeam label = new LabelBeam();
label.LongitudinalReinforcement.Material = document.GetElement(materials[0]) as Material;
label.LongitudinalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
label.TransversalReinforcement.Material = label.LongitudinalReinforcement.Material;
label.TransversalReinforcement.RebarBarType = label.LongitudinalReinforcement.RebarBarType;
return label.GetEntity();
}
}
}
break;
/// <structural_toolkit_2015>
case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
{
IList<ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
if (materials.Count > 0)
{
IList<ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
if (barsIds.Count > 0)
{
LabelFloor label = new LabelFloor();
label.PrimaryReinforcement.Material = document.GetElement(materials[0]) as Material;
label.PrimaryReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
label.SecondaryReinforcement.Material = document.GetElement(materials[0]) as Material;
label.SecondaryReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
return label.GetEntity();
}
}
}
break;
case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
{
IList<ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
if (materials.Count > 0)
{
IList<ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
if (barsIds.Count > 0)
{
LabelWall label = new LabelWall();
label.VerticalReinforcement.Material = document.GetElement(materials[0]) as Material;
label.VerticalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
label.HorizontalReinforcement.Material = document.GetElement(materials[0]) as Material;
label.HorizontalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
return label.GetEntity();
}
}
}
break;
/// </structural_toolkit_2015>
}
break;
}
return base.GetDefaultLabel(document, material, category);
}
/// <structural_toolkit_2015>
// TODO : REMOVE
/// <summary>
/// Classification of elements type
/// </summary>
public enum ElementType {
/// <summary>
/// RC Beam
/// </summary>
Beam,
/// <summary>
/// RC Column
/// </summary>
Column,
/// <summary>
/// RC Floor and Slab foundation
/// </summary>
Floor,
/// <summary>
/// RC Wall
/// </summary>
Wall
}
/// </structural_toolkit_2015>
/// <structural_toolkit_2015>
/// <summary>
/// Build document body for result document
/// </summary>
/// <param name="calculationParameters">Code calculation parameters</param>
/// <param name="element">Revit element for which result document is built</param>
/// <param name="document">Active Revit document</param>
/// <returns>DocumentBody object</returns>
public override DocumentBody BuildResultDocumentBody(Autodesk.Revit.DB.ExtensibleStorage.Entity calculationParameters, Element element, Autodesk.Revit.DB.Document document)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(document);
Guid activePackageId = storageDocument.CalculationParamsManager.CalculationParams.GetInputResultPackageId(Server.ID);
Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status = storageDocument.ResultsManager.GetResultStatus(element, activePackageId, Server.ID);
DocumentBody body = new DocumentBody();
if (!status.IsError())
{
// create body object
// get results schema for the current element
string schemaName = calculationParameters.Schema.SchemaName;
switch (schemaName)
{
case "ResultBeam":
ResultLinearElement resultBeam = new ResultBeam();
resultBeam.SetProperties(calculationParameters);
WriteResultsToNoteForLinearElements(body, resultBeam, document,ElementType.Beam);
break;
case "ResultColumn":
ResultLinearElement resultColumn = new ResultColumn();
resultColumn.SetProperties(calculationParameters);
WriteResultsToNoteForLinearElements(body, resultColumn, document,ElementType.Column);
break;
case "ResultFloor":
ResultSurfaceElement resultFloor = new ResultSurfaceElement();
resultFloor.SetProperties(calculationParameters);
WriteResultsToNoteForSurfaceElements(body, resultFloor, document, element, ElementType.Floor);
break;
case "ResultWall":
ResultSurfaceElement resultWall = new ResultSurfaceElement();
resultWall.SetProperties(calculationParameters);
WriteResultsToNoteForSurfaceElements(body, resultWall, document, element, ElementType.Wall);
break;
}
}
return body;
}
/// </structural_toolkit_2015>
public override IList<BuiltInCategory> GetSupportedCategories(StructuralAssetClass material)
{
List<BuiltInCategory> supportedCategories = new List<BuiltInCategory>();
supportedCategories.Add(BuiltInCategory.OST_BeamAnalytical);
supportedCategories.Add(BuiltInCategory.OST_ColumnAnalytical);
/// <structural_toolkit_2015>
supportedCategories.Add(BuiltInCategory.OST_FoundationSlabAnalytical);
supportedCategories.Add(BuiltInCategory.OST_FloorAnalytical);
supportedCategories.Add(BuiltInCategory.OST_WallAnalytical);
/// </structural_toolkit_2015>
return supportedCategories;
}
public override IList<Autodesk.Revit.DB.StructuralAssetClass> GetSupportedMaterials()
{
return new List<Autodesk.Revit.DB.StructuralAssetClass>(){
Autodesk.Revit.DB.StructuralAssetClass.Concrete};
}
#endregion
/// <summary>
/// Gets the document body for label.
/// </summary>
/// <param name="label">label.</param>
/// <param name="document">document.</param>
/// <returns>
/// The body of the document.
/// </returns>
public override DocumentBody BuildLabelDocumentBody(Entity label, Autodesk.Revit.DB.Document document)
{
switch (label.Schema.SchemaName)
{
default:
return base.BuildLabelDocumentBody(label, document);
case "LabelColumn":
{
DocumentBody body = new DocumentBody();
LabelColumn labelColumn = new LabelColumn();
labelColumn.SetProperties(label, document);
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));
if (labelColumn.EnabledInternalForces.Count > 0)
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFX_Note"), true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFY_Note"), true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFZ_Note"), true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMX_Note"), true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMY_Note"), true));
if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMZ_Note"), true));
}
body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelColumn, this, document));
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("Buckling"), 4));
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionY"), 5));
if (labelColumn.BucklingDirectionY)
{
body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientY", labelColumn, this, document));
body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeY", labelColumn, this, document));
}
else
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true));
}
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionZ"), 5));
if (labelColumn.BucklingDirectionZ)
{
body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientZ", labelColumn, this, document));
body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeZ", labelColumn, this, document));
}
else
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true));
}
// longitudinal
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4));
if (labelColumn.LongitudinalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.LongitudinalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (labelColumn.LongitudinalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.LongitudinalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.LongitudinalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
// transverse
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4));
if (labelColumn.TransversalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.TransversalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (labelColumn.TransversalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.TransversalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.TransversalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
return body;
}
case "LabelBeam":
{
DocumentBody body = new DocumentBody();
LabelBeam labelBeam = new LabelBeam();
labelBeam.SetProperties(label, document);
body.Elements.Add(new DocumentLineBreak(1));
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));
if (labelBeam.EnabledInternalForces.Count > 0)
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFX_Note"), true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFY_Note"), true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFZ_Note"), true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMX_Note"), true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMY_Note"), true));
if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMZ_Note"), true));
}
body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelBeam, this, document));
string interaction = Resources.ResourceManager.GetString("No");
if (labelBeam.SlabBeamInteraction == ConcreteTypes.BeamSectionType.WithSlabBeamInteraction)
{
interaction = Resources.ResourceManager.GetString("Yes");
}
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("SlabBeamInteraction"), interaction));
// longitudinal
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4));
if (labelBeam.LongitudinalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.LongitudinalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (labelBeam.LongitudinalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.LongitudinalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.LongitudinalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
// transverse
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4));
if (labelBeam.TransversalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.TransversalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (labelBeam.TransversalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.TransversalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.TransversalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
return body;
}
/// <structural_toolkit_2015>
case "LabelFloor":
{
DocumentBody body = new DocumentBody();
LabelFloor LabelFloor = new LabelFloor();
LabelFloor.SetProperties(label, document);
body.Elements.Add(new DocumentLineBreak(1));
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));
if (LabelFloor.EnabledInternalForces.Count > 0)
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorF_Note"), true));
if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorQ_Note"), true));
if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorM_Note"), true));
}
body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelFloor, this, document));
// Primary
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("PrimaryReinforcement"), 4));
if (LabelFloor.PrimaryReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.PrimaryReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.PrimaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (LabelFloor.PrimaryReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.PrimaryReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.PrimaryReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.PrimaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
// Secondary
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("SecondaryReinforcement"), 4));
if (LabelFloor.SecondaryReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.SecondaryReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.SecondaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (LabelFloor.SecondaryReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.SecondaryReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.SecondaryReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.SecondaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
return body;
}
case "LabelWall":
{
DocumentBody body = new DocumentBody();
LabelWall LabelWall = new LabelWall();
LabelWall.SetProperties(label, document);
body.Elements.Add(new DocumentLineBreak(1));
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));
if (LabelWall.EnabledInternalForces.Count > 0)
{
body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallF_Note"), true));
if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallQ_Note"), true));
if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallM_Note"), true));
}
body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelWall, this, document));
// Vertical
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("VerticalReinforcement"), 4));
if (LabelWall.VerticalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.VerticalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.VerticalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (LabelWall.VerticalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.VerticalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.VerticalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.VerticalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
// Horizontal
body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("HorizontalReinforcement"), 4));
if (LabelWall.HorizontalReinforcement.Material != null)
{
StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.HorizontalReinforcement.Material);
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
}
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.HorizontalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));
if (LabelWall.HorizontalReinforcement.RebarBarType != null)
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.HorizontalReinforcement.RebarBarType.Name));
else
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.HorizontalReinforcement.DeformationType.ToString()));
body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.HorizontalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));
return body;
}
/// </structural_toolkit_2015>
}
}
/// <summary>
/// Gets the document body for calculation parameters.
/// </summary>
/// <param name="calcParams">Calculation parameters</param>
/// <param name="document">document</param>
/// <returns>Body of the document</returns>
public override DocumentBody BuildCalculationParamDocumentBody(Entity calcParams, Autodesk.Revit.DB.Document document)
{
DocumentBody body = new DocumentBody();
return body;
}
#region IExternalServer Members
public override string GetDescription()
{
return "Code Checking Concrete Example for Revit API";
}
public override string GetName()
{
return "CodeCheckingConcreteExample";
}
public override Guid GetServerId()
{
return ID;
}
public override string GetVendorId()
{
return "ADSK";
}
public override void Verify(Autodesk.Revit.DB.CodeChecking.ServiceData data)
{
Autodesk.Revit.DB.CodeChecking.Storage.StorageService service = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);
Main.Calculation.EngineData enginData = new Main.Calculation.EngineData();
Engine.Engine engine = new Engine.Engine(enginData);
engine.Calculate(this, data);
}
/// <summary>
/// Gets the output package result types. This information is needed to create proper ResultsBuilder Package.
/// </summary>
/// <returns></returns>
public override Autodesk.Revit.DB.ResultsBuilder.ResultsPackageTypes GetOutputPackageResultTypes()
{
return Autodesk.Revit.DB.ResultsBuilder.ResultsPackageTypes.RequiredReinforcement | Autodesk.Revit.DB.ResultsBuilder.ResultsPackageTypes.SteelRatio;
}
/// <summary>
/// Gets the output package unit system. This information is needed to create proper ResultsBuilder Package.
/// </summary>
/// <returns></returns>
public override Autodesk.Revit.DB.ResultsBuilder.UnitsSystem GetOutputPackageUnitSystem()
{
return UnitSystem;
}
#endregion
#region ICodeCheckingServerDocumentation Members
public override string GetResource(string key, string context)
{
string txt = Resources.ResourceManager.GetString(key);
if (!string.IsNullOrEmpty(txt))
return txt;
return key;
}
#endregion
}
}
@@ -0,0 +1,437 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking;
using Autodesk.Revit.DB.CodeChecking.Documentation;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.Main;
using CodeCheckingConcreteExample.Properties;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Server
{
/// Moved from Server.cs
public partial class Server : Autodesk.Revit.DB.CodeChecking.Documentation.MultiStructureServer
{
/// <summary>
/// Fills document body object with formatted reinforcement calculation results
/// </summary>
/// <param name="body">DocumentBody to be filled</param>
/// <param name="linearElementResult">Calculation results schema class</param>
/// <param name="document">Active Revit document</param>
/// <param name="elementType">Structural element type</param>
private void WriteResultsToNoteForLinearElements(DocumentBody body, ResultLinearElement linearElementResult, Autodesk.Revit.DB.Document document, ElementType elementType)
{
/////////////////////////// Prepare data
// Get revit units
Units units = document.GetUnits();
// Get raw calculation results as a collection of ResultInPointLinear objects for all element sections ( one ResultInPointLinear per section)
List<ResultInPointLinear> resultsInPoints = linearElementResult.GetResultsInPointsCollection();
if (resultsInPoints.Count == 0)
return;
/////////////////////////// Add a general reinforcement review to the body( mean and extreme values of reinfocement )
// Create document section
DocumentSection resultSummary = new DocumentSection(Resources.ResourceManager.GetString("Summary"), 5);
// Calculate mean and extreme values
IEnumerable<ResultTypeLinear> longRnf = new List<ResultTypeLinear> { ResultTypeLinear.Atop, ResultTypeLinear.Abottom, ResultTypeLinear.Aleft, ResultTypeLinear.Aright };
double maxLongitudinal = resultsInPoints.Max(s => (longRnf.Sum(q => s[q]))),
minLongitudinal = resultsInPoints.Min(s => (longRnf.Sum(q => s[q]))),
maxSpacing = resultsInPoints.Max(s => s[ResultTypeLinear.StirrupsSpacing]),
minSpacing = resultsInPoints.Min(s => s[ResultTypeLinear.StirrupsSpacing]),
maxX = resultsInPoints.Max(s => s[ResultTypeLinear.X]),
minX = resultsInPoints.Min(s => s[ResultTypeLinear.X]),
meanLongitudinal = resultsInPoints.Average(s => (longRnf.Sum(q => s[q]))),
meanTransversal = resultsInPoints.Average(s => s[ResultTypeLinear.TransversalReinforcemenDensity]);
// Add them to the section
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MeanReinforcemenDensityLongitudinal"), meanLongitudinal, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area), UnitType.UT_Reinforcement_Area, document.GetUnits())));
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MeanTransversalReinforcemenDensity"), meanTransversal, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area_per_Unit_Length), UnitType.UT_Reinforcement_Area_per_Unit_Length, document.GetUnits())));
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MaximumLongitudinalReinforcement"), maxLongitudinal, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area), UnitType.UT_Reinforcement_Area, document.GetUnits())));
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumLongitudinalReinforcement"), minLongitudinal, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area), UnitType.UT_Reinforcement_Area, document.GetUnits())));
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MaximumStirrupsSpacing"), maxSpacing, UnitsConverter.GetInternalUnit(UnitType.UT_Section_Dimension), UnitType.UT_Section_Dimension, document.GetUnits())));
resultSummary.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumStirrupsSpacing"), minSpacing, UnitsConverter.GetInternalUnit(UnitType.UT_Section_Dimension), UnitType.UT_Section_Dimension, document.GetUnits())));
resultSummary.Level = DetailLevel.General;
// Add section to the document body
body.Elements.Add(resultSummary);
/////////////////////////// Create result tables for deflection, internal forces and reinforcement
// Create reinforcement table
List<ResultTypeLinear> nonZeroReinforcement = ResultTypeLinearHelper.ReinforcementResults.Where(s => resultsInPoints.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
if (nonZeroReinforcement.Count() > 0)
{
DocumentSection section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, nonZeroReinforcement, document, elementType, true, false, false, Resources.ResourceManager.GetString("Reinforcement"));
if (section != null)
body.Elements.Add(section);
string diagramTitle = "";
bool reversedAxis = false;
foreach (ResultTypeLinear resultType in nonZeroReinforcement)
{
switch (resultType)
{
case ResultTypeLinear.Abottom:
diagramTitle = Resources.ResourceManager.GetString("LongReinforcementBottom");
break;
case ResultTypeLinear.Atop:
diagramTitle = Resources.ResourceManager.GetString("LongReinforcementTop");
break;
case ResultTypeLinear.Aleft:
diagramTitle = Resources.ResourceManager.GetString("LongReinforcementLeft");
break;
case ResultTypeLinear.Aright:
diagramTitle = Resources.ResourceManager.GetString("LongReinforcementRight");
break;
case ResultTypeLinear.TransversalReinforcemenDensity:
diagramTitle = Resources.ResourceManager.GetString("TransversalReinforcement");
break;
case ResultTypeLinear.StirrupsSpacing:
diagramTitle = Resources.ResourceManager.GetString("StirrupsSpacing");
break;
}
List<ResultTypeLinear> oneNonZeroReinforcement = new List<ResultTypeLinear>(1);
oneNonZeroReinforcement.Add(resultType);
section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, oneNonZeroReinforcement, document, elementType, false, true, reversedAxis, "", "", diagramTitle);
if (section != null)
body.Elements.Add(section);
}
}
// Create internal forces tables and graph
List<ResultTypeLinear> nonZeroInternalForces = ResultTypeLinearHelper.InternalForcesResults.Where(s => resultsInPoints.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
if (nonZeroInternalForces.Count() > 0)
{
DocumentSection section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, nonZeroInternalForces, document, elementType, true, true, false, Resources.ResourceManager.GetString("InternalForces"), "", Resources.ResourceManager.GetString("Internal_Forces"));
if (section != null)
body.Elements.Add(section);
}
List<ResultTypeLinear> nonZeroInternalMoments = ResultTypeLinearHelper.InternalMomentsResults.Where(s => resultsInPoints.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
if (nonZeroInternalMoments.Count() > 0)
{
DocumentSection section = null;
if (nonZeroInternalForces.Count() != 0)
section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, nonZeroInternalMoments, document, elementType, true, true, true, "", "", Resources.ResourceManager.GetString("Internal_Moments"));
else
section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, nonZeroInternalMoments, document, elementType, true, true, true, Resources.ResourceManager.GetString("InternalForces"), "", Resources.ResourceManager.GetString("Internal_Moments"));
if (section != null)
body.Elements.Add(section);
}
// Create deflection table and graph
List<ResultTypeLinear> nonZeroDeflection = ResultTypeLinearHelper.RealDeflectionResults.Where(s => resultsInPoints.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
if (nonZeroDeflection.Count() > 0)
{
List<ResultTypeLinear> displacement = new List<ResultTypeLinear>(nonZeroDeflection.Count());
List<ResultTypeLinear> displacementAndDeflection = new List<ResultTypeLinear>(nonZeroDeflection.Count() * 2);
displacementAndDeflection.AddRange(nonZeroDeflection);
foreach (ResultTypeLinear resultType in nonZeroDeflection)
{
switch (resultType)
{
case ResultTypeLinear.UxRealMax:
displacement.Add(ResultTypeLinear.UxMax);
break;
case ResultTypeLinear.UxRealMin:
displacement.Add(ResultTypeLinear.UxMin);
break;
case ResultTypeLinear.UyRealMax:
displacement.Add(ResultTypeLinear.UyMax);
break;
case ResultTypeLinear.UyRealMin:
displacement.Add(ResultTypeLinear.UyMin);
break;
case ResultTypeLinear.UzRealMax:
displacement.Add(ResultTypeLinear.UzMax);
break;
case ResultTypeLinear.UzRealMin:
displacement.Add(ResultTypeLinear.UzMin);
break;
}
}
displacementAndDeflection.AddRange(displacement);
DocumentSection section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, displacementAndDeflection, document, elementType, true, false, false, Resources.ResourceManager.GetString("Deflection"), "", Resources.ResourceManager.GetString("DeflectionEnvelope"));
if (section != null)
{
body.Elements.Add(section);
section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, nonZeroDeflection, document, elementType, false, true, false, "", "", Resources.ResourceManager.GetString("DeflectionEnvelope"));
if (section != null)
{
body.Elements.Add(section);
section = CreateSectionTableAndDiagramForLinearElements(resultsInPoints, displacement, document, elementType, false, true, false, "", "", Resources.ResourceManager.GetString("DisplacementEnvelope"));
if (section != null)
body.Elements.Add(section);
}
}
}
}
static private Dictionary<ResultTypeLinear, Color> ResultTypeLinearToColorDictionary = new Dictionary<ResultTypeLinear, Color>()
{
{ResultTypeLinear.X, new Color (0, 255, 0 ) },
{ResultTypeLinear.X_Rel, new Color (225, 0, 0 ) },
{ResultTypeLinear.MxMax, new Color (0, 0, 255 ) },
{ResultTypeLinear.MxMin, new Color (255, 119, 28 ) },
{ResultTypeLinear.MyMin, new Color (51, 177, 33 ) },
{ResultTypeLinear.MyMax, new Color (163, 73, 180 ) },
{ResultTypeLinear.MzMin, new Color (159, 99, 66 ) },
{ResultTypeLinear.MzMax, new Color (0, 128, 128 ) },
{ResultTypeLinear.FxMax, new Color (0, 0, 255 ) },
{ResultTypeLinear.FxMin, new Color (255, 119, 28 ) },
{ResultTypeLinear.FyMin, new Color (51, 177, 33 ) },
{ResultTypeLinear.FyMax, new Color (163, 73, 180 ) },
{ResultTypeLinear.FzMin, new Color (159, 99, 66 ) },
{ResultTypeLinear.FzMax, new Color (0, 128, 128 ) },
{ResultTypeLinear.Abottom, new Color (0, 0, 255 ) },
{ResultTypeLinear.Atop, new Color (255, 119, 28 ) },
{ResultTypeLinear.Aleft, new Color (51, 177, 33 ) },
{ResultTypeLinear.Aright, new Color (163, 73, 180 ) },
{ResultTypeLinear.StirrupsSpacing, new Color (159, 99, 66 ) },
{ResultTypeLinear.TransversalReinforcemenDensity, new Color (0, 128, 128 ) },
{ResultTypeLinear.UxMax, new Color (0, 0, 255 ) },
{ResultTypeLinear.UxMin, new Color (255, 119, 28 ) },
{ResultTypeLinear.UyMax, new Color (51, 177, 33 ) },
{ResultTypeLinear.UyMin, new Color (163, 73, 180 ) },
{ResultTypeLinear.UzMax, new Color (159, 99, 66 ) },
{ResultTypeLinear.UzMin, new Color (0, 128, 128 ) },
{ResultTypeLinear.UxRealMax, new Color (0, 0, 255 ) },
{ResultTypeLinear.UxRealMin, new Color (255, 119, 28 ) },
{ResultTypeLinear.UyRealMax, new Color (51, 177, 33 ) },
{ResultTypeLinear.UyRealMin, new Color (163, 73, 180 ) },
{ResultTypeLinear.UzRealMax, new Color (159, 99, 66 ) },
{ResultTypeLinear.UzRealMin, new Color (0, 128, 128 ) },
};
/// <summary>
/// Creats the section of document with table
/// </summary>
/// <param name="resultsInPoints"> Result in point collection</param>
/// <param name="resultTypes">The type of results that will be displayed in the table.</param>
/// <param name="document">Active Revit document</param>
/// <returns>Returns section of document with table</returns>
private DocumentTable CreateResultTableForLinearElements(ICollection<ResultInPointLinear> resultsInPoints, List<ResultTypeLinear> resultTypes, Autodesk.Revit.DB.Document document)
{
Units units = document.GetUnits();
resultTypes.Insert(0, ResultTypeLinear.X);
DocumentTable resultTable = new DocumentTable(resultsInPoints.Count + 1, resultTypes.Count());
int colId = 0;
resultTable.HeaderColumnsCount = 1;
resultTable.HeaderRowsCount = 1;
foreach (ResultTypeLinear resultType in resultTypes)
{
string description = Resources.ResourceManager.GetString(resultType == ResultTypeLinear.X ? "X_" : resultType.ToString());
resultTable[0, colId].Elements.Add(new DocumentText(description));
int rowId = 1;
UnitType unitType = resultType.GetUnitType();
DisplayUnitType displayUnitType = Utility.UnitsConverter.GetInternalUnit(unitType);
foreach (ResultInPointLinear resultInPoint in resultsInPoints)
{
if (DisplayUnitType.DUT_UNDEFINED != displayUnitType)
{
resultTable[rowId++, colId].Elements.Add(new DocumentValue(resultInPoint[resultType], displayUnitType, unitType, units));
}
else
{
resultTable[rowId++, colId].Elements.Add(new DocumentText(resultInPoint[resultType].ToString()));
}
}
colId++;
}
resultTypes.Remove(ResultTypeLinear.X);
return resultTable;
}
/// <summary>
/// Creats the section of document with diagram
/// </summary>
/// <param name="title">Title of the diagram</param>
/// <param name="resultsInPoints"> Result in point collection</param>
/// <param name="resultTypes">The type of results that will be displayed in the diagram.</param>
/// <param name="document">Active Revit document</param>
/// <param name="elementType">Structural element type</param>
/// <param name="reversedAxis">Sets the direction of the Y axis on the graph</param>
/// <returns>Returns section of document with diagram</returns>
private DocumentDiagram CreateResultDiagramForLinearElements(String title, IEnumerable<ResultInPointLinear> resultsInPoints, List<ResultTypeLinear> resultTypes, Autodesk.Revit.DB.Document document, ElementType elementType, bool reversedAxis)
{
Units units = document.GetUnits();
DocumentDiagram chart = new DocumentDiagram();
if (resultTypes != null)
{
if (resultTypes.Count() > 0)
{
if (title.Length != 0)
chart.Title = title;
chart.Height = 200;
chart.Width = 4 * chart.Height;
UnitType unitTypeX = ResultTypeLinear.X.GetUnitType();
FormatOptions formatOptions = units.GetFormatOptions(unitTypeX);
DisplayUnitType displayUnitTypeX = formatOptions.DisplayUnits;
DisplayUnitType internalDisplayUnitTypeX = UnitsConverter.GetInternalUnit(unitTypeX);
UnitSymbolType unitSymbolTypeX = formatOptions.UnitSymbol;
String axisTitle = "";
if (ElementType.Column == elementType)
axisTitle = Resources.ResourceManager.GetString("AxisHeight");
else
axisTitle = Resources.ResourceManager.GetString("AxisLength");
if (UnitSymbolType.UST_NONE != unitSymbolTypeX)
{
axisTitle += " " + LabelUtils.GetLabelFor(unitSymbolTypeX);
}
chart.AxisX.Title = axisTitle;
chart.AxisY.Reversed = reversedAxis;
UnitType unitTypeY = resultTypes.First().GetUnitType();
formatOptions = units.GetFormatOptions(unitTypeY);
DisplayUnitType displayUnitTypeY = formatOptions.DisplayUnits;
DisplayUnitType internalDisplayUnitTypeY = UnitsConverter.GetInternalUnit(unitTypeY);
UnitSymbolType unitSymbolTypeY = formatOptions.UnitSymbol;
switch (unitTypeY)
{
case UnitType.UT_Reinforcement_Area:
axisTitle = Resources.ResourceManager.GetString("AxisArea");
break;
case UnitType.UT_Force:
axisTitle = Resources.ResourceManager.GetString("AxisForce");
break;
case UnitType.UT_Moment:
axisTitle = Resources.ResourceManager.GetString("AxisMoment");
break;
case UnitType.UT_Displacement_Deflection:
axisTitle = Resources.ResourceManager.GetString("AxisDisplacmentDeflection");
break;
case UnitType.UT_Section_Dimension:
axisTitle = Resources.ResourceManager.GetString("AxisSpacing");
break;
case UnitType.UT_Reinforcement_Area_per_Unit_Length:
axisTitle = Resources.ResourceManager.GetString("AxisDencity");
break;
default:
break;
}
axisTitle += " ";
if (UnitSymbolType.UST_NONE == unitSymbolTypeY)
{
if(DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES == displayUnitTypeY)
axisTitle += LabelUtils.GetLabelFor(UnitSymbolType.UST_FT);
else if (DisplayUnitType.DUT_FRACTIONAL_INCHES == displayUnitTypeY)
axisTitle += LabelUtils.GetLabelFor(UnitSymbolType.UST_IN);
}
else
{
axisTitle += LabelUtils.GetLabelFor(unitSymbolTypeY);
}
chart.AxisY.Title = axisTitle;
double valX = 0;
double valY = 0;
foreach (ResultTypeLinear resultType in resultTypes)
{
DocumentDiagramSeries series = new DocumentDiagramSeries(resultType.ToString());
chart.Legend = true;
chart.Series.Add(series);
series.Color = ResultTypeLinearToColorDictionary[resultType];
series.Name = Resources.ResourceManager.GetString(resultType.ToString());
int lblNbr = 5;
int lblN = 0;
int lblStep = resultsInPoints.Count<ResultInPointLinear>() / lblNbr;
// Labels on the X axis will be formatted according to Revit preferences
//formatOptions = units.GetFormatOptions(unitTypeX);
//string accuracy = formatOptions.Accuracy.ToString();
//accuracy = accuracy.Replace("1", "0");
string valXAsString = "";
foreach (ResultInPointLinear resultInPoint in resultsInPoints)
{
valX = Autodesk.Revit.DB.UnitUtils.Convert(resultInPoint[ResultTypeLinear.X], internalDisplayUnitTypeX, displayUnitTypeX);
valY = Autodesk.Revit.DB.UnitUtils.Convert(resultInPoint[resultType], internalDisplayUnitTypeY, displayUnitTypeY);
series.AddXY(valX, valY);
if (lblStep == 0 || lblN % lblStep == 0)
{
//DocumentValue docVal = new DocumentValue(resultInPoint[ResultTypeLinear.X], displayUnitTypeX, unitTypeX, units);
DocumentValue docVal = new DocumentValue(valX, displayUnitTypeX, unitTypeX, units);
valXAsString = (string)docVal.Value;
chart.AxisX.Labels.Add(new DocumentDiagramAxisLabel(valX, valXAsString));
}
lblN++;
}
}
}
}
return chart;
}
/// <summary>
/// Creats document section with table and graph
/// </summary>
/// <param name="sectionTitle">Title of the section</param>
/// <param name="resultsInPoints"> Result in point collection</param>
/// <param name="resultTypes">The type of results that will be displayed in the diagram and in the table.</param>
/// <param name="document">Active Revit document</param>
/// <param name="elementType">Structural element type</param>
/// <param name="addTable">Enabling/disabling inserting a table</param>
/// <param name="addDiagram">Enabling/disabling inserting a graph</param>
/// <param name="tableTitle"> Title of the table</param>
/// <param name="diagramTitle"> Title of the graph</param>
/// <param name="reversedAxis">Sets the direction of the Y axis on the graph</param>
/// <returns>Returns section of document with diagram and table</returns>
private DocumentSection CreateSectionTableAndDiagramForLinearElements(ICollection<ResultInPointLinear> resultsInPoints, List<ResultTypeLinear> resultTypes, Autodesk.Revit.DB.Document document, ElementType elementType, bool addTable = true, bool addDiagram = true, bool reversedAxis = false, String sectionTitle = "", String tableTitle = "", String diagramTitle = "")
{
DocumentSection newDocumentSection = null;
if (addTable || addDiagram)
{
newDocumentSection = new DocumentSection(sectionTitle, 5);
newDocumentSection.Level = DetailLevel.Medium;
if (addTable)
{
DocumentSection tableSection = new DocumentSection(tableTitle, 6);
DocumentTable resultTable = CreateResultTableForLinearElements(resultsInPoints, resultTypes, document);
resultTable.Level = DetailLevel.Medium;
newDocumentSection.Body.Elements.Add(resultTable);
}
if (addDiagram)
{
DocumentSection diagramSection = new DocumentSection();
DocumentDiagram resultDiagram = CreateResultDiagramForLinearElements(diagramTitle, resultsInPoints, resultTypes, document, elementType, reversedAxis);
resultDiagram.Level = DetailLevel.Detail;
newDocumentSection.Body.Elements.Add(new DocumentLineBreak(2));
newDocumentSection.Body.Elements.Add(resultDiagram);
}
}
return newDocumentSection;
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,404 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking;
using Autodesk.Revit.DB.CodeChecking.Documentation;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Concrete;
using CodeCheckingConcreteExample.Utility;
using CodeCheckingConcreteExample.Main;
using CodeCheckingConcreteExample.Properties;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Server
{
public partial class Server : Autodesk.Revit.DB.CodeChecking.Documentation.MultiStructureServer
{
/// <summary>
/// Fills document body object with formatted reinforcement calculation results
/// </summary>
/// <param name="body">DocumentBody to be filled</param>
/// <param name="resultSurfaceElement">Calculation results schema class</param>
/// <param name="document">Active Revit document</param>
/// <param name="element">Structural element</param>
/// <param name="elementType">Typ of element</param>
private void WriteResultsToNoteForSurfaceElements(DocumentBody body, ResultSurfaceElement resultSurfaceElement, Autodesk.Revit.DB.Document document, Element element,ElementType elementType)
{
List<ResultInPointSurface> resultsInPointsCollection = resultSurfaceElement.GetResultsInPointsCollection();
/////////////////////////// Basic Level ///////////////////////////////////////
//////////////////// Summary
{
if (resultSurfaceElement.MultiLayer)
{
DocumentSection resultLeyerSection = new DocumentSection(Resources.ResourceManager.GetString("Layers"), 5);
resultLeyerSection.Level = DetailLevel.General;
List<Tuple<string, double>> structuralLayers = resultSurfaceElement.GetStructuralLayers();
double calculationThickness = 0;
resultLeyerSection.Body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("LayerTakenIntoConsideration"),true));
for (int layersId = 0; layersId < structuralLayers.Count(); layersId++)
{
resultLeyerSection.Body.Elements.Add((new DocumentValueWithName("- " + structuralLayers[layersId].Item1, structuralLayers[layersId].Item2, UnitsConverter.GetInternalUnit(UnitType.UT_Section_Dimension), UnitType.UT_Section_Dimension, document.GetUnits())));
calculationThickness += structuralLayers[layersId].Item2;
}
resultLeyerSection.Body.Elements.Add((new DocumentValueWithName(Resources.ResourceManager.GetString("ThicknessTakenIntoConsideration"),calculationThickness, UnitsConverter.GetInternalUnit(UnitType.UT_Section_Dimension), UnitType.UT_Section_Dimension, document.GetUnits())));
body.Elements.Add(resultLeyerSection);
}
// Create document section
DocumentSection resultSummarySection = new DocumentSection(Resources.ResourceManager.GetString("Summary"), 5);
resultSummarySection.Level = DetailLevel.General;
// Calculate mean and extreme values
IEnumerable<ResultTypeSurface> primary = new List<ResultTypeSurface> {ResultTypeSurface.AxxTop, ResultTypeSurface.AxxBottom};
IEnumerable<ResultTypeSurface> secondary = new List<ResultTypeSurface> { ResultTypeSurface.AyyTop, ResultTypeSurface.AyyBottom };
double meanPrimary = resultsInPointsCollection.Average(s => (primary.Sum(q => s[q]))),
meanSecondary = resultsInPointsCollection.Average(s => (secondary.Sum(q => s[q])));
// Add them to the section
string meanPrimaryString = elementType == ElementType.Floor ? "MeanPrimaryReinforcementDensity" : "MeanVerticallReinforcementDensity";
string meanSecondaryString = elementType == ElementType.Floor ? "MeanSecondaryReinforcementDensity" : "MeanHorizontalReinforcementDensity";
meanPrimaryString = Resources.ResourceManager.GetString(meanPrimaryString);
meanSecondaryString = Resources.ResourceManager.GetString(meanSecondaryString);
resultSummarySection.Body.Elements.Add((new DocumentValueWithName(meanPrimaryString, meanPrimary, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area_per_Unit_Length), UnitType.UT_Reinforcement_Area_per_Unit_Length, document.GetUnits())));
resultSummarySection.Body.Elements.Add((new DocumentValueWithName(meanSecondaryString, meanSecondary, UnitsConverter.GetInternalUnit(UnitType.UT_Reinforcement_Area_per_Unit_Length), UnitType.UT_Reinforcement_Area_per_Unit_Length, document.GetUnits())));
// Add extreme reinforcement table
resultSummarySection.Body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("ExtremeValuesOfReinforcement")));
resultSummarySection.Body.Elements.Add(CreateExtremeResultTableForSurfaceElements(resultsInPointsCollection, new List<ResultTypeSurface>() { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AyyTop }, document, elementType));
// Add section to the document body
body.Elements.Add(resultSummarySection);
}
/////////////////////////// Other levels ///////////////////////////////////////
//////////////////// Reinforcement table
{
// Create document section
DocumentSection reinforcementTableSection = new DocumentSection(Resources.ResourceManager.GetString("Reinforcement"), 5);
reinforcementTableSection.Level = DetailLevel.Medium;
// Add extreme reinforcement table
reinforcementTableSection.Body.Elements.Add(CreateResultTableForSurfaceElements(resultsInPointsCollection, new List<ResultTypeSurface>() { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AyyTop }, document, elementType));
// Add section to the document body
body.Elements.Add(reinforcementTableSection);
}
//////////////////// Reinforcement maps
{
// Create document section
DocumentSection reinforcementMapsSection = new DocumentSection(Resources.ResourceManager.GetString("ReinforcementMaps"), 5);
reinforcementMapsSection.Level = DetailLevel.Detail;
// Create and add reinforcement maps
ResultTypeSurface[] vForceType = { ResultTypeSurface.AxxBottom, ResultTypeSurface.AyyBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyTop };
List<DocumentMap> vMap = CreateResultMapSeriesForSurfaceElements(element, resultsInPointsCollection, vForceType.Select(s => new Tuple<ResultTypeSurface, string>(s, ResultDescription(elementType,s))));
foreach (DocumentMap map in vMap)
{
reinforcementMapsSection.Body.Elements.Add(map);
}
// Add section to the document body
body.Elements.Add(reinforcementMapsSection);
}
//////////////////// Extreme forces table
List<ResultTypeSurface> nonZeroInternalForces = ResultTypeSurfaceHelper.InternalForcesResults.Where(s => resultsInPointsCollection.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
bool isNonZeroInternalForces = (nonZeroInternalForces.Count() > 0);
{
// Only for non-zero values
if (isNonZeroInternalForces)
{
// Create document section
DocumentSection extremeForcesTable = new DocumentSection(Resources.ResourceManager.GetString("ExtremeAxialForces"), 5);
extremeForcesTable.Level = DetailLevel.Medium;
// Add extreme force table
extremeForcesTable.Body.Elements.Add(CreateExtremeResultTableForSurfaceElements(resultsInPointsCollection, ResultTypeSurfaceHelper.InternalForcesResults, document, elementType));
// Add section to the document body
body.Elements.Add(extremeForcesTable);
}
}
//////////////////// Extreme moments table
List<ResultTypeSurface> nonZeroInternalMoments = ResultTypeSurfaceHelper.InternalMomentsResults.Where(s => resultsInPointsCollection.Any(r => Math.Abs(r[s]) > Double.Epsilon)).ToList();
bool isNonZeroInternalMoments = (nonZeroInternalMoments.Count() > 0);
{
// Only for non-zero values
if (isNonZeroInternalMoments)
{
// Create document section
DocumentSection extremeMomentsTable = new DocumentSection(Resources.ResourceManager.GetString("ExtremeBendingMoments"), 5);
extremeMomentsTable.Level = DetailLevel.Medium;
// Add extreme moment table
extremeMomentsTable.Body.Elements.Add(CreateExtremeResultTableForSurfaceElements(resultsInPointsCollection, ResultTypeSurfaceHelper.InternalMomentsResults, document, elementType));
// Add section to the document body
body.Elements.Add(extremeMomentsTable);
}
}
//////////////////// Force envelopes table
{
// Only for non-zero values
if (isNonZeroInternalForces)
{
// Create document section
DocumentSection forceEnvelopesTable = new DocumentSection(Resources.ResourceManager.GetString("EnvelopeF"), 5);
forceEnvelopesTable.Level = DetailLevel.Detail;
// Add extreme force table
forceEnvelopesTable.Body.Elements.Add(CreateResultTableForSurfaceElements(resultsInPointsCollection, ResultTypeSurfaceHelper.InternalForcesResults, document, elementType));
// Add section to the document body
body.Elements.Add(forceEnvelopesTable);
}
}
//////////////////// Moments envelopes table
{
// Only for non-zero values
if (isNonZeroInternalMoments)
{
// Create document section
DocumentSection momentEnvelopesTable = new DocumentSection(Resources.ResourceManager.GetString("EnvelopeM"), 5);
momentEnvelopesTable.Level = DetailLevel.Detail;
// Add extreme force table
momentEnvelopesTable.Body.Elements.Add(CreateResultTableForSurfaceElements(resultsInPointsCollection, ResultTypeSurfaceHelper.InternalMomentsResults, document, elementType));
// Add section to the document body
body.Elements.Add(momentEnvelopesTable);
}
}
}
/// <summary>
/// Returns UI descriptions depends to element type and results type.
/// </summary>
/// <param name="elementType">Typ of element</param>
/// <param name="result">Results.</param>
/// <returns>Description that can be displayed on the maps and in the table.</returns>
private string ResultDescription(ElementType elementType, ResultTypeSurface result)
{
string description = string.Empty;
switch (result)
{
case ResultTypeSurface.AxxBottom:
case ResultTypeSurface.AxxTop:
case ResultTypeSurface.AyyBottom:
case ResultTypeSurface.AyyTop:
description = Resources.ResourceManager.GetString(elementType.ToString() + result.ToString());
break;
default:
description = Resources.ResourceManager.GetString(result.ToString());
break;
}
if (null == description)
description = result.ToString();
return description;
}
/// <summary>
/// Creates maps based on surface results. The maps can be displayed in the documentation.
/// </summary>
/// <param name="element">Revit element for which result document is built</param>
/// <param name="resultsInPoints">Result in point collection</param>
/// <param name="resultTypes">The type of results, values and description that can be displayed on the maps.</param>
/// <returns>Returns list of documets maps based on results that can be displayed in the documentation</returns>
private List<DocumentMap> CreateResultMapSeriesForSurfaceElements(Element element, ICollection<ResultInPointSurface> resultsInPoints, IEnumerable<Tuple<ResultTypeSurface, string>> resultTypes)
{
List<DocumentMap> vDocMap = new List<DocumentMap>();
MapDataGenerator mapPoints = new MapDataGenerator();
foreach (Tuple<ResultTypeSurface, string> forceDesc in resultTypes)
{
List<double> resData = resultsInPoints.Select(s => s[forceDesc.Item1]).ToList();
if (resData.Max(s => (Math.Abs(s))) < 1.0e-8)
{
continue;
}
AnalyticalModel slab = element as AnalyticalModel;
DisplayUnit displayUnit = DisplayUnit.IMPERIAL;
if (Server.UnitSystem == Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric)
displayUnit = DisplayUnit.METRIC;
ElementAnalyser elementAnalyser = new ElementAnalyser(displayUnit);
ElementInfo info = elementAnalyser.Analyse(element);
XYZ xyz = new XYZ();
if (info != null)
{
foreach (ResultInPointSurface resInPt in resultsInPoints)
{
mapPoints.AddPoint(new XYZ(resInPt[ResultTypeSurface.X], resInPt[ResultTypeSurface.Y], resInPt[ResultTypeSurface.Z]), resInPt[forceDesc.Item1]);
}
var contourAndHoles = getContourAndHolePoints(info);
contourAndHoles.Item1.ForEach( s=>mapPoints.AddPointToContour(s));
contourAndHoles.Item2.ForEach( s=>mapPoints.AddHole(s));
UnitType ut = forceDesc.Item1.GetUnitType();
DocumentMap docMap = new DocumentMap(ut, UnitsConverter.GetInternalUnit(ut));
docMap.Title = forceDesc.Item2;
int nofPoints = mapPoints.Count;
for (int ptId = 0; ptId < nofPoints; ptId++)
{
UV pt = mapPoints.GetPoint(ptId);
docMap.AddPoint(pt.U, pt.V, mapPoints.GetValue(ptId));
}
List<List<int>> holes = mapPoints.Holes;
foreach (List<int> hole in holes)
{
docMap.AddHole(hole);
}
docMap.DefineContour(mapPoints.Contour);
vDocMap.Add(docMap);
}
mapPoints.Clear();
}
return vDocMap;
}
private Tuple<List<XYZ>,List<List<XYZ>>> getContourAndHolePoints( ElementInfo info)
{
List<XYZ> contour = null;
List<List<XYZ>> holes = null;
if( info.Type==Autodesk.Revit.DB.CodeChecking.Engineering.ElementType.Slab )
{
contour = info.Slabs.AsElement.Contours.First(c=>c.ContourType==SlabContourType.Main).Edges.SelectMany( e=>e.Nodes.Select( n=>n.GetGlobalCoordinates())).ToList();
holes = info.Slabs.AsElement.Contours.Where( c=>c.ContourType==SlabContourType.Hole).Select
( hc=> hc.Edges.SelectMany( e=>e.Nodes.Select( n=>n.GetGlobalCoordinates())).ToList() ).ToList();
}
else if (info.Type == Autodesk.Revit.DB.CodeChecking.Engineering.ElementType.Wall)
{
contour = info.Walls.AsElement.Transform.ManyPoints2Global( info.Walls.AsElement.Contour.Points ).ToList();
holes = info.Walls.AsElement.Openings.Select(o => info.Walls.AsElement.Transform.ManyPoints2Global(o.Points).ToList()).ToList();
}
return new Tuple<List<XYZ>, List<List<XYZ>>>(contour,holes);
}
/// <summary>
/// Creates result table based on surface results.
/// </summary>
/// <param name="resInPtCollection">Result in point collection</param>
/// <param name="resultTypes">The type of results, values and description to use in the table.</param>
/// <param name="document">Revit document</param>
/// <param name="elementType">Type of element</param>
/// <returns>Document table containing surface results</returns>
private DocumentTable CreateResultTableForSurfaceElements(List<ResultInPointSurface> resInPtCollection, IEnumerable<ResultTypeSurface> resultTypes, Autodesk.Revit.DB.Document document, ElementType elementType)
{
// results table data
int rowsCount = 1 + resInPtCollection.Count(),
colsCount = (ElementType.Wall == elementType ? 3 : 2) + resultTypes.Count();
Units units = document.GetUnits();
DocumentTable resultTable = new DocumentTable( rowsCount, colsCount);
resultTable.HeaderColumnsCount = ElementType.Wall == elementType ? 3 : 2;
resultTable.HeaderRowsCount = 1;
// results table data
List<ResultTypeSurface> typesToPresent = ElementType.Wall == elementType ? new List<ResultTypeSurface>() { ResultTypeSurface.X, ResultTypeSurface.Y, ResultTypeSurface.Z } : new List<ResultTypeSurface>() { ResultTypeSurface.X, ResultTypeSurface.Y };
typesToPresent.AddRange(resultTypes);
int colId = 0;
foreach (ResultTypeSurface resultType in typesToPresent)
{
resultTable[0, colId].Elements.Add(new DocumentText(ResultDescription(elementType,resultType)));
UnitType unitType = resultType.GetUnitType();
DisplayUnitType displayUnitType = Utility.UnitsConverter.GetInternalUnit(unitType);
int rowId = 1;
foreach (ResultInPointSurface resultInPoint in resInPtCollection)
{
if (DisplayUnitType.DUT_UNDEFINED != displayUnitType)
{
resultTable[rowId++, colId].Elements.Add(new DocumentValue(resultInPoint[resultType], displayUnitType, unitType, units));
}
else
{
resultTable[rowId++, colId].Elements.Add(new DocumentText(resultInPoint[resultType].ToString()));
}
}
colId++;
}
return resultTable;
}
/// <summary>
/// Creates result table based on surface results that contains extreme values for specified result types.
/// </summary>
/// <param name="resInPtCollection">Result in point collection</param>
/// <param name="resultTypes">The type of results, values and description to use in the table.</param>
/// <param name="document">Revit document</param>
/// <param name="elementType">Type of element</param>
/// <returns>Document table containing surface results</returns>
private DocumentTable CreateExtremeResultTableForSurfaceElements(List<ResultInPointSurface> resInPtCollection, IEnumerable<ResultTypeSurface> resultTypes, Autodesk.Revit.DB.Document document, ElementType elementType)
{
IEnumerable<Tuple<ResultTypeSurface, double>> maxValues = resultTypes.Select(s => new Tuple<ResultTypeSurface, double>(s, s.ToString().ToLower().Contains("min") ? resInPtCollection.Min(q => q[s]) : resInPtCollection.Max(q => q[s])));
int rowsCount = 2,
colsCount = resultTypes.Count();
Units units = document.GetUnits();
DocumentTable resultTable = new DocumentTable(rowsCount, colsCount);
resultTable.HeaderColumnsCount = 0;
resultTable.HeaderRowsCount = 1;
// results table data
List<ResultTypeSurface> typesToPresent = new List<ResultTypeSurface>() { ResultTypeSurface.X, ResultTypeSurface.Y };
typesToPresent.AddRange(resultTypes);
int colId=0;
foreach (Tuple<ResultTypeSurface, double> result in maxValues)
{
resultTable[0, colId].Elements.Add(new DocumentText(ResultDescription(elementType, result.Item1)));
UnitType unitType = result.Item1.GetUnitType();
DisplayUnitType displayUnitType = Utility.UnitsConverter.GetInternalUnit(unitType);
if (DisplayUnitType.DUT_UNDEFINED != displayUnitType)
{
resultTable[1, colId].Elements.Add(new DocumentValue(result.Item2, displayUnitType, unitType, units));
}
else
{
resultTable[1, colId].Elements.Add(new DocumentText(result.Item2.ToString()));
}
colId++;
}
return resultTable;
}
}
/// </structural_toolkit_2015>
}
@@ -0,0 +1,326 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
using Autodesk.Revit.UI.ExtensibleStorage;
using CodeCheckingConcreteExample.ConcreteTypes;
using CodeCheckingConcreteExample.Properties;
using CodeCheckingConcreteExample.Main;
#pragma warning disable 1591
namespace CodeCheckingConcreteExample.Server
{
[Autodesk.Revit.DB.CodeChecking.Attributes.CalculationParamsStructure(typeof(CalculationParameter))]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelBeam), BuiltInCategory.OST_BeamAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelColumn), BuiltInCategory.OST_ColumnAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
/// <structural_toolkit_2015>
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelFloor), BuiltInCategory.OST_FloorAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelFloor), BuiltInCategory.OST_FoundationSlabAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
[Autodesk.Revit.DB.CodeChecking.Attributes.LabelStructure(typeof(LabelWall), BuiltInCategory.OST_WallAnalytical, Autodesk.Revit.DB.StructuralAssetClass.Concrete)]
/// </structural_toolkit_2015>
public class ServerUI : Autodesk.Revit.UI.CodeChecking.MultiStructureServer
{
#region ICodeCheckingServerUI Members
public override string GetResource(string key, string context)
{
string txt = "";
string resname = "";
if (context != null)
{
switch (context)
{
default:
break;
case "ColumnLabel":
{
switch (key)
{
case "FX":
case "FY":
case "FZ":
case "MX":
case "MY":
case "MZ":
resname = "Column" + key;
break;
}
break;
}
case "BeamLabel":
{
switch (key)
{
case "FX":
case "FY":
case "FZ":
case "MX":
case "MY":
case "MZ":
resname = "Beam" + key;
break;
}
break;
}
/// <structural_toolkit_2015>
case "FloorLabel":
switch (key)
{
default:
break;
case "FX":
resname = "FloorF";
break;
case "MY":
resname = "FloorM";
break;
case "FZ":
resname = "FloorQ";
break;
}
break;
case "WallLabel":
switch (key)
{
default:
break;
case "FX":
resname = "WallF";
break;
case "MY":
resname = "WallM";
break;
case "FZ":
resname = "WallQ";
break;
}
break;
/// </structural_toolkit_2015>
}
}
if (!string.IsNullOrEmpty(resname))
txt = Resources.ResourceManager.GetString(resname);
if (string.IsNullOrEmpty(txt))
txt = Resources.ResourceManager.GetString(key);
if (!string.IsNullOrEmpty(txt))
return txt;
return key;
}
public override Uri GetResourceImage(string key, string context)
{
String contextKey = "";
if (context != null)
{
switch (context)
{
default:
break;
case "ColumnLabel":
{
switch (key)
{
case "FX":
contextKey = "CFX_32";
break;
case "FY":
contextKey = "CFY_32";
break;
case "FZ":
contextKey = "CFZ_32";
break;
case "MX":
contextKey = "CMX_32";
break;
case "MY":
contextKey = "CMY_32";
break;
case "MZ":
contextKey = "CMZ_32";
break;
case "DirectionY":
contextKey = "buckling_Y";
break;
case "DirectionZ":
contextKey = "buckling_Z";
break;
}
break;
}
case "BeamLabel":
{
switch (key)
{
case "FX":
contextKey = "BFX_32";
break;
case "FY":
contextKey = "BFY_32";
break;
case "FZ":
contextKey = "BFZ_32";
break;
case "MX":
contextKey = "BMX_32";
break;
case "MY":
contextKey = "BMY_32";
break;
case "MZ":
contextKey = "BMZ_32";
break;
}
break;
}
/// <structural_toolkit_2015>
case "FloorLabel":
{
switch (key)
{
case "FX":
case "MY":
contextKey = "F" + key + "_32";
break;
default:
contextKey = null;
break;
}
break;
}
case "WallLabel":
{
switch (key)
{
case "FX":
case "FY":
case "MY":
contextKey = "W" + key + "_32";
break;
default:
contextKey = null;
break;
}
break;
}
}
}
if (contextKey == "")
{
switch (key)
{
case "WithSlabBeamInteraction":
contextKey = "BWithSlabBeamInteraction";
break;
case "WithoutSlabBeamInteraction":
contextKey = "BWithoutSlabBeamInteraction";
break;
default:
contextKey = context != null ? context + key : key;
break;
}
}
String currAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().ToString();
return contextKey==null ? null : new Uri("pack://application:,,,/" + currAssemblyName + ";component/UIComponents/ICons/" + contextKey + ".png");
}
public override void LayoutInitialized(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.LayoutInitializedEventArgs e)
{
onChange(e);
base.LayoutInitialized(sender, e);
}
public override void ValueChanged(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.ValueChangedEventArgs e)
{
onChange(e);
}
private void onChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
String elementTypeName = e.Editor.GetEntity().Schema.SchemaName;
if (elementTypeName == "LabelColumn")
{
LabelColumn obj = new LabelColumn();
obj.SetProperties(e.Entity as Autodesk.Revit.DB.ExtensibleStorage.Entity, e.Document);
e.Editor.SetAttribute("LengthCoefficientY", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionY, DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetAttribute("ColumnStructureTypeY", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionY, DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetAttribute("LengthCoefficientZ", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionZ, DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetAttribute("ColumnStructureTypeZ", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionZ, DisplayUnitType.DUT_UNDEFINED);
}
}
public override Layout BuildLabelLayout(Schema schema, Document document)
{
Layout layout = null;
if (schema.SchemaName == "LabelBeam")
{
layout = Layout.Build(typeof(LabelBeam), this);
}
if (schema.SchemaName == "LabelColumn")
{
layout = Layout.Build(typeof(LabelColumn), this);
if (layout != null)
{
Autodesk.Revit.UI.ExtensibleStorage.Framework.Category category = layout.GetCategory("Buckling");
String currAssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().ToString();
Image image = new Image() { Source = new Uri("pack://application:,,,/" + currAssemblyName + ";component/UIComponents/ICons/" + "buckling.png"), Index = 1 };
category.Controls.Add(image);
layout.SortIndexBased();
}
}
/// <structural_toolkit_2015>
if (schema.SchemaName == "LabelWall")
{
layout = Layout.Build(typeof(LabelWall), this);
}
if (schema.SchemaName == "LabelFloor")
{
layout = Layout.Build(typeof(LabelFloor), this);
}
/// </structural_toolkit_2015>
return layout;
}
public override System.Collections.IList GetDataSource(string key, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.DisplayUnitType unitType)
{
return base.GetDataSource(key, document, unitType);
}
#endregion
}
}
@@ -0,0 +1,38 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
#pragma warning disable 1591
public class CalculationPointsSelectorAttribute : Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.SubSchemaEmbeddedControlAttribute
{
public CalculationPointsSelectorAttribute()
{
ServerUI = typeof(CalculationPointsSelectorServerUI);
}
}
}
@@ -0,0 +1,191 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
/// <summary>
/// Component for calculation points selection
/// Available selection methods are: UniformDistribution,UserCoordinates,UserSegmentDivision,Points of extreme values
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("CalculationPointsSelectorSchema", "88b169e5-cfb4-440a-830f-20958f71663b")]
public class CalculationPointsSelectorSchema : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
// UniformDistribution
/// <summary>
/// Division type
/// </summary>
public enum DivisionType
{
/// <summary>
/// Uniform distribution defined by a given number of points
/// </summary>
Points,
/// <summary>
/// Uniform distribution defined by segments
/// </summary>
Segments
}
/// <summary>
/// How the bar should be divided into calculation points
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "ElementDivisionType")]
[EnumControl(Description = "ElementDivisionType", EnumType = typeof(ConcreteTypes.EnabledInternalForces), Presentation = PresentationMode.OptionList, Item = PresentationItem.Text, Localizable = true, Context = "CalculationPointsSelector")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.DefaultElement(Localizable = true)]
public DivisionType ElementDivisionType { get; set; }
/// <summary>
/// Number points in Uniform distribution
/// </summary>
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "UniformDistribution", Index = 2)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(Name = "UniformDistribution", Localizable = true, LocalizableValue = true)]
public int UniformDistribution { get; set; }
/// <summary>
/// Length of user segment(Absolute)
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(Unit = UnitType.UT_Length, DisplayUnit = DisplayUnitType.DUT_METERS)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.UnitTextBox(Description = "UserSegmentDivision", Index = 3, MinimumValue = 1.0e-12, ValidateMinimumValue = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(Name = "UserSegmentDivision", Localizable = true, LocalizableValue = true, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General)]
public double UserSegmentDivision { get; set; }
/// <summary>
/// Points of extreme values flag
/// </summary>
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.CheckBox(Description = "IsPointsOfExtremeValues", Index = 4)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithDescription(Description = "IsPointsOfExtremeValues", Localizable = true, LocalizableValue = true, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General)]
public bool IsPointsOfExtremeValues { get; set; }
/// <summary>
/// Creates default CalculationPointsSelectorSchema
/// </summary>
public CalculationPointsSelectorSchema()
{
UserSegmentDivision = 1.0;
}
/// <summary>
///
/// </summary>
/// <param name="doc">Revit document</param>
/// <param name="isOutputRelative">Flag indicating whether returned points should have relative coordinates</param>
/// <param name="absoluteElementLength">Element length</param>
/// <param name="elementId">Revit ElementId</param>
/// <param name="combinations">List of Revit ElementId for combinations</param>
/// <param name="forceTypes">Force type vector</param>
/// <returns></returns>
public List<double> GetPointCoordinates(Document doc, bool isOutputRelative, double absoluteElementLength, ElementId elementId, List<ElementId> combinations, List<ForceType> forceTypes)
{
List<double> coordinates = new List<double>();
bool isNonzeroElement = absoluteElementLength > 0.01;
// don't calculate if element length is zero and coordinates in absolute points
if (!isOutputRelative || isNonzeroElement)
{
// get points from uniform distribution
if (ElementDivisionType == DivisionType.Points)
{
int numberOfPoints = UniformDistribution,
lastId = numberOfPoints - 1;
if (lastId > 0)
{
double segmentLength = ( isOutputRelative ? 1.0 : absoluteElementLength ) / (lastId);
for (int i = 0; i <= lastId; i++)
{
coordinates.Add(i * segmentLength);
}
}
}
// get points from user segment division
else if (ElementDivisionType == DivisionType.Segments)
{
if ( isNonzeroElement)
{
double segmentLength = (UserSegmentDivision / absoluteElementLength),
distance = 0.0;
while (distance < 1.0)
{
coordinates.Add(distance);
distance += segmentLength;
}
coordinates.Add(1.0);
}
}
// get points where forces have extreme values
if (IsPointsOfExtremeValues && forceTypes!=null && forceTypes.Count!=0)
{
List<double> extremeValueCoordinates = (ForceResultsUtils.GetExtremumValueCoordinates(doc, combinations, forceTypes, new List<ElementId>() { elementId }).Select(s => s.Item4)).ToList();
if (isOutputRelative)
{
if (isNonzeroElement)
{
for (int i = 0; i < extremeValueCoordinates.Count; i++)
{
extremeValueCoordinates[i] /= absoluteElementLength;
}
}
else
{
throw new ArgumentException("Nonzero element length required for relative output");
}
}
coordinates.AddRange(extremeValueCoordinates);
}
coordinates.Sort();
}
return coordinates.Distinct(new DoubleComparer()).ToList();
}
}
internal class DoubleComparer : IEqualityComparer<double>
{
public bool Equals(double a, double b) { return Math.Abs(a - b) < 0.0001; }
public int GetHashCode(double a) { return (int)Math.Floor(a * 100000 + 0.5); }
}
}
@@ -0,0 +1,92 @@
//
// (C) Copyright 2003-2013 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
#pragma warning disable 1591
class CalculationPointsSelectorServerUI : Autodesk.Revit.UI.ExtensibleStorage.Framework.IServerUI
{
#region IServerUI Members
public System.Collections.IList GetDataSource(string key, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.DisplayUnitType unitType)
{
return null;
}
public void LayoutInitialized(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.LayoutInitializedEventArgs e)
{
onChange(e);
}
public void ValueChanged(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.ValueChangedEventArgs e)
{
onChange(e);
}
private void onChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
CalculationPointsSelectorSchema pointsSelectorSchema = new CalculationPointsSelectorSchema();
pointsSelectorSchema.SetProperties(e.Entity as Autodesk.Revit.DB.ExtensibleStorage.Entity);
CalculationPointsSelectorSchema.DivisionType divisionType = pointsSelectorSchema.ElementDivisionType;
bool isUniformDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Points,
isUserSegmentDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Segments;
e.Editor.SetAttribute("UniformDistribution", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUniformDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetAttribute("UserSegmentDivision", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUserSegmentDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED);
}
#endregion
#region IResource Members
public string GetResource(string key, string context)
{
String txt = null;
if (context == "CalculationPointsSelector")
{
if (key == "Points" || key == "Segments")
{
txt = CodeCheckingConcreteExample.Properties.Resources.ResourceManager.GetString(key);
}
}
return txt != null ? txt : key;
}
public Uri GetResourceImage(string key, string context)
{
return null;
}
#endregion
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Some files were not shown because too many files have changed in this diff Show More