Initial check in of used types

This commit is contained in:
Adam Hathcock
2024-06-06 09:03:39 +01:00
parent 2e9e170cc8
commit 475d8d889e
53 changed files with 2150 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.28.1",
"commands": [
"dotnet-csharpier"
]
}
}
}
+7
View File
@@ -0,0 +1,7 @@
printWidth: 120
useTabs: false
tabWidth: 2
preprocessorSymbolSets:
- ""
- "DEBUG"
- "DEBUG,CODE_STYLE"
+305
View File
@@ -0,0 +1,305 @@
root = true
# Don't use tabs for indentation.
[*]
indent_style = space
# Microsoft .NET properties
csharp_using_directive_placement = outside_namespace:silent
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
# Standard properties
insert_final_newline = true
# (Please don't specify an indent_size here; that has too many unintended consequences.)
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 2
charset = utf-8
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
space_after_last_pi_attribute = false
# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
space_after_last_pi_attribute = false
# JSON files
[*.json]
indent_size = 2
# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
# CSharp code style settings:
[*.cs]
# Prefer "var" everywhere
csharp_style_var_elsewhere = false:none
csharp_style_var_for_built_in_types = false:none
csharp_style_var_when_type_is_apparent = false:none
# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = true:suggestion
# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_namespace_declarations = file_scoped
# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
# SYMBOL NAMING RULES
# Copied from https://github.com/dotnet/roslyn/blob/main/.editorconfig
# Adapted rules:
# - Constants are ALL_UPPER
# - Non-private fields are PascalCase
# Non-private fields are PascalCase
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
# Constants are ALL_UPPER
dotnet_naming_rule.constants_should_be_all_upper.severity = warning
dotnet_naming_rule.constants_should_be_all_upper.symbols = constants
dotnet_naming_rule.constants_should_be_all_upper.style = constant_style
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.constant_style.capitalization = all_upper
# Private static fields are camelCase and start with s_
dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
dotnet_naming_symbols.static_fields.applicable_accessibilities = private
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_style.static_field_style.capitalization = camel_case
dotnet_naming_style.static_field_style.required_prefix = s_
# Instance fields are camelCase and start with _
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = warning
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
# Locals and parameters are camelCase
dotnet_naming_rule.locals_should_be_camel_case.severity = warning
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
dotnet_naming_style.camel_case_style.capitalization = camel_case
# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
dotnet_naming_style.local_function_style.capitalization = pascal_case
# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = warning
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.all_members.applicable_kinds = *
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Analyzer settings
dotnet_analyzer_diagnostic.category-Style.severity = warning # All rules will use this severity unless overriden
dotnet_diagnostic.ide0055.severity = none # Formatting rule: Incompatible with CSharpier
dotnet_diagnostic.ide0007.severity = none # Use var instead of explicit type: Preference
dotnet_diagnostic.ide0009.severity = none # Add this or Me qualification: Preference
dotnet_diagnostic.ide0200.severity = none # Remove unnecessary lambda expression: may be performance reasons not to
dotnet_diagnostic.ide0058.severity = none # Remove unnecessary expression value: Subjective
dotnet_diagnostic.ide0010.severity = none # Add missing cases to switch statement: Too verbose
dotnet_diagnostic.ide0200.severity = none # Remove unnecessary lambda expression: may be performance reasons not to
dotnet_diagnostic.ide0058.severity = none # Remove unnecessary expression value: Subjective
dotnet_diagnostic.ide0001.severity = suggestion # Name can be simplified: Non enforceable in build
dotnet_diagnostic.ide0046.severity = suggestion # Use conditional expression for return: Subjective
dotnet_diagnostic.ide0045.severity = suggestion # Use conditional expression for assignment: Subjective
dotnet_diagnostic.ide0078.severity = suggestion # Use pattern matching: Subjective
dotnet_diagnostic.ide0260.severity = suggestion # Use pattern matching: Subjective
dotnet_diagnostic.ide0022.severity = suggestion # Use expression body for method: Subjective
dotnet_diagnostic.ide0061.severity = suggestion # Use expression body for local functions: Subjective
dotnet_diagnostic.ide0063.severity = suggestion # Using directive can be simplified
dotnet_diagnostic.ide0066.severity = suggestion # Use switch expression: Subjective
dotnet_diagnostic.ide0029.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0030.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0270.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0042.severity = suggestion # Deconstruct variable declaration: Subjective
dotnet_diagnostic.ide0039.severity = suggestion # Use local function instead of lambda: Subjective
dotnet_diagnostic.ide0029.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0030.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0270.severity = suggestion # Null check can be simplified: Subjective
dotnet_diagnostic.ide0042.severity = suggestion # Deconstruct variable declaration: Subjective
dotnet_diagnostic.ide0028.severity = suggestion # Use collection initializers: Subjective
dotnet_diagnostic.ide0072.severity = suggestion # Populate switch statement: Subjective
dotnet_diagnostic.ide0074.severity = suggestion # Use compound assignment: Subjective
# Maintainability rules
dotnet_diagnostic.ca1501.severity = warning # Avoid excessive inheritance
dotnet_diagnostic.ca1502.severity = warning # Avoid excessive complexity
dotnet_diagnostic.ca1505.severity = warning # Avoid unmaintainable code
dotnet_diagnostic.ca1506.severity = warning # Avoid excessive class coupling
dotnet_diagnostic.ca1507.severity = warning # Use nameof in place of string
dotnet_diagnostic.ca1508.severity = warning # Avoid dead conditional code
dotnet_diagnostic.ca1509.severity = warning # Invalid entry in code metrics configuration file
dotnet_diagnostic.ca1861.severity = none # Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861)
# Performance rules
dotnet_diagnostic.ca1849.severity = suggestion # Call async methods when in an async method: May decrease performance
dotnet_diagnostic.ca1822.severity = suggestion # Mark member as static
dotnet_diagnostic.ca1859.severity = suggestion # Use concrete types when possible for improved performance
# Design rule
dotnet_diagnostic.ca1002.severity = suggestion # Do not expose generic lists
dotnet_diagnostic.ca1051.severity = warning # Do not declare visible instance fields
dotnet_diagnostic.ca1056.severity = suggestion # URI properties should not be strings
dotnet_diagnostic.ca1062.severity = none # Public method must check all parameters for null
# Naming
dotnet_diagnostic.ca1707.severity = none # Remove underscores in names
# Usage
dotnet_diagnostic.ca2227.severity = suggestion # Collection props should be read-only
dotnet_code_quality.ca1051.exclude_structs = true # CA1051 is excluded in structs
dotnet_code_quality.dispose_ownership_transfer_at_constructor = true # CA2000 has a lot of false positives without this
dotnet_code_quality.dispose_ownership_transfer_at_method_call = true # CA2000 has a lot of false positives without this
dotnet_code_quality.dispose_analysis_kind = NonExceptionPathsOnlyNotDisposed # CA2000 has a lot of false positives without this
# NUnit
dotnet_diagnostic.NUnit2001.severity = warning # Consider using Assert.That(expr, Is.False) instead of Assert.False(expr)
dotnet_diagnostic.NUnit2002.severity = warning # Consider using Assert.That(expr, Is.False) instead of Assert.IsFalse(expr)
dotnet_diagnostic.NUnit2003.severity = warning # Consider using Assert.That(expr, Is.True) instead of Assert.IsTrue(expr)
dotnet_diagnostic.NUnit2004.severity = warning # Consider using Assert.That(expr, Is.True) instead of Assert.True(expr)
dotnet_diagnostic.NUnit2005.severity = warning # Consider using Assert.That(actual, Is.EqualTo(expected)) instead of Assert.AreEqual(expected, actual)
dotnet_diagnostic.NUnit2006.severity = warning # Consider using Assert.That(actual, Is.Not.EqualTo(expected)) instead of Assert.AreNotEqual(expected, actual)
dotnet_diagnostic.NUnit2010.severity = warning # Use EqualConstraint for better assertion messages in case of failure
dotnet_diagnostic.NUnit2011.severity = warning # Use ContainsConstraint for better assertion messages in case of failure
dotnet_diagnostic.NUnit2011.severity = warning # Use StartsWithConstraint for better assertion messages in case of failure
dotnet_diagnostic.NUnit2011.severity = warning # Use EndsWithConstraint for better assertion messages in case of failure
dotnet_diagnostic.NUnit2014.severity = warning # Use SomeItemsConstraint for better assertion messages in case of failure
dotnet_diagnostic.NUnit2015.severity = warning # Consider using Assert.That(actual, Is.SameAs(expected)) instead of Assert.AreSame(expected, actual)
dotnet_diagnostic.NUnit2016.severity = warning # Consider using Assert.That(expr, Is.Null) instead of Assert.Null(expr)
dotnet_diagnostic.NUnit2017.severity = warning # Consider using Assert.That(expr, Is.Null) instead of Assert.IsNull(expr)
dotnet_diagnostic.NUnit2018.severity = warning # Consider using Assert.That(expr, Is.Not.Null) instead of Assert.NotNull(expr)
dotnet_diagnostic.NUnit2028.severity = warning # Consider using Assert.That(actual, Is.GreaterThanOrEqualTo(expected)) instead of Assert.GreaterOrEqual(actual, expected)
dotnet_diagnostic.NUnit2027.severity = warning # Consider using Assert.That(actual, Is.GreaterThan(expected)) instead of Assert.Greater(actual, expected)
dotnet_diagnostic.NUnit2029.severity = warning # Consider using Assert.That(actual, Is.LessThan(expected)) instead of Assert.Less(actual, expected)
dotnet_diagnostic.NUnit2030.severity = warning # Consider using Assert.That(actual, Is.LessThanOrEqualTo(expected)) instead of Assert.LessOrEqual(actual, expected)
dotnet_diagnostic.NUnit2031.severity = warning # Consider using Assert.That(actual, Is.Not.SameAs(expected)) instead of Assert.AreNotSame(expected, actual)
dotnet_diagnostic.NUnit2032.severity = warning # Consider using Assert.That(expr, Is.Zero) instead of Assert.Zero(expr)
dotnet_diagnostic.NUnit2033.severity = warning # Consider using Assert.That(expr, Is.Not.Zero) instead of Assert.NotZero(expr)
dotnet_diagnostic.NUnit2034.severity = warning # Consider using Assert.That(expr, Is.NaN) instead of Assert.IsNaN(expr)
dotnet_diagnostic.NUnit2035.severity = warning # Consider using Assert.That(collection, Is.Empty) instead of Assert.IsEmpty(collection)
dotnet_diagnostic.NUnit2036.severity = warning # Consider using Assert.That(collection, Is.Not.Empty) instead of Assert.IsNotEmpty(collection)
dotnet_diagnostic.NUnit2037.severity = warning # Consider using Assert.That(collection, Does.Contain(instance)) instead of Assert.Contains(instance, collection)
dotnet_diagnostic.NUnit2038.severity = warning # Consider using Assert.That(actual, Is.InstanceOf(expected)) instead of Assert.IsInstanceOf(expected, actual)
dotnet_diagnostic.NUnit2039.severity = warning # Consider using Assert.That(actual, Is.Not.InstanceOf(expected)) instead of Assert.IsNotInstanceOf(expected, actual)
[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,ixx,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,shader,skin,tpp,usf,ush,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 2
tab_width = 2
+5
View File
@@ -0,0 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# need original files to be windows
*.txt text eol=crlf
+21
View File
@@ -0,0 +1,21 @@
**/bin/*
**/obj/*
_ReSharper.SharpCompress/
bin/
*.suo
*.user
TestArchives/Scratch/
TestArchives/Scratch2/
TestResults/
*.nupkg
packages/*/
project.lock.json
tests/TestArchives/Scratch
.vs
tools
.vscode
.idea/
.DS_Store
*.snupkg
/tests/TestArchives/6d23a38c-f064-4ef1-ad89-b942396f53b9/Scratch
+17
View File
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AnalysisMode>Recommended</AnalysisMode>
<WarningsAsErrors>true</WarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzersDuringBuild>False</RunAnalyzersDuringBuild>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
</Project>
+7
View File
@@ -0,0 +1,7 @@
<Project>
<ItemGroup>
<PackageVersion Include="Speckle.ProxyGenerator" Version="0.1.6" PrivateAssets="All"/>
<PackageVersion Include="Speckle.Revit.API" Version="2023.0.0" />
<PackageVersion Include="Mapster" Version="7.3.0" />
</ItemGroup>
</Project>
+45
View File
@@ -0,0 +1,45 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Revit2023.Api", "Speckle.Revit2023.Api\Speckle.Revit2023.Api.csproj", "{199733E0-5C61-4C9C-A115-0CADD5058F20}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Revit", "Revit", "{8F540B7F-7548-46E9-BDEC-4DAB99367908}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Revit2023.Interfaces", "Speckle.Revit2023.Interfaces\Speckle.Revit2023.Interfaces.csproj", "{86D5D9A2-7885-4871-AD5B-081B62E87908}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Revit.Interfaces", "Speckle.Revit.Interfaces\Speckle.Revit.Interfaces.shproj", "{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED6}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Revit.Api", "Speckle.Revit.Api\Speckle.Revit.Api.shproj", "{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{7A91F6BF-EA8A-428E-BB97-B6C448C247EF}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
global.json = global.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Versions", "Versions", "{80F2939A-20C8-4128-82EA-F14274D9E57D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{199733E0-5C61-4C9C-A115-0CADD5058F20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{199733E0-5C61-4C9C-A115-0CADD5058F20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{199733E0-5C61-4C9C-A115-0CADD5058F20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{199733E0-5C61-4C9C-A115-0CADD5058F20}.Release|Any CPU.Build.0 = Release|Any CPU
{86D5D9A2-7885-4871-AD5B-081B62E87908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86D5D9A2-7885-4871-AD5B-081B62E87908}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86D5D9A2-7885-4871-AD5B-081B62E87908}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86D5D9A2-7885-4871-AD5B-081B62E87908}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED6} = {8F540B7F-7548-46E9-BDEC-4DAB99367908}
{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED7} = {8F540B7F-7548-46E9-BDEC-4DAB99367908}
{80F2939A-20C8-4128-82EA-F14274D9E57D} = {8F540B7F-7548-46E9-BDEC-4DAB99367908}
{199733E0-5C61-4C9C-A115-0CADD5058F20} = {80F2939A-20C8-4128-82EA-F14274D9E57D}
{86D5D9A2-7885-4871-AD5B-081B62E87908} = {80F2939A-20C8-4128-82EA-F14274D9E57D}
EndGlobalSection
EndGlobal
+10
View File
@@ -0,0 +1,10 @@
using Speckle.Revit2023.Interfaces;
using DB = Autodesk.Revit.DB;
namespace Speckle.Revit2023.Api;
public static class DocumentExtensions
{
public static DB.Element GetElement(this IRevitDocument document, DB.ElementId id) =>
((IRevitDocumentProxy)document)._Instance.GetElement(id);
}
+53
View File
@@ -0,0 +1,53 @@
using System.Diagnostics.CodeAnalysis;
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
#pragma warning disable CA1010
#pragma warning disable CA1710
namespace Speckle.Revit2023.Api;
[Proxy(
typeof(Document),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "PlanTopology", "PlanTopologies", "TypeOfStorage", "Equals" }
)]
[SuppressMessage("Maintainability", "CA1506:Avoid excessive class coupling")]
public partial interface IRevitDocumentProxy : IRevitDocument { }
[Proxy(
typeof(ForgeTypeId),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "Equals" }
)]
public partial interface IRevitForgeTypeIdProxy : IRevitForgeTypeId { }
[Proxy(
typeof(Element),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "Parameter", "BoundingBox", "Geometry" }
)]
public partial interface IRevitElementProxy : IRevitElement { }
[Proxy(
typeof(Category),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "AllowsVisibilityControl", "Visible" }
)]
public partial interface IRevitCategoryProxy : IRevitCategory { }
[Proxy(
typeof(ElementId),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "Equals" }
)]
public partial interface IRevitElementIdProxy : IRevitElementId { }
[Proxy(typeof(CurtainGrid), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitCurtainGridProxy : IRevitCurtainGrid { }
[Proxy(typeof(Wall), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitWallProxy : IRevitWall { }
[Proxy(typeof(HostObject), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitHostObjectProxy : IRevitHostObject { }
@@ -0,0 +1,52 @@
using System.Collections;
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
[Proxy(
typeof(ModelCurveArrArray),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "GetEnumerator", "Item", "get_Item", "set_Item" }
)]
public partial interface IRevitModelCurveArrArrayProxy : IRevitModelCurveArrArray { }
public partial class ModelCurveArrArrayProxy
{
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public int Count => Size;
public IEnumerator<IRevitModelCurveArray> GetEnumerator() =>
new RevitModelCurveArrayIterator(_Instance.ForwardIterator());
private readonly struct RevitModelCurveArrayIterator : IEnumerator<IRevitModelCurveArray>
{
private readonly ModelCurveArrArrayIterator _curveArrayIterator;
public RevitModelCurveArrayIterator(ModelCurveArrArrayIterator curveArrayIterator)
{
_curveArrayIterator = curveArrayIterator;
}
public void Dispose() => _curveArrayIterator.Dispose();
public bool MoveNext() => _curveArrayIterator.MoveNext();
public void Reset() => _curveArrayIterator.Reset();
object IEnumerator.Current => Current;
public IRevitModelCurveArray Current => new ModelCurveArrayProxy((ModelCurveArray)_curveArrayIterator.Current);
}
public IRevitModelCurveArray this[int index]
{
get
{
var obj = _Instance.get_Item(index);
return Mapster.TypeAdapter.Adapt<IRevitModelCurveArray>(obj);
}
}
}
@@ -0,0 +1,52 @@
using System.Collections;
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
[Proxy(
typeof(ModelCurveArray),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "GetEnumerator", "Item", "get_Item", "set_Item" }
)]
public partial interface IRevitModelCurveArrayProxy : IRevitModelCurveArray { }
public partial class ModelCurveArrayProxy
{
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
public int Count => Size;
public IEnumerator<IRevitModelCurve> GetEnumerator() =>
new RevitModelCurveCollectionIterator(_Instance.ForwardIterator());
private readonly struct RevitModelCurveCollectionIterator : IEnumerator<IRevitModelCurve>
{
private readonly ModelCurveArrayIterator _curveArrayIterator;
public RevitModelCurveCollectionIterator(ModelCurveArrayIterator curveArrayIterator)
{
_curveArrayIterator = curveArrayIterator;
}
public void Dispose() => _curveArrayIterator.Dispose();
public bool MoveNext() => _curveArrayIterator.MoveNext();
public void Reset() => _curveArrayIterator.Reset();
object IEnumerator.Current => Current;
public IRevitModelCurve Current => new ModelCurveProxy((ModelCurve)_curveArrayIterator.Current);
}
public IRevitModelCurve this[int index]
{
get
{
var obj = _Instance.get_Item(index);
return Mapster.TypeAdapter.Adapt<IRevitModelCurve>(obj);
}
}
}
@@ -0,0 +1,33 @@
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
[Proxy(typeof(ModelCurve), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitModelCurveProxy : IRevitModelCurve { }
[Proxy(typeof(CurveElement), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitCurveElementProxy : IRevitCurveElement { }
[Proxy(typeof(Curve), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitCurveProxy : IRevitCurve { }
[Proxy(typeof(XYZ), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitXYZProxy : IRevitXYZ { }
[Proxy(
typeof(LocationCurve),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface,
new[] { "JoinType", "ElementsAtJoin" }
)]
public partial interface IRevitLocationCurveProxy : IRevitLocationCurve { }
[Proxy(typeof(Location), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitLocationProxy : IRevitLocation { }
[Proxy(
typeof(LocationPoint),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitLocationPointProxy : IRevitLocationPoint { }
+14
View File
@@ -0,0 +1,14 @@
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
[Proxy(typeof(Units), ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface)]
public partial interface IRevitUnitsProxy : IRevitUnits { }
[Proxy(
typeof(FormatOptions),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitFormatOptionsProxy : IRevitFormatOptions { }
+70
View File
@@ -0,0 +1,70 @@
using Autodesk.Revit.DB;
using Speckle.ProxyGenerator;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
public class RevitFilterFactory : IRevitFilterFactory
{
public IRevitElementIsElementTypeFilter CreateElementIsElementTypeFilter(bool inverted) =>
new ElementIsElementTypeFilterProxy(new ElementIsElementTypeFilter());
public IRevitLogicalAndFilterFilter CreateLogicalAndFilter(params IRevitElementFilter[] filters) =>
new LogicalAndFilterProxy(
new LogicalAndFilter(filters.Cast<IRevitElementFilterProxy>().Select(x => x._Instance).ToList())
);
public IRevitElementMulticategoryFilter CreateElementMulticategoryFilter(
ICollection<RevitBuiltInCategory> categories,
bool inverted
) =>
new ElementMulticategoryFilterProxy(
new ElementMulticategoryFilter(categories.Select(x => (BuiltInCategory)x).ToArray(), inverted)
);
public IRevitFilteredElementCollector CreateFilteredElementCollector(
IRevitDocument document,
params IRevitElementId[] elementIds
) =>
new FilteredElementCollectorProxy(
new FilteredElementCollector(
((IRevitDocumentProxy)document)._Instance,
elementIds.Cast<IRevitElementIdProxy>().Select(x => x._Instance).ToList()
)
);
}
[Proxy(
typeof(ElementFilter),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitElementFilterProxy : IRevitElementFilter { }
[Proxy(
typeof(ElementIsElementTypeFilter),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitElementIsElementTypeFilterProxy : IRevitElementIsElementTypeFilter { }
[Proxy(
typeof(ElementMulticategoryFilter),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitElementMulticategoryFilterProxy : IRevitElementMulticategoryFilter { }
[Proxy(
typeof(LogicalAndFilter),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitLogicalAndFilterProxy : IRevitLogicalAndFilterFilter { }
[Proxy(
typeof(FilteredElementCollector),
ImplementationOptions.UseExtendedInterfaces | ImplementationOptions.ProxyForBaseInterface
)]
public partial interface IRevitFilteredElementCollectorProxy : IRevitFilteredElementCollector { }
public partial class FilteredElementCollectorProxy
{
public IEnumerable<T> OfClass<T>() => _Instance.OfClass(typeof(T)).Cast<T>();
}
+15
View File
@@ -0,0 +1,15 @@
using Autodesk.Revit.DB;
using Speckle.Revit2023.Interfaces;
namespace Speckle.Revit2023.Api;
public class RevitUnitUtils : IRevitUnitUtils
{
public double ConvertFromInternalUnits(double value, IRevitForgeTypeId forgeTypeId) =>
UnitUtils.ConvertFromInternalUnits(value, ((IRevitForgeTypeIdProxy)forgeTypeId)._Instance);
}
public static class RevitSpecTypeId
{
public static IRevitForgeTypeId Length => new ForgeTypeIdProxy(SpecTypeId.Length);
}
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>9655be78-8070-4b9f-b0dc-68bb6150b52d</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Speckle.Revit.Api</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)**\*.cs" />
</ItemGroup>
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED7}</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="Speckle.Revit.Api.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
+35
View File
@@ -0,0 +1,35 @@
namespace Speckle.Revit2023.Interfaces;
public static class Extensions
{
public static IList<IRevitElementId> GetHostedElementIds(
this IRevitElement host,
IRevitFilterFactory revitFilterFactory
)
{
IList<IRevitElementId> ids;
if (host is IRevitHostObject hostObject)
{
ids = hostObject.FindInserts(true, false, false, false);
}
else
{
var typeFilter = revitFilterFactory.CreateElementIsElementTypeFilter(true);
var categoryFilter = revitFilterFactory.CreateElementMulticategoryFilter(
new List<RevitBuiltInCategory>()
{
RevitBuiltInCategory.OST_CLines,
RevitBuiltInCategory.OST_SketchLines,
RevitBuiltInCategory.OST_WeakDims
},
true
);
ids = host.GetDependentElements(revitFilterFactory.CreateLogicalAndFilter(typeFilter, categoryFilter));
}
// dont include host elementId
ids.Remove(host.Id);
return ids;
}
}
@@ -0,0 +1,12 @@
#pragma warning disable CA1040
namespace Speckle.Revit2023.Interfaces;
public interface IRevitDocument
{
string PathName { get; }
bool IsFamilyDocument { get; }
IRevitUnits GetUnits();
IRevitElement GetElement(IRevitElementId elementId);
}
@@ -0,0 +1,16 @@
namespace Speckle.Revit2023.Interfaces;
#pragma warning disable CA1040
public interface IRevitFilterFactory
{
IRevitElementIsElementTypeFilter CreateElementIsElementTypeFilter(bool inverted);
IRevitElementMulticategoryFilter CreateElementMulticategoryFilter(
ICollection<RevitBuiltInCategory> categories,
bool inverted
);
IRevitLogicalAndFilterFilter CreateLogicalAndFilter(params IRevitElementFilter[] filters);
IRevitFilteredElementCollector CreateFilteredElementCollector(
IRevitDocument document,
params IRevitElementId[] elementIds
);
}
@@ -0,0 +1,3 @@
namespace Speckle.Revit2023.Interfaces;
public interface IRevitModelCurve : IRevitCurveElement { }
@@ -0,0 +1,6 @@
using System.Diagnostics.CodeAnalysis;
namespace Speckle.Revit2023.Interfaces;
[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix")]
public interface IRevitModelCurveArray : IReadOnlyList<IRevitModelCurve> { }
+11
View File
@@ -0,0 +1,11 @@
#pragma warning disable CA1040
namespace Speckle.Revit2023.Interfaces;
public interface IRevitUnits
{
IRevitFormatOptions GetFormatOptions(IRevitForgeTypeId length);
}
#pragma warning restore CA1040
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>9655be78-8070-4b9f-b0dc-68bb6150b52e</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Speckle.Revit.Interfaces</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)**\*.cs" />
</ItemGroup>
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{E1C43415-3200-45F4-8BF9-A4DD7D7F2ED6}</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="Speckle.Revit.Interfaces.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<Import Project="..\Speckle.Revit.Api\Speckle.Revit.Api.projitems" Label="Shared" />
<ItemGroup>
<PackageReference Include="Speckle.ProxyGenerator" />
<PackageReference Include="Speckle.Revit.API" />
<PackageReference Include="Mapster" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Speckle.Revit2023.Interfaces\Speckle.Revit2023.Interfaces.csproj" />
</ItemGroup>
</Project>
+48
View File
@@ -0,0 +1,48 @@
{
"version": 2,
"dependencies": {
".NETFramework,Version=v4.8": {
"Mapster": {
"type": "Direct",
"requested": "[7.3.0, )",
"resolved": "7.3.0",
"contentHash": "NrCUX/rJa5PTyo6iW4AL5dZLU9PDNlYnrJOVjgdpo5OQM9EtWH2CMHnC5sSuJWC0d0b0SnmeRrIviEem6WxtuQ==",
"dependencies": {
"Mapster.Core": "1.2.0",
"Microsoft.CSharp": "4.3.0",
"System.Reflection.Emit": "4.3.0"
}
},
"Speckle.ProxyGenerator": {
"type": "Direct",
"requested": "[0.1.6, )",
"resolved": "0.1.6",
"contentHash": "SO9Udllol9Krpq+UFBr54Es79kmiIQmtSRXKFcvplnisdwmjo5CBlucuuvgZYmQUSvF/9KC4BcuVllZRTCBDHQ=="
},
"Speckle.Revit.API": {
"type": "Direct",
"requested": "[2023.0.0, )",
"resolved": "2023.0.0",
"contentHash": "tq40eD7psgTbV+epNouYyqfo6+hEi7FmXZqcxEOsAV7zfYyWhL6Rt3vmojkWGNuerGbH6oRI6KIIxrnlCNb8Hw=="
},
"Mapster.Core": {
"type": "Transitive",
"resolved": "1.2.0",
"contentHash": "TNdqZk2zAuBYfJF88D/3clQTOyOdqr1crU81yZQtlGa+e7FYWhJdK/buBWT+TpM3qQko9UzmzfOT4iq3JCs/ZA=="
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "P+MBhIM0YX+JqROuf7i306ZLJEjQYA9uUyRDE+OqwUI5sh41e2ZbPQV3LfAPh+29cmceE1pUffXsGfR4eMY3KA=="
},
"System.Reflection.Emit": {
"type": "Transitive",
"resolved": "4.3.0",
"contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg=="
},
"speckle.revit2023.interfaces": {
"type": "Project"
}
}
}
}
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="..\Speckle.Revit.Interfaces\Speckle.Revit.Interfaces.projitems" Label="Shared" />
</Project>
@@ -0,0 +1,21 @@
{
"version": 2,
"dependencies": {
".NETStandard,Version=v2.0": {
"NETStandard.Library": {
"type": "Direct",
"requested": "[2.0.3, )",
"resolved": "2.0.3",
"contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
"resolved": "1.1.0",
"contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestMinor"
}
}