Adam/cxpla 6 kill remaining kit code in core (#59)
* compiles with relevant deletions * Test fixes * fix type loading * type load for tests * speckle objects renamespace * rename Core to Sdk * Fix test references * tests renaming * rename logging * fmt * start of adding an attribute to all base types * convert all types and do basic test * Fix most tests * fix more tests * fmt * Build fix * add changes and more tests * Fix tests * Fix integration tests
This commit is contained in:
+5
-19
@@ -1,10 +1,8 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core", "src\Speckle.Core\Speckle.Core.csproj", "{A413E196-3696-4F48-B635-04B5F76BF9C9}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk", "src\Speckle.Sdk\Speckle.Sdk.csproj", "{A413E196-3696-4F48-B635-04B5F76BF9C9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Tests.Unit", "tests\Speckle.Core.Tests.Unit\Speckle.Core.Tests.Unit.csproj", "{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Transports.Disk", "src\Speckle.Transports.Disk\Speckle.Transports.Disk.csproj", "{6845F190-036C-4AEF-B267-23EE84DBD2A6}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Tests.Unit", "tests\Speckle.Sdk.Tests.Unit\Speckle.Sdk.Tests.Unit.csproj", "{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Objects", "src\Speckle.Objects\Speckle.Objects.csproj", "{181F50AA-DD2A-4541-98EF-B868E2D06B9A}"
|
||||
EndProject
|
||||
@@ -30,11 +28,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{58D37DA9
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build", "build\build.csproj", "{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Transports.MongoDB", "src\Speckle.Transports.MongoDB\Speckle.Transports.MongoDB.csproj", "{68078752-7C54-471A-9CB6-E8AEF34A9EFF}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Serialization.Tests", "tests\Speckle.Sdk.Serialization.Tests\Speckle.Sdk.Serialization.Tests.csproj", "{AA1E1E51-49AE-4F71-84B1-938E19695BE0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Serialization.Tests", "tests\Speckle.Core.Serialization.Tests\Speckle.Core.Serialization.Tests.csproj", "{AA1E1E51-49AE-4F71-84B1-938E19695BE0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Core.Tests.Integration", "tests\Speckle.Core.Tests.Integration\Speckle.Core.Tests.Integration.csproj", "{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Tests.Integration", "tests\Speckle.Sdk.Tests.Integration\Speckle.Sdk.Tests.Integration.csproj", "{4FB41A6D-D139-4111-8115-E3F9F6BEAF24}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B623BD21-5CAA-43F9-A539-1835276C220E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@@ -42,7 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
|
||||
.github\workflows\ci.yml = .github\workflows\ci.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Logging", "src\Speckle.Logging\Speckle.Logging.csproj", "{156313B4-B588-4363-A0ED-5AB3A55AA4E8}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Sdk.Logging", "src\Speckle.Sdk.Logging\Speckle.Sdk.Logging.csproj", "{156313B4-B588-4363-A0ED-5AB3A55AA4E8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -62,10 +58,6 @@ Global
|
||||
{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6845F190-036C-4AEF-B267-23EE84DBD2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6845F190-036C-4AEF-B267-23EE84DBD2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6845F190-036C-4AEF-B267-23EE84DBD2A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6845F190-036C-4AEF-B267-23EE84DBD2A6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{181F50AA-DD2A-4541-98EF-B868E2D06B9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{181F50AA-DD2A-4541-98EF-B868E2D06B9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{181F50AA-DD2A-4541-98EF-B868E2D06B9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -78,10 +70,6 @@ Global
|
||||
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{68078752-7C54-471A-9CB6-E8AEF34A9EFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{68078752-7C54-471A-9CB6-E8AEF34A9EFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68078752-7C54-471A-9CB6-E8AEF34A9EFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68078752-7C54-471A-9CB6-E8AEF34A9EFF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA1E1E51-49AE-4F71-84B1-938E19695BE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@@ -97,12 +85,10 @@ Global
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A413E196-3696-4F48-B635-04B5F76BF9C9} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
|
||||
{6845F190-036C-4AEF-B267-23EE84DBD2A6} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
|
||||
{181F50AA-DD2A-4541-98EF-B868E2D06B9A} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
|
||||
{99AE2273-12C5-4A9D-9FDD-19F8B394B5E2} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
|
||||
{A0338FC0-3011-498F-AD09-01230FABD3ED} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
|
||||
{9B8DDEB5-37C7-49B5-984D-C65DE5FCB7B7} = {58D37DA9-F948-48CA-9A73-F5BBBD533DBF}
|
||||
{68078752-7C54-471A-9CB6-E8AEF34A9EFF} = {5CB96C27-FC5B-4A41-86B6-951AF99B8116}
|
||||
{AA1E1E51-49AE-4F71-84B1-938E19695BE0} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
|
||||
{4FB41A6D-D139-4111-8115-E3F9F6BEAF24} = {35047EE7-AD1D-4741-80A7-8F0E874718E9}
|
||||
{B623BD21-5CAA-43F9-A539-1835276C220E} = {DA2AED52-58F9-471E-8AD8-102FD36129E3}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Speckle.Core.Serialisation;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Speckle.Core.Api;
|
||||
|
||||
/// <summary>
|
||||
/// Exposes several key methods for interacting with Speckle.Core.
|
||||
/// <para>Serialize/Deserialize</para>
|
||||
/// <para>Push/Pull (methods to serialize and send data to one or more servers)</para>
|
||||
/// </summary>
|
||||
public static partial class Operations
|
||||
{
|
||||
/// <summary>
|
||||
/// Convenience method to instantiate an instance of the default object serializer and settings pre-populated with it.
|
||||
/// </summary>
|
||||
[Obsolete("V1 Serializer is deprecated. Use " + nameof(BaseObjectSerializerV2))]
|
||||
public static (BaseObjectSerializer, JsonSerializerSettings) GetSerializerInstance()
|
||||
{
|
||||
var serializer = new BaseObjectSerializer();
|
||||
var settings = new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
Formatting = Formatting.None,
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
||||
Converters = new List<JsonConverter> { serializer }
|
||||
};
|
||||
|
||||
return (serializer, settings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Factory for progress actions used internally inside send and receive methods.
|
||||
/// </summary>
|
||||
/// <param name="onProgressAction"></param>
|
||||
/// <returns></returns>
|
||||
private static Action<string, int>? GetInternalProgressAction(
|
||||
Action<ConcurrentDictionary<string, int>>? onProgressAction
|
||||
)
|
||||
{
|
||||
if (onProgressAction is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var localProgressDict = new ConcurrentDictionary<string, int>();
|
||||
|
||||
return (name, processed) =>
|
||||
{
|
||||
if (!localProgressDict.TryAdd(name, processed))
|
||||
{
|
||||
localProgressDict[name] += processed;
|
||||
}
|
||||
|
||||
onProgressAction.Invoke(localProgressDict);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Speckle.Core.Kits.ConverterInterfaces;
|
||||
|
||||
public interface IFinalizable
|
||||
{
|
||||
void FinalizeConversion();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Speckle.Core.Kits;
|
||||
namespace Speckle.Sdk.Host;
|
||||
|
||||
/// <summary>
|
||||
/// List of Host Applications - their slugs should match our ghost tags and ci/cd slugs
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
#nullable disable
|
||||
using Speckle.Core.Models;
|
||||
|
||||
namespace Speckle.Core.Kits;
|
||||
|
||||
public interface ISpeckleConverter
|
||||
{
|
||||
string Description { get; }
|
||||
string Name { get; }
|
||||
string Author { get; }
|
||||
string WebsiteOrEmail { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of the conversion process
|
||||
/// </summary>
|
||||
public ProgressReport Report { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Decides what to do when an element being received already exists
|
||||
/// </summary>
|
||||
public ReceiveMode ReceiveMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Converts a native object to a Speckle one
|
||||
/// </summary>
|
||||
/// <param name="value">Native object to convert</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception"></exception>
|
||||
public Base ConvertToSpeckle(object value);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of objects to Speckle.
|
||||
/// </summary>
|
||||
/// <param name="values"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception"></exception>
|
||||
public List<Base> ConvertToSpeckle(List<object> values);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if it can convert a native object to a Speckle one
|
||||
/// </summary>
|
||||
/// <param name="value">Native object to convert</param>
|
||||
/// <returns></returns>
|
||||
public bool CanConvertToSpeckle(object value);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Speckle object to a native one
|
||||
/// </summary>
|
||||
/// <param name="value">Speckle object to convert</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception"></exception>
|
||||
public object ConvertToNative(Base value);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of Speckle objects to a native ones.
|
||||
/// </summary>
|
||||
/// <param name="values"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception"></exception>
|
||||
public List<object> ConvertToNative(List<Base> values);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a given speckle objects as a generic native object.
|
||||
/// This should assume <see cref="CanConvertToNativeDisplayable"/> has been called and returned True,
|
||||
/// or call it within this method's implementation to ensure non-displayable objects are gracefully handled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method should not try to convert an object to it's native representation (i.e Speckle Wall -> Wall),
|
||||
/// but rather use the 'displayValue' of that wall to create a geometrically correct representation of that object
|
||||
/// in the native application.
|
||||
/// An object may be able to be converted both with <see cref="ConvertToNative(Speckle.Core.Models.Base)"/> and <see cref="ConvertToNativeDisplayable"/>.
|
||||
/// In this case, deciding which to use is dependent on each connector developer.
|
||||
/// Preferably, <see cref="ConvertToNativeDisplayable"/> should be used as a fallback to the <see cref="ConvertToNative(Speckle.Core.Models.Base)"/> logic.
|
||||
/// </remarks>
|
||||
/// <param name="value">Speckle object to convert</param>
|
||||
/// <returns>The native object that resulted after converting the input <paramref name="value"/></returns>
|
||||
public object ConvertToNativeDisplayable(Base value);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if it can convert a Speckle object to a native one
|
||||
/// </summary>
|
||||
/// <param name="value">Speckle object to convert</param>
|
||||
/// <returns></returns>
|
||||
public bool CanConvertToNative(Base value);
|
||||
|
||||
/// <summary>
|
||||
/// Checks to verify if a given object is: 1) displayable and 2) can be supported for conversion to the native application.
|
||||
/// An object is considered "displayable" if it has a 'displayValue' property (defined in its class or dynamically attached to it, detached or not).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// An object may return "True" for both <see cref="CanConvertToNative"/> and <see cref="CanConvertToNativeDisplayable"/>
|
||||
/// In this case, deciding which to use is dependent on each connector developer.
|
||||
/// Preferably, <see cref="CanConvertToNativeDisplayable"/> should be used as a fallback to the <see cref="CanConvertToNative"/> logic.
|
||||
/// Objects found in the 'displayValue' property are assumed to be universally convertible by all converters and the viewer, but are not guaranteed to be so.
|
||||
/// </remarks>
|
||||
/// <param name="value">Speckle object to convert</param>
|
||||
/// <returns>True if the object is "displayable" and the converter supports native conversion of the given speckle object in particular.</returns>
|
||||
public bool CanConvertToNativeDisplayable(Base value);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of applications serviced by this converter
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<string> GetServicedApplications();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the application document that the converter is targeting
|
||||
/// </summary>
|
||||
/// <param name="doc">The current application document</param>
|
||||
public void SetContextDocument(object doc);
|
||||
|
||||
/// <summary>
|
||||
/// Some converters need to know which other objects are being converted, in order to sort relationships between them (ie, Revit). Use this method to set them.
|
||||
/// </summary>
|
||||
/// <param name="objects"></param>
|
||||
public void SetContextObjects(List<ApplicationObject> objects);
|
||||
|
||||
/// <summary>
|
||||
/// Some converters need to know which objects have been converted before in order to update them (ie, Revit). Use this method to set them.
|
||||
/// </summary>
|
||||
/// <param name="objects"></param>
|
||||
public void SetPreviousContextObjects(List<ApplicationObject> objects);
|
||||
|
||||
/// <summary>
|
||||
/// Some converters need to be able to receive some settings to modify their internal behaviour (i.e. Rhino's Brep Meshing options). Use this method to set them.
|
||||
/// </summary>
|
||||
/// <param name="settings">The object representing the settings for your converter.</param>
|
||||
public void SetConverterSettings(object settings);
|
||||
}
|
||||
|
||||
// NOTE: Do not change the order of the existing ones
|
||||
/// <summary>
|
||||
/// Receive modes indicate what to do and not do when receiving objects
|
||||
/// </summary>
|
||||
public enum ReceiveMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Attemts updating previously received objects by ID, deletes previously received objects that do not exist anymore and creates new ones
|
||||
/// </summary>
|
||||
Update,
|
||||
|
||||
/// <summary>
|
||||
/// Always creates new objects
|
||||
/// </summary>
|
||||
Create,
|
||||
|
||||
/// <summary>
|
||||
/// Ignores updating previously received objects and does not attempt updating or deleting them, creates new objects
|
||||
/// </summary>
|
||||
Ignore
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
namespace Speckle.Core.Kits;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the basic interface for creating a "Speckle Kit"
|
||||
/// </summary>
|
||||
public interface ISpeckleKit
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets all the object types (the object model) provided by this kit.
|
||||
/// </summary>
|
||||
IEnumerable<Type> Types { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets all available converters for this Kit.
|
||||
/// </summary>
|
||||
IEnumerable<string> Converters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets this Kit's description.
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets this Kit's name.
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets this Kit's author.
|
||||
/// </summary>
|
||||
string Author { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the website (or email) to contact the Kit's author.
|
||||
/// </summary>
|
||||
string WebsiteOrEmail { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Tries to load a converter for a specific <paramref name="app"/>.
|
||||
/// </summary>
|
||||
/// <param name="app">The host app string for which a <see cref="ISpeckleConverter"/> is desired. see <see cref="ISpeckleConverter.GetServicedApplications"/></param>
|
||||
/// <returns>The converter for the specific <paramref name="app"/></returns>
|
||||
/// <exception cref="KitException">Thrown if the requested converter failed to load</exception>
|
||||
public ISpeckleConverter LoadConverter(string app);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#nullable disable
|
||||
using Speckle.Core.Models;
|
||||
|
||||
namespace Speckle.Core.Kits;
|
||||
|
||||
/// <summary>
|
||||
/// Needed so we can properly deserialize all the Base-derived objects from Speckle.Core itself.
|
||||
/// </summary>
|
||||
public sealed class CoreKit : ISpeckleKit
|
||||
{
|
||||
public IEnumerable<Type> Types => GetType().Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(Base)));
|
||||
|
||||
public string Description => "Base Speckle models for revisions, streams, etc.";
|
||||
|
||||
public string Name => nameof(CoreKit);
|
||||
|
||||
public string Author => "Dimitrie";
|
||||
|
||||
public string WebsiteOrEmail => "hello@speckle.systems";
|
||||
|
||||
public IEnumerable<string> Converters => new List<string>();
|
||||
|
||||
public ISpeckleConverter LoadConverter(string app)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,336 +0,0 @@
|
||||
using System.Reflection;
|
||||
using Speckle.Core.Helpers;
|
||||
using Speckle.Core.Logging;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Logging;
|
||||
|
||||
namespace Speckle.Core.Kits;
|
||||
|
||||
public static class KitManager
|
||||
{
|
||||
private static string? s_kitsFolder;
|
||||
|
||||
public static readonly AssemblyName SpeckleAssemblyName = typeof(Base).GetTypeInfo().Assembly.GetName();
|
||||
|
||||
private static readonly Dictionary<string, ISpeckleKit> s_speckleKits = new();
|
||||
|
||||
private static List<Type> s_availableTypes = new();
|
||||
|
||||
private static bool s_initialized;
|
||||
|
||||
/// <summary>
|
||||
/// Local installations store kits in C:\Users\USERNAME\AppData\Roaming\Speckle\Kits
|
||||
/// Admin/System-wide installations in C:\ProgramData\Speckle\Kits
|
||||
/// </summary>
|
||||
public static string KitsFolder
|
||||
{
|
||||
get => s_kitsFolder ??= SpecklePathProvider.KitsFolderPath;
|
||||
set => s_kitsFolder = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all the kits found on this user's device.
|
||||
/// </summary>
|
||||
public static IEnumerable<ISpeckleKit> Kits
|
||||
{
|
||||
get
|
||||
{
|
||||
Initialize();
|
||||
return s_speckleKits.Values.Where(v => v != null); //NOTE: null check here should be unnecessary
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all the types found in all the kits on this user's device.
|
||||
/// </summary>
|
||||
public static IEnumerable<Type> Types
|
||||
{
|
||||
get
|
||||
{
|
||||
Initialize();
|
||||
return s_availableTypes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a specific kit exists.
|
||||
/// </summary>
|
||||
/// <param name="assemblyFullName"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasKit(string assemblyFullName)
|
||||
{
|
||||
Initialize();
|
||||
return s_speckleKits.ContainsKey(assemblyFullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific kit.
|
||||
/// </summary>
|
||||
/// <param name="assemblyFullName"></param>
|
||||
/// <returns></returns>
|
||||
public static ISpeckleKit GetKit(string assemblyFullName)
|
||||
{
|
||||
Initialize();
|
||||
return s_speckleKits[assemblyFullName];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default Speckle provided kit, "Objects".
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static ISpeckleKit GetDefaultKit()
|
||||
{
|
||||
Initialize();
|
||||
return s_speckleKits.First(kvp => kvp.Value.Name == "Objects").Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all the kits with potential converters for the software app.
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<ISpeckleKit> GetKitsWithConvertersForApp(string app)
|
||||
{
|
||||
foreach (var kit in Kits)
|
||||
{
|
||||
if (kit.Converters.Contains(app))
|
||||
{
|
||||
yield return kit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells the kit manager to initialise from a specific location.
|
||||
/// </summary>
|
||||
/// <param name="kitFolderLocation"></param>
|
||||
public static void Initialize(string kitFolderLocation)
|
||||
{
|
||||
if (s_initialized)
|
||||
{
|
||||
SpeckleLog.Logger.Error("{objectType} is already initialised", typeof(KitManager));
|
||||
throw new SpeckleException(
|
||||
"The kit manager has already been initialised. Make sure you call this method earlier in your code!"
|
||||
);
|
||||
}
|
||||
|
||||
KitsFolder = kitFolderLocation;
|
||||
Load();
|
||||
s_initialized = true;
|
||||
}
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static void Initialize()
|
||||
{
|
||||
if (!s_initialized)
|
||||
{
|
||||
Load();
|
||||
s_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
SpeckleLog.Logger.Information("Initializing Kit Manager in {KitsFolder}", SpecklePathProvider.KitsFolderPath);
|
||||
|
||||
GetLoadedSpeckleReferencingAssemblies();
|
||||
LoadSpeckleReferencingAssemblies();
|
||||
|
||||
s_availableTypes = s_speckleKits
|
||||
.Where(kit => kit.Value != null) //Null check should be unnecessary
|
||||
.SelectMany(kit => kit.Value.Types)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
// recursive search for referenced assemblies
|
||||
public static List<Assembly> GetReferencedAssemblies()
|
||||
{
|
||||
var returnAssemblies = new List<Assembly>();
|
||||
var loadedAssemblies = new HashSet<string>();
|
||||
var assembliesToCheck = new Queue<Assembly?>();
|
||||
|
||||
assembliesToCheck.Enqueue(Assembly.GetEntryAssembly());
|
||||
|
||||
while (assembliesToCheck.Count > 0)
|
||||
{
|
||||
var assemblyToCheck = assembliesToCheck.Dequeue();
|
||||
|
||||
if (assemblyToCheck == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var reference in assemblyToCheck.GetReferencedAssemblies())
|
||||
{
|
||||
// filtering out system dlls
|
||||
if (reference.FullName.StartsWith("System."))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (reference.FullName.StartsWith("Microsoft."))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (loadedAssemblies.Contains(reference.FullName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Assembly assembly;
|
||||
try
|
||||
{
|
||||
assembly = Assembly.Load(reference);
|
||||
}
|
||||
catch (SystemException ex) when (ex is IOException or BadImageFormatException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assembliesToCheck.Enqueue(assembly);
|
||||
loadedAssemblies.Add(reference.FullName);
|
||||
returnAssemblies.Add(assembly);
|
||||
}
|
||||
}
|
||||
|
||||
return returnAssemblies;
|
||||
}
|
||||
|
||||
private static void GetLoadedSpeckleReferencingAssemblies()
|
||||
{
|
||||
List<Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
||||
assemblies.AddRange(GetReferencedAssemblies());
|
||||
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
if (assembly.IsDynamic || assembly.ReflectionOnly)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!assembly.IsReferencing(SpeckleAssemblyName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s_speckleKits.ContainsKey(assembly.FullName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var kitClass = GetKitClass(assembly);
|
||||
if (kitClass == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Activator.CreateInstance(kitClass) is ISpeckleKit speckleKit)
|
||||
{
|
||||
s_speckleKits.Add(assembly.FullName, speckleKit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadSpeckleReferencingAssemblies()
|
||||
{
|
||||
if (!Directory.Exists(KitsFolder))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var directories = Directory.GetDirectories(KitsFolder);
|
||||
|
||||
foreach (var directory in directories)
|
||||
{
|
||||
foreach (var assemblyPath in Directory.EnumerateFiles(directory, "*.dll"))
|
||||
{
|
||||
var unloadedAssemblyName = SafeGetAssemblyName(assemblyPath);
|
||||
|
||||
if (unloadedAssemblyName == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.LoadFrom(assemblyPath);
|
||||
var kitClass = GetKitClass(assembly);
|
||||
if (assembly.IsReferencing(SpeckleAssemblyName) && kitClass != null)
|
||||
{
|
||||
if (!s_speckleKits.ContainsKey(assembly.FullName))
|
||||
{
|
||||
if (Activator.CreateInstance(kitClass) is ISpeckleKit speckleKit)
|
||||
{
|
||||
s_speckleKits.Add(assembly.FullName, speckleKit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileLoadException) { }
|
||||
catch (BadImageFormatException) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Type? GetKitClass(Assembly assembly)
|
||||
{
|
||||
try
|
||||
{
|
||||
var kitClass = assembly
|
||||
.GetTypes()
|
||||
.FirstOrDefault(type =>
|
||||
{
|
||||
return type.GetInterfaces().Any(iface => iface.Name == nameof(ISpeckleKit));
|
||||
});
|
||||
|
||||
return kitClass;
|
||||
}
|
||||
catch (ReflectionTypeLoadException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static AssemblyName? SafeGetAssemblyName(string? assemblyPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
return AssemblyName.GetAssemblyName(assemblyPath);
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException or IOException or BadImageFormatException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal static class AssemblyExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates if a given assembly references another which is identified by its name.
|
||||
/// </summary>
|
||||
/// <param name="assembly">The assembly which will be probed.</param>
|
||||
/// <param name="referenceName">The reference assembly name.</param>
|
||||
/// <returns>A boolean value indicating if there is a reference.</returns>
|
||||
public static bool IsReferencing(this Assembly assembly, AssemblyName referenceName)
|
||||
{
|
||||
if (AssemblyName.ReferenceMatchesDefinition(assembly.GetName(), referenceName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var referencedAssemblyName in assembly.GetReferencedAssemblies())
|
||||
{
|
||||
if (AssemblyName.ReferenceMatchesDefinition(referencedAssemblyName, referenceName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.Contracts;
|
||||
using Speckle.Core.Kits;
|
||||
|
||||
namespace Speckle.Core.Models.GraphTraversal;
|
||||
|
||||
[SuppressMessage(
|
||||
"Naming",
|
||||
"CA1708:Identifiers should differ by more than case",
|
||||
Justification = "Class contains obsolete members that are kept for backwards compatiblity"
|
||||
)]
|
||||
public static class DefaultTraversal
|
||||
{
|
||||
public static GraphTraversal CreateTraversalFunc()
|
||||
{
|
||||
var convertableRule = TraversalRule
|
||||
.NewTraversalRule()
|
||||
.When(b => b.GetType() != typeof(Base))
|
||||
.When(HasDisplayValue)
|
||||
.ContinueTraversing(_ => ElementsPropAliases);
|
||||
|
||||
return new GraphTraversal(convertableRule, s_ignoreResultsRule, DefaultRule.ShouldReturnToOutput(false));
|
||||
}
|
||||
|
||||
//These functions are just meant to make the syntax of defining rules less verbose, they are likely to change frequently/be restructured
|
||||
#region Helper Functions
|
||||
|
||||
//WORKAROUND: ideally, traversal rules would not have Objects specific rules.
|
||||
private static readonly ITraversalRule s_ignoreResultsRule = TraversalRule
|
||||
.NewTraversalRule()
|
||||
.When(o => o.speckle_type.Contains("Objects.Structural.Results"))
|
||||
.ContinueTraversing(None);
|
||||
|
||||
public static ITraversalBuilderReturn DefaultRule =>
|
||||
TraversalRule.NewTraversalRule().When(_ => true).ContinueTraversing(Members());
|
||||
|
||||
public static readonly IReadOnlyList<string> ElementsPropAliases = new[] { "elements", "@elements" };
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> ElementsAliases(Base _)
|
||||
{
|
||||
return ElementsPropAliases;
|
||||
}
|
||||
|
||||
public static bool HasElements(Base x)
|
||||
{
|
||||
return ElementsPropAliases.Any(m => x[m] != null);
|
||||
}
|
||||
|
||||
public static readonly IReadOnlyList<string> DefinitionPropAliases = new[] { "definition", "@definition" };
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> DefinitionAliases(Base _)
|
||||
{
|
||||
return DefinitionPropAliases;
|
||||
}
|
||||
|
||||
public static bool HasDefinition(Base x)
|
||||
{
|
||||
return DefinitionPropAliases.Any(m => x[m] != null);
|
||||
}
|
||||
|
||||
public static readonly IReadOnlyList<string> DisplayValuePropAliases = new[] { "displayValue", "@displayValue" };
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> DisplayValueAliases(Base _)
|
||||
{
|
||||
return DisplayValuePropAliases;
|
||||
}
|
||||
|
||||
public static bool HasDisplayValue(Base x)
|
||||
{
|
||||
return DisplayValuePropAliases.Any(m => x[m] != null);
|
||||
}
|
||||
|
||||
public static readonly IReadOnlyList<string> GeometryPropAliases = new[] { "geometry", "@geometry" };
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> GeometryAliases(Base _)
|
||||
{
|
||||
return GeometryPropAliases;
|
||||
}
|
||||
|
||||
public static bool HasGeometry(Base x)
|
||||
{
|
||||
return GeometryPropAliases.Any(m => x[m] != null);
|
||||
}
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> None(Base _)
|
||||
{
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
internal static SelectMembers Members(DynamicBaseMemberType includeMembers = DynamicBase.DEFAULT_INCLUDE_MEMBERS)
|
||||
{
|
||||
return x => x.GetMembers(includeMembers).Keys;
|
||||
}
|
||||
|
||||
public static readonly string[] DisplayValueAndElementsPropAliases = DisplayValuePropAliases
|
||||
.Concat(ElementsPropAliases)
|
||||
.ToArray();
|
||||
|
||||
[Pure]
|
||||
public static IEnumerable<string> DisplayValueAndElementsAliases(Base _)
|
||||
{
|
||||
return DisplayValueAndElementsPropAliases;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Legacy function varients
|
||||
|
||||
[Obsolete("Renamed to " + nameof(ElementsPropAliases))]
|
||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Obsolete")]
|
||||
public static IReadOnlyList<string> elementsPropAliases => ElementsPropAliases;
|
||||
|
||||
[Obsolete("Renamed to " + nameof(DisplayValuePropAliases))]
|
||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Obsolete")]
|
||||
public static IReadOnlyList<string> displayValuePropAliases => DisplayValuePropAliases;
|
||||
|
||||
[Obsolete("Renamed to " + nameof(DefinitionPropAliases))]
|
||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Obsolete")]
|
||||
public static IReadOnlyList<string> definitionPropAliases => DefinitionPropAliases;
|
||||
|
||||
[Obsolete("Renamed to " + nameof(GeometryPropAliases))]
|
||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Obsolete")]
|
||||
public static IReadOnlyList<string> geometryPropAliases => GeometryPropAliases;
|
||||
|
||||
[Obsolete("Renamed to " + nameof(DisplayValueAndElementsPropAliases))]
|
||||
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Obsolete")]
|
||||
[SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "Obsolete")]
|
||||
public static string[] displayValueAndElementsPropAliases => DisplayValueAndElementsPropAliases;
|
||||
|
||||
/// <summary><inheritdoc cref="CreateLegacyTraverseFunc"/></summary>
|
||||
/// <remarks><inheritdoc cref="CreateLegacyTraverseFunc"/></remarks>
|
||||
/// <param name="converter"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete($"Consider using {nameof(CreateTraversalFunc)}")]
|
||||
public static GraphTraversal CreateTraverseFunc(ISpeckleConverter converter)
|
||||
{
|
||||
return CreateLegacyTraverseFunc(converter.CanConvertToNative);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legacy traversal rule that was dependent on the converter
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Treats convertable objects <see cref="ISpeckleConverter.CanConvertToNative"/> and objects with displayValues as "convertable" such that only elements and dynamic props will be traversed
|
||||
/// New code should use <see cref="CreateTraversalFunc"/> instead.
|
||||
/// </remarks>
|
||||
/// <param name="canConvertToNative"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete($"Consider using {nameof(CreateTraversalFunc)}")]
|
||||
public static GraphTraversal CreateLegacyTraverseFunc(Func<Base, bool> canConvertToNative)
|
||||
{
|
||||
var convertableRule = TraversalRule
|
||||
.NewTraversalRule()
|
||||
.When(b => canConvertToNative(b))
|
||||
.When(HasDisplayValue)
|
||||
.ContinueTraversing(_ => ElementsPropAliases);
|
||||
|
||||
return new GraphTraversal(convertableRule, s_ignoreResultsRule, DefaultRule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Traverses until finds a convertable object then HALTS deeper traversal
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The DUI2 Revit connector does traversal,
|
||||
/// so this traversal is a shallow traversal for directly convertable objects,
|
||||
/// and a deep traversal for all other types
|
||||
/// New code should use <see cref="CreateTraversalFunc"/> instead.
|
||||
/// </remarks>
|
||||
/// <param name="converter"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete($"Consider using {nameof(CreateTraversalFunc)}")]
|
||||
public static GraphTraversal CreateRevitTraversalFunc(ISpeckleConverter converter)
|
||||
{
|
||||
var convertableRule = TraversalRule
|
||||
.NewTraversalRule()
|
||||
.When(converter.CanConvertToNative)
|
||||
.When(HasDisplayValue)
|
||||
.ContinueTraversing(None);
|
||||
|
||||
return new GraphTraversal(convertableRule, s_ignoreResultsRule, DefaultRule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Traverses until finds a convertable object (or fallback) then traverses members
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// New code should use <see cref="CreateTraversalFunc"/> instead.
|
||||
/// </remarks>
|
||||
/// <param name="converter"></param>
|
||||
/// <returns></returns>
|
||||
[Obsolete($"Consider using {nameof(CreateTraversalFunc)}")]
|
||||
public static GraphTraversal CreateBIMTraverseFunc(ISpeckleConverter converter)
|
||||
{
|
||||
var bimElementRule = TraversalRule
|
||||
.NewTraversalRule()
|
||||
.When(converter.CanConvertToNative)
|
||||
.ContinueTraversing(ElementsAliases);
|
||||
|
||||
return new GraphTraversal(bimElementRule, s_ignoreResultsRule, DefaultRule);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,716 +0,0 @@
|
||||
#nullable disable
|
||||
using System.Collections;
|
||||
using System.Runtime.Serialization;
|
||||
using Speckle.Core.Helpers;
|
||||
using Speckle.Core.Logging;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Core.Serialisation.SerializationUtilities;
|
||||
using Speckle.Core.Transports;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Newtonsoft.Json.Linq;
|
||||
using Speckle.Newtonsoft.Json.Serialization;
|
||||
using Utilities = Speckle.Core.Models.Utilities;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UseNegatedPatternInIsExpression
|
||||
#pragma warning disable IDE0075, IDE1006, IDE0083, CA1051, CA1502, CA1854
|
||||
|
||||
namespace Speckle.Core.Serialisation;
|
||||
|
||||
/// <summary>
|
||||
/// Json converter that handles base speckle objects. Enables detachment and
|
||||
/// simultaneous transport (persistence) of objects.
|
||||
/// </summary>
|
||||
[Obsolete("Use " + nameof(BaseObjectSerializerV2))]
|
||||
public class BaseObjectSerializer : JsonConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Property that describes the type of the object.
|
||||
/// </summary>
|
||||
public string TypeDiscriminator = "speckle_type";
|
||||
|
||||
public BaseObjectSerializer()
|
||||
{
|
||||
ResetAndInitialize();
|
||||
}
|
||||
|
||||
public CancellationToken CancellationToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The sync transport. This transport will be used synchronously.
|
||||
/// </summary>
|
||||
public ITransport ReadTransport { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of transports to write to.
|
||||
/// </summary>
|
||||
public List<ITransport> WriteTransports { get; set; } = new();
|
||||
|
||||
public override bool CanWrite => true;
|
||||
|
||||
public override bool CanRead => true;
|
||||
|
||||
public Action<string, int> OnProgressAction { get; set; }
|
||||
|
||||
public Action<string, Exception> OnErrorAction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reinitializes the lineage, and other variables that get used during the
|
||||
/// json writing process.
|
||||
/// </summary>
|
||||
public void ResetAndInitialize()
|
||||
{
|
||||
DetachLineage = new List<bool>();
|
||||
Lineage = new List<string>();
|
||||
RefMinDepthTracker = new Dictionary<string, Dictionary<string, int>>();
|
||||
OnProgressAction = null;
|
||||
TotalProcessedCount = 0;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Read Json
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if we passed in an array, rather than an object.
|
||||
// TODO: Test the following branch. It's not used anywhere at the moment, and the default serializer prevents it from
|
||||
// ever being used (only allows single object serialization)
|
||||
if (reader.TokenType == JsonToken.StartArray)
|
||||
{
|
||||
var list = new List<Base>();
|
||||
var jarr = JArray.Load(reader);
|
||||
|
||||
foreach (var val in jarr)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
var whatever = BaseObjectSerializationUtilities.HandleValue(val, serializer, CancellationToken);
|
||||
list.Add(whatever as Base);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
var jObject = JObject.Load(reader);
|
||||
|
||||
if (jObject == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var objType = jObject.GetValue(TypeDiscriminator);
|
||||
|
||||
// Assume dictionary!
|
||||
if (objType == null)
|
||||
{
|
||||
var dict = new Dictionary<string, object>();
|
||||
|
||||
foreach (var val in jObject)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
dict[val.Key] = BaseObjectSerializationUtilities.HandleValue(val.Value, serializer, CancellationToken);
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
var discriminator = objType.Value<string>();
|
||||
|
||||
// Check for references.
|
||||
if (discriminator == "reference")
|
||||
{
|
||||
var id = jObject.GetValue("referencedId").Value<string>();
|
||||
|
||||
string str =
|
||||
ReadTransport != null
|
||||
? ReadTransport.GetObject(id)
|
||||
: throw new SpeckleException("Cannot resolve reference, no transport is defined.");
|
||||
|
||||
if (str != null && !string.IsNullOrEmpty(str))
|
||||
{
|
||||
jObject = JObject.Parse(str);
|
||||
discriminator = jObject.GetValue(TypeDiscriminator).Value<string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new SpeckleException("Cannot resolve reference. The provided transport could not find it.");
|
||||
}
|
||||
}
|
||||
|
||||
var type = BaseObjectSerializationUtilities.GetType(discriminator);
|
||||
var obj = existingValue ?? Activator.CreateInstance(type);
|
||||
|
||||
var contract = (JsonDynamicContract)serializer.ContractResolver.ResolveContract(type);
|
||||
var used = new HashSet<string>();
|
||||
|
||||
// remove unsettable properties
|
||||
jObject.Remove(TypeDiscriminator);
|
||||
jObject.Remove("__closure");
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
foreach (var jProperty in jObject.Properties())
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
if (used.Contains(jProperty.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
used.Add(jProperty.Name);
|
||||
|
||||
// first attempt to find a settable property, otherwise fall back to a dynamic set without type
|
||||
JsonProperty property = contract.Properties.GetClosestMatchProperty(jProperty.Name);
|
||||
|
||||
if (property != null && property.Writable)
|
||||
{
|
||||
if (type == typeof(Abstract) && property.PropertyName == "base")
|
||||
{
|
||||
var propertyValue = BaseObjectSerializationUtilities.HandleAbstractOriginalValue(
|
||||
jProperty.Value,
|
||||
((JValue)jObject.GetValue("assemblyQualifiedName")).Value as string
|
||||
);
|
||||
property.ValueProvider.SetValue(obj, propertyValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
var val = BaseObjectSerializationUtilities.HandleValue(
|
||||
jProperty.Value,
|
||||
serializer,
|
||||
CancellationToken,
|
||||
property
|
||||
);
|
||||
property.ValueProvider.SetValue(obj, val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// dynamic properties
|
||||
CallSiteCache.SetValue(
|
||||
jProperty.Name,
|
||||
obj,
|
||||
BaseObjectSerializationUtilities.HandleValue(jProperty.Value, serializer, CancellationToken)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return null; // Check for cancellation
|
||||
}
|
||||
|
||||
TotalProcessedCount++;
|
||||
OnProgressAction?.Invoke("DS", 1);
|
||||
|
||||
foreach (var callback in contract.OnDeserializedCallbacks)
|
||||
{
|
||||
callback(obj, serializer.Context);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Write Json Helper Properties
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of wether current property pointer is marked for detachment.
|
||||
/// </summary>
|
||||
private List<bool> DetachLineage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Keeps track of the hash chain through the object tree.
|
||||
/// </summary>
|
||||
private List<string> Lineage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of object if and its subsequent closure table (a dictionary of hashes and min depth at which they are found).
|
||||
/// </summary>
|
||||
private Dictionary<string, Dictionary<string, int>> RefMinDepthTracker { get; set; }
|
||||
|
||||
public int TotalProcessedCount;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Write Json
|
||||
|
||||
// Keeps track of the actual tree structure of the objects being serialised.
|
||||
// These tree references will thereafter be stored in the __tree prop.
|
||||
private void TrackReferenceInTree(string refId)
|
||||
{
|
||||
// Help with creating closure table entries.
|
||||
for (int i = 0; i < Lineage.Count; i++)
|
||||
{
|
||||
var parent = Lineage[i];
|
||||
|
||||
if (!RefMinDepthTracker.ContainsKey(parent))
|
||||
{
|
||||
RefMinDepthTracker[parent] = new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
if (!RefMinDepthTracker[parent].ContainsKey(refId))
|
||||
{
|
||||
RefMinDepthTracker[parent][refId] = Lineage.Count - i;
|
||||
}
|
||||
else if (RefMinDepthTracker[parent][refId] > Lineage.Count - i)
|
||||
{
|
||||
RefMinDepthTracker[parent][refId] = Lineage.Count - i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool FirstEntry = true,
|
||||
FirstEntryWasListOrDict;
|
||||
|
||||
// While this function looks complicated, it's actually quite smooth:
|
||||
// The important things to remember is that serialization goes depth first:
|
||||
// The first object to get fully serialised is the first nested one, with
|
||||
// the parent object being last.
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.Formatting = serializer.Formatting;
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Path one: nulls
|
||||
/////////////////////////////////////
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Path two: primitives (string, bool, int, etc)
|
||||
/////////////////////////////////////
|
||||
|
||||
if (value.GetType().IsPrimitive || value is string)
|
||||
{
|
||||
FirstEntry = false;
|
||||
writer.WriteValue(value);
|
||||
//var t = JToken.FromObject(value); // bypasses this converter as we do not pass in the serializer
|
||||
//t.WriteTo(writer);
|
||||
return;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Path three: Bases
|
||||
/////////////////////////////////////
|
||||
|
||||
if (value is Base && !(value is ObjectReference))
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
var obj = value as Base;
|
||||
|
||||
FirstEntry = false;
|
||||
//TotalProcessedCount++;
|
||||
|
||||
// Append to lineage tracker
|
||||
Lineage.Add(Guid.NewGuid().ToString());
|
||||
|
||||
var jo = new JObject();
|
||||
var propertyNames = obj.GetDynamicMemberNames();
|
||||
|
||||
var contract = (JsonDynamicContract)serializer.ContractResolver.ResolveContract(value.GetType());
|
||||
|
||||
// Iterate through the object's properties, one by one, checking for ignored ones
|
||||
foreach (var prop in propertyNames)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
// Ignore properties starting with a double underscore.
|
||||
if (prop.StartsWith("__"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prop == "id")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var property = contract.Properties.GetClosestMatchProperty(prop);
|
||||
|
||||
// Ignore properties decorated with [JsonIgnore].
|
||||
if (property != null && property.Ignored)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore nulls
|
||||
object propValue = obj[prop];
|
||||
if (propValue == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if this property is marked for detachment: either by the presence of "@" at the beginning of the name, or by the presence of a DetachProperty attribute on a typed property.
|
||||
if (property != null)
|
||||
{
|
||||
var detachableAttributes = property.AttributeProvider.GetAttributes(typeof(DetachProperty), true);
|
||||
if (detachableAttributes.Count > 0)
|
||||
{
|
||||
DetachLineage.Add(((DetachProperty)detachableAttributes[0]).Detachable);
|
||||
}
|
||||
else
|
||||
{
|
||||
DetachLineage.Add(false);
|
||||
}
|
||||
|
||||
var chunkableAttributes = property.AttributeProvider.GetAttributes(typeof(Chunkable), true);
|
||||
if (chunkableAttributes.Count > 0)
|
||||
{
|
||||
//DetachLineage.Add(true); // NOOPE
|
||||
serializer.Context = new StreamingContext(StreamingContextStates.Other, chunkableAttributes[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//DetachLineage.Add(false);
|
||||
serializer.Context = new StreamingContext();
|
||||
}
|
||||
}
|
||||
else if (prop.StartsWith("@")) // Convention check for dynamically added properties.
|
||||
{
|
||||
DetachLineage.Add(true);
|
||||
|
||||
var chunkSyntax = Constants.ChunkPropertyNameRegex;
|
||||
|
||||
if (chunkSyntax.IsMatch(prop))
|
||||
{
|
||||
var match = chunkSyntax.Match(prop);
|
||||
_ = int.TryParse(match.Groups[match.Groups.Count - 1].Value, out int chunkSize);
|
||||
serializer.Context = new StreamingContext(
|
||||
StreamingContextStates.Other,
|
||||
chunkSize > 0 ? new Chunkable(chunkSize) : new Chunkable()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
serializer.Context = new StreamingContext();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DetachLineage.Add(false);
|
||||
}
|
||||
|
||||
// Set and store a reference, if it is marked as detachable and the transport is not null.
|
||||
if (
|
||||
WriteTransports != null
|
||||
&& WriteTransports.Count != 0
|
||||
&& propValue is Base
|
||||
&& DetachLineage[DetachLineage.Count - 1]
|
||||
)
|
||||
{
|
||||
var what = JToken.FromObject(propValue, serializer); // Trigger next.
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
if (what == null)
|
||||
{
|
||||
return; // HACK: Prevent nulls from borking our serialization on nested schema object refs. (i.e. Line has @SchemaObject, that has ref to line)
|
||||
}
|
||||
|
||||
var refHash = ((JObject)what).GetValue("id").ToString();
|
||||
|
||||
var reference = new ObjectReference { referencedId = refHash };
|
||||
TrackReferenceInTree(refHash);
|
||||
jo.Add(prop, JToken.FromObject(reference));
|
||||
}
|
||||
else
|
||||
{
|
||||
jo.Add(prop, JToken.FromObject(propValue, serializer)); // Default route
|
||||
}
|
||||
|
||||
// Pop detach lineage. If you don't get this, remember this thing moves ONLY FORWARD, DEPTH FIRST
|
||||
DetachLineage.RemoveAt(DetachLineage.Count - 1);
|
||||
// Refresh the streaming context to remove chunking flag
|
||||
serializer.Context = new StreamingContext();
|
||||
}
|
||||
|
||||
// Check if we actually have any transports present that would warrant a
|
||||
if (
|
||||
WriteTransports != null
|
||||
&& WriteTransports.Count != 0
|
||||
&& RefMinDepthTracker.ContainsKey(Lineage[Lineage.Count - 1])
|
||||
)
|
||||
{
|
||||
jo.Add("__closure", JToken.FromObject(RefMinDepthTracker[Lineage[Lineage.Count - 1]]));
|
||||
}
|
||||
|
||||
var hash = Utilities.HashString(jo.ToString());
|
||||
if (!jo.ContainsKey("id"))
|
||||
{
|
||||
jo.Add("id", JToken.FromObject(hash));
|
||||
}
|
||||
|
||||
jo.WriteTo(writer);
|
||||
|
||||
if (
|
||||
(DetachLineage.Count == 0 || DetachLineage[DetachLineage.Count - 1])
|
||||
&& WriteTransports != null
|
||||
&& WriteTransports.Count != 0
|
||||
)
|
||||
{
|
||||
var objString = jo.ToString(writer.Formatting);
|
||||
var objId = jo["id"].Value<string>();
|
||||
|
||||
OnProgressAction?.Invoke("S", 1);
|
||||
|
||||
foreach (var transport in WriteTransports)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
continue; // Check for cancellation
|
||||
}
|
||||
|
||||
transport.SaveObject(objId, objString);
|
||||
}
|
||||
}
|
||||
|
||||
// Pop lineage tracker
|
||||
Lineage.RemoveAt(Lineage.Count - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Path four: lists/arrays & dicts
|
||||
/////////////////////////////////////
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
var type = value.GetType();
|
||||
|
||||
// TODO: List handling and dictionary serialisation handling can be sped up significantly if we first check by their inner type.
|
||||
// This handles a broader case in which we are, essentially, checking only for object[] or List<object> / Dictionary<string, object> cases.
|
||||
// A much faster approach is to check for List<primitive>, where primitive = string, number, etc. and directly serialize it in full.
|
||||
// Same goes for dictionaries.
|
||||
if (
|
||||
typeof(IEnumerable).IsAssignableFrom(type)
|
||||
&& !typeof(IDictionary).IsAssignableFrom(type)
|
||||
&& type != typeof(string)
|
||||
)
|
||||
{
|
||||
if (TotalProcessedCount == 0 && FirstEntry)
|
||||
{
|
||||
FirstEntry = false;
|
||||
FirstEntryWasListOrDict = true;
|
||||
TotalProcessedCount += 1;
|
||||
DetachLineage.Add(WriteTransports != null && WriteTransports.Count != 0 ? true : false);
|
||||
}
|
||||
|
||||
JArray arr = new();
|
||||
|
||||
// Chunking large lists into manageable parts.
|
||||
if (DetachLineage[DetachLineage.Count - 1] && serializer.Context.Context is Chunkable chunkInfo)
|
||||
{
|
||||
var maxCount = chunkInfo.MaxObjCountPerChunk;
|
||||
var i = 0;
|
||||
var chunkList = new List<DataChunk>();
|
||||
var currChunk = new DataChunk();
|
||||
|
||||
foreach (var arrValue in (IEnumerable)value)
|
||||
{
|
||||
if (i == maxCount)
|
||||
{
|
||||
if (currChunk.data.Count != 0)
|
||||
{
|
||||
chunkList.Add(currChunk);
|
||||
}
|
||||
|
||||
currChunk = new DataChunk();
|
||||
i = 0;
|
||||
}
|
||||
currChunk.data.Add(arrValue);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (currChunk.data.Count != 0)
|
||||
{
|
||||
chunkList.Add(currChunk);
|
||||
}
|
||||
|
||||
value = chunkList;
|
||||
}
|
||||
|
||||
foreach (var arrValue in (IEnumerable)value)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
if (arrValue == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
WriteTransports != null
|
||||
&& WriteTransports.Count != 0
|
||||
&& arrValue is Base
|
||||
&& DetachLineage[DetachLineage.Count - 1]
|
||||
)
|
||||
{
|
||||
var what = JToken.FromObject(arrValue, serializer); // Trigger next
|
||||
|
||||
var refHash = ((JObject)what).GetValue("id").ToString();
|
||||
|
||||
var reference = new ObjectReference { referencedId = refHash };
|
||||
TrackReferenceInTree(refHash);
|
||||
arr.Add(JToken.FromObject(reference));
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.Add(JToken.FromObject(arrValue, serializer)); // Default route
|
||||
}
|
||||
}
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
arr.WriteTo(writer);
|
||||
|
||||
if (DetachLineage.Count == 1 && FirstEntryWasListOrDict) // are we in a list entry point case?
|
||||
{
|
||||
DetachLineage.RemoveAt(0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
if (typeof(IDictionary).IsAssignableFrom(type))
|
||||
{
|
||||
if (TotalProcessedCount == 0 && FirstEntry)
|
||||
{
|
||||
FirstEntry = false;
|
||||
FirstEntryWasListOrDict = true;
|
||||
TotalProcessedCount += 1;
|
||||
DetachLineage.Add(WriteTransports != null && WriteTransports.Count != 0 ? true : false);
|
||||
}
|
||||
var dict = value as IDictionary;
|
||||
var dictJo = new JObject();
|
||||
foreach (DictionaryEntry kvp in dict)
|
||||
{
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
if (kvp.Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
JToken jToken;
|
||||
if (
|
||||
WriteTransports != null
|
||||
&& WriteTransports.Count != 0
|
||||
&& kvp.Value is Base
|
||||
&& DetachLineage[DetachLineage.Count - 1]
|
||||
)
|
||||
{
|
||||
var what = JToken.FromObject(kvp.Value, serializer); // Trigger next
|
||||
var refHash = ((JObject)what).GetValue("id").ToString();
|
||||
|
||||
var reference = new ObjectReference { referencedId = refHash };
|
||||
TrackReferenceInTree(refHash);
|
||||
jToken = JToken.FromObject(reference);
|
||||
}
|
||||
else
|
||||
{
|
||||
jToken = JToken.FromObject(kvp.Value, serializer); // Default route
|
||||
}
|
||||
dictJo.Add(kvp.Key.ToString(), jToken);
|
||||
}
|
||||
dictJo.WriteTo(writer);
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
if (DetachLineage.Count == 1 && FirstEntryWasListOrDict) // are we in a dictionary entry point case?
|
||||
{
|
||||
DetachLineage.RemoveAt(0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Path five: everything else (enums?)
|
||||
/////////////////////////////////////
|
||||
|
||||
if (CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return; // Check for cancellation
|
||||
}
|
||||
|
||||
FirstEntry = false;
|
||||
var lastCall = JToken.FromObject(value); // bypasses this converter as we do not pass in the serializer
|
||||
lastCall.WriteTo(writer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#pragma warning restore IDE0075, IDE1006, IDE0083, CA1051, CA1502, CA1854
|
||||
-366
@@ -1,366 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Logging;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Newtonsoft.Json.Linq;
|
||||
using Speckle.Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Speckle.Core.Serialisation.SerializationUtilities;
|
||||
|
||||
internal static class BaseObjectSerializationUtilities
|
||||
{
|
||||
#region Getting Types
|
||||
|
||||
private static Dictionary<string, Type> s_cachedTypes = new();
|
||||
|
||||
private static readonly Dictionary<string, Dictionary<string, PropertyInfo>> s_typeProperties = new();
|
||||
|
||||
private static readonly Dictionary<string, List<MethodInfo>> s_onDeserializedCallbacks = new();
|
||||
|
||||
internal static Type GetType(string objFullType)
|
||||
{
|
||||
lock (s_cachedTypes)
|
||||
{
|
||||
if (s_cachedTypes.TryGetValue(objFullType, out Type? type1))
|
||||
{
|
||||
return type1;
|
||||
}
|
||||
|
||||
var type = GetAtomicType(objFullType);
|
||||
s_cachedTypes[objFullType] = type;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Type GetAtomicType(string objFullType)
|
||||
{
|
||||
var objectTypes = objFullType.Split(':').Reverse();
|
||||
foreach (var typeName in objectTypes)
|
||||
{
|
||||
//TODO: rather than getting the type from the first loaded kit that has it, maybe
|
||||
//we get it from a specific Kit
|
||||
var type = KitManager.Types.FirstOrDefault(tp => tp.FullName == typeName);
|
||||
if (type != null)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
//To allow for backwards compatibility saving deserialization target types.
|
||||
//We also check a ".Deprecated" prefixed namespace
|
||||
string deprecatedTypeName = GetDeprecatedTypeName(typeName);
|
||||
|
||||
var deprecatedType = KitManager.Types.FirstOrDefault(tp => tp.FullName == deprecatedTypeName);
|
||||
if (deprecatedType != null)
|
||||
{
|
||||
return deprecatedType;
|
||||
}
|
||||
}
|
||||
|
||||
return typeof(Base);
|
||||
}
|
||||
|
||||
internal static string GetDeprecatedTypeName(string typeName, string deprecatedSubstring = "Deprecated.")
|
||||
{
|
||||
int lastDotIndex = typeName.LastIndexOf('.');
|
||||
return typeName.Insert(lastDotIndex + 1, deprecatedSubstring);
|
||||
}
|
||||
|
||||
internal static Dictionary<string, PropertyInfo> GetTypeProperties(string objFullType)
|
||||
{
|
||||
lock (s_typeProperties)
|
||||
{
|
||||
if (s_typeProperties.TryGetValue(objFullType, out Dictionary<string, PropertyInfo>? value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
Dictionary<string, PropertyInfo> ret = new();
|
||||
Type type = GetType(objFullType);
|
||||
PropertyInfo[] properties = type.GetProperties();
|
||||
foreach (PropertyInfo prop in properties)
|
||||
{
|
||||
ret[prop.Name.ToLower()] = prop;
|
||||
}
|
||||
|
||||
value = ret;
|
||||
s_typeProperties[objFullType] = value;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static List<MethodInfo> GetOnDeserializedCallbacks(string objFullType)
|
||||
{
|
||||
// return new List<MethodInfo>();
|
||||
lock (s_onDeserializedCallbacks)
|
||||
{
|
||||
// System.Runtime.Serialization.Ca
|
||||
if (s_onDeserializedCallbacks.TryGetValue(objFullType, out List<MethodInfo>? value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
List<MethodInfo> ret = new();
|
||||
Type type = GetType(objFullType);
|
||||
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
foreach (MethodInfo method in methods)
|
||||
{
|
||||
List<OnDeserializedAttribute> onDeserializedAttributes = method
|
||||
.GetCustomAttributes<OnDeserializedAttribute>(true)
|
||||
.ToList();
|
||||
if (onDeserializedAttributes.Count > 0)
|
||||
{
|
||||
ret.Add(method);
|
||||
}
|
||||
}
|
||||
|
||||
value = ret;
|
||||
s_onDeserializedCallbacks[objFullType] = value;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Type GetSystemOrSpeckleType(string typeName)
|
||||
{
|
||||
var systemType = Type.GetType(typeName);
|
||||
if (systemType != null)
|
||||
{
|
||||
return systemType;
|
||||
}
|
||||
|
||||
return GetAtomicType(typeName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flushes kit's (discriminator, type) cache. Useful if you're dynamically loading more kits at runtime, that provide better coverage of what you're deserialising, and it's now somehow poisoned because the higher level types were not originally available.
|
||||
/// </summary>
|
||||
public static void FlushCachedTypes()
|
||||
{
|
||||
lock (s_cachedTypes)
|
||||
{
|
||||
s_cachedTypes = new Dictionary<string, Type>();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Obsolete
|
||||
#pragma warning disable CS8602, CA1502
|
||||
|
||||
private static readonly Dictionary<string, Type> s_cachedAbstractTypes = new();
|
||||
|
||||
[Obsolete("Only Used by Serializer V1")]
|
||||
internal static object? HandleAbstractOriginalValue(JToken jToken, string assemblyQualifiedName)
|
||||
{
|
||||
if (s_cachedAbstractTypes.TryGetValue(assemblyQualifiedName, out Type? type))
|
||||
{
|
||||
return jToken.ToObject(type);
|
||||
}
|
||||
|
||||
var pieces = assemblyQualifiedName.Split(',').Select(s => s.Trim()).ToArray();
|
||||
|
||||
var myAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(ass => ass.GetName().Name == pieces[1]);
|
||||
if (myAssembly == null)
|
||||
{
|
||||
throw new SpeckleException("Could not load abstract object's assembly.");
|
||||
}
|
||||
|
||||
var myType = myAssembly.GetType(pieces[0]);
|
||||
if (myType == null)
|
||||
{
|
||||
throw new SpeckleException("Could not load abstract object's assembly.");
|
||||
}
|
||||
|
||||
s_cachedAbstractTypes[assemblyQualifiedName] = myType;
|
||||
|
||||
return jToken.ToObject(myType);
|
||||
}
|
||||
|
||||
[Obsolete("Only used by serializer v1")]
|
||||
internal static object? HandleValue(
|
||||
JToken? value,
|
||||
JsonSerializer serializer,
|
||||
CancellationToken cancellationToken,
|
||||
JsonProperty? jsonProperty = null,
|
||||
string typeDiscriminator = "speckle_type"
|
||||
)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (jsonProperty is { PropertyType: null })
|
||||
{
|
||||
throw new ArgumentException($"Expected {nameof(JsonProperty.PropertyType)} to be non-null", nameof(jsonProperty));
|
||||
}
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case JValue jValue when jsonProperty != null:
|
||||
return jValue.ToObject(jsonProperty.PropertyType);
|
||||
case JValue jValue:
|
||||
return jValue.Value;
|
||||
// Lists
|
||||
case JArray array when jsonProperty != null && jsonProperty.PropertyType.GetConstructor(Type.EmptyTypes) != null:
|
||||
{
|
||||
var arr = Activator.CreateInstance(jsonProperty.PropertyType);
|
||||
|
||||
var addMethod = arr.GetType().GetMethod(nameof(IList.Add))!;
|
||||
var hasGenericType = jsonProperty.PropertyType.GenericTypeArguments.Length != 0;
|
||||
|
||||
foreach (var val in array)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = HandleValue(val, serializer, cancellationToken);
|
||||
|
||||
if (item is DataChunk chunk)
|
||||
{
|
||||
foreach (var dataItem in chunk.data)
|
||||
{
|
||||
if (hasGenericType && !jsonProperty.PropertyType.GenericTypeArguments[0].IsInterface)
|
||||
{
|
||||
if (jsonProperty.PropertyType.GenericTypeArguments[0].IsAssignableFrom(dataItem.GetType()))
|
||||
{
|
||||
addMethod.Invoke(arr, new[] { dataItem });
|
||||
}
|
||||
else
|
||||
{
|
||||
addMethod.Invoke(
|
||||
arr,
|
||||
new[] { Convert.ChangeType(dataItem, jsonProperty.PropertyType.GenericTypeArguments[0]) }
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addMethod.Invoke(arr, new[] { dataItem });
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (hasGenericType && !jsonProperty.PropertyType.GenericTypeArguments[0].IsInterface)
|
||||
{
|
||||
if (jsonProperty.PropertyType.GenericTypeArguments[0].IsAssignableFrom(item.GetType()))
|
||||
{
|
||||
addMethod.Invoke(arr, new[] { item });
|
||||
}
|
||||
else
|
||||
{
|
||||
addMethod.Invoke(
|
||||
arr,
|
||||
new[] { Convert.ChangeType(item, jsonProperty.PropertyType.GenericTypeArguments[0]) }
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addMethod.Invoke(arr, new[] { item });
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
case JArray array when jsonProperty != null:
|
||||
{
|
||||
var arr = (IList)
|
||||
Activator.CreateInstance(typeof(List<>).MakeGenericType(jsonProperty.PropertyType.GetElementType()));
|
||||
|
||||
foreach (var val in array)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = HandleValue(val, serializer, cancellationToken);
|
||||
if (item is DataChunk chunk)
|
||||
{
|
||||
foreach (var dataItem in chunk.data)
|
||||
{
|
||||
if (!jsonProperty.PropertyType.GetElementType()!.IsInterface)
|
||||
{
|
||||
arr.Add(Convert.ChangeType(dataItem, jsonProperty.PropertyType.GetElementType()!));
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.Add(dataItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!jsonProperty.PropertyType.GetElementType()!.IsInterface)
|
||||
{
|
||||
arr.Add(Convert.ChangeType(item, jsonProperty.PropertyType.GetElementType()!));
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
var actualArr = Array.CreateInstance(jsonProperty.PropertyType.GetElementType()!, arr.Count);
|
||||
arr.CopyTo(actualArr, 0);
|
||||
return actualArr;
|
||||
}
|
||||
case JArray array:
|
||||
{
|
||||
var arr = new List<object?>();
|
||||
foreach (var val in array)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (val == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var item = HandleValue(val, serializer, cancellationToken);
|
||||
|
||||
if (item is DataChunk chunk)
|
||||
{
|
||||
arr.AddRange(chunk.data);
|
||||
}
|
||||
else
|
||||
{
|
||||
arr.Add(item);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
case JObject jObject when jObject.Property(typeDiscriminator) != null:
|
||||
return jObject.ToObject<Base>(serializer);
|
||||
case JObject jObject:
|
||||
{
|
||||
var dict =
|
||||
jsonProperty != null
|
||||
? Activator.CreateInstance(jsonProperty.PropertyType) as IDictionary
|
||||
: new Dictionary<string, object?>();
|
||||
foreach (var prop in jObject)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
object key = prop.Key;
|
||||
if (jsonProperty != null)
|
||||
{
|
||||
key = Convert.ChangeType(prop.Key, jsonProperty.PropertyType.GetGenericArguments()[0]);
|
||||
}
|
||||
|
||||
dict[key] = HandleValue(prop.Value, serializer, cancellationToken);
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8602, CA1502 // Dereference of a possibly null reference.
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using Objects.Structural.Materials;
|
||||
using Objects.Structural.Properties.Profiles;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Structural.Materials;
|
||||
using Speckle.Objects.Structural.Properties.Profiles;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelBeam")]
|
||||
public class AsteelBeam : Beam, IHasVolume, IHasArea, IAsteelObject
|
||||
{
|
||||
[DetachProperty]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
public abstract class AsteelBolt : Base, IAsteelObject
|
||||
{
|
||||
@@ -14,12 +13,14 @@ public abstract class AsteelBolt : Base, IAsteelObject
|
||||
public Base asteelProperties { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelCircularBolt")]
|
||||
public class AsteelCircularBolt : AsteelBolt
|
||||
{
|
||||
//[SchemaInfo("AsteelCircularBolt", "Creates a Advance Steel circular bolt.", "Advance Steel", "Structure")]
|
||||
public AsteelCircularBolt() { }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelRectangularBolt")]
|
||||
public class AsteelRectangularBolt : AsteelBolt
|
||||
{
|
||||
//[SchemaInfo("AsteelRectangularBolt", "Creates a Advance Steel rectangular bolt.", "Advance Steel", "Structure")]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelGrating")]
|
||||
public class AsteelGrating : Base, IAsteelObject
|
||||
{
|
||||
[DetachProperty]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Structural.Materials;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Structural.Materials;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelPlate")]
|
||||
public class AsteelPlate : Area, IDisplayValue<List<Mesh>>, IHasArea, IHasVolume, IAsteelObject
|
||||
{
|
||||
[DetachProperty]
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelPolyBeam")]
|
||||
public class AsteelPolyBeam : AsteelBeam
|
||||
{
|
||||
//[SchemaInfo("AsteelPolyBeam", "Creates a Advance Steel polybeam.", "Advance Steel", "Structure")]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelSectionProfile")]
|
||||
public class AsteelSectionProfile : Base
|
||||
{
|
||||
public string ProfSectionType { get; set; }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelSectionProfileDB")]
|
||||
public class AsteelSectionProfileDB : Base { }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Structural.Materials;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Structural.Materials;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelSlab")]
|
||||
public class AsteelSlab : Area, IDisplayValue<List<Mesh>>, IHasArea, IHasVolume, IAsteelObject
|
||||
{
|
||||
[DetachProperty]
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelSpecialPart")]
|
||||
public class AsteelSpecialPart : Base, IAsteelObject
|
||||
{
|
||||
[DetachProperty]
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.AdvanceSteel.AsteelStraightBeam")]
|
||||
public class AsteelStraightBeam : AsteelBeam
|
||||
{
|
||||
//[SchemaInfo("AsteelStraightBeam", "Creates a Advance Steel straightBeam.", "Advance Steel", "Structure")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.AdvanceSteel;
|
||||
namespace Speckle.Objects.BuiltElements.AdvanceSteel;
|
||||
|
||||
public interface IAsteelObject
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Alignment")]
|
||||
public class Alignment : Base, IDisplayValue<Polyline>
|
||||
{
|
||||
[JsonIgnore, Obsolete("Use curves property")]
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_beamtype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadBeam")]
|
||||
public class ArchicadBeam : Beam
|
||||
{
|
||||
[SchemaInfo("ArchicadBeam", "Creates an Archicad beam by curve.", "Archicad", "Structure")]
|
||||
@@ -117,6 +116,7 @@ public class ArchicadBeam : Beam
|
||||
public double? coverFillTransformationYAxisX { get; set; }
|
||||
public double? coverFillTransformationYAxisY { get; set; }
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadBeam+BeamSegment")]
|
||||
public class BeamSegment : Base
|
||||
{
|
||||
// Segment override materials
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_columntype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadColumn")]
|
||||
public class ArchicadColumn : Column
|
||||
{
|
||||
[SchemaInfo("ArchicadColumn", "Creates an Archicad Column by curve.", "Archicad", "Structure")]
|
||||
@@ -123,6 +122,7 @@ public class ArchicadColumn : Column
|
||||
public double? coverFillTransformationYAxisX { get; set; }
|
||||
public double? coverFillTransformationYAxisY { get; set; }
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadColumn+ColumnSegment")]
|
||||
public class ColumnSegment : Base
|
||||
{
|
||||
// Segment - Veneer attributes
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_slabtype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadFloor")]
|
||||
public sealed class ArchicadFloor : Floor
|
||||
{
|
||||
// Element base
|
||||
@@ -88,6 +87,7 @@ public sealed class ArchicadFloor : Floor
|
||||
public string? botMat { get; set; }
|
||||
public bool? materialsChained { get; set; }
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadFloor+Visibility")]
|
||||
public class Visibility : Base
|
||||
{
|
||||
public bool? showOnHome { get; set; }
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_storytype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadLevel")]
|
||||
public class ArchicadLevel : Level
|
||||
{
|
||||
public short index { get; set; }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadOpening")]
|
||||
public class ArchicadOpening : Opening
|
||||
{
|
||||
[SchemaInfo("ArchicadOpening", "Creates an Archicad opening.", "Archicad", "Structure")]
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Other;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Other;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_shellbasetype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShellBase")]
|
||||
public class ArchicadShellBase : BuiltElements.Roof
|
||||
{
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShellBase+Visibility")]
|
||||
public class Visibility : Base
|
||||
{
|
||||
public bool? showOnHome { get; set; }
|
||||
@@ -107,20 +107,24 @@ public class ArchicadShellBase : BuiltElements.Roof
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_rooftype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoof")]
|
||||
public sealed class ArchicadRoof : ArchicadShellBase
|
||||
{
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoof+BaseLine")]
|
||||
public class BaseLine : Base
|
||||
{
|
||||
public Point begC { get; set; }
|
||||
public Point endC { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoof+RoofLevel")]
|
||||
public class RoofLevel : Base
|
||||
{
|
||||
public double? levelHeight { get; set; }
|
||||
public double? levelAngle { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoof+LevelEdge")]
|
||||
public class LevelEdge : Base
|
||||
{
|
||||
public double? edgeLevelAngle { get; set; }
|
||||
@@ -131,6 +135,7 @@ public sealed class ArchicadRoof : ArchicadShellBase
|
||||
public string? angleType { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoof+PivotPolyEdge")]
|
||||
public class PivotPolyEdge : Base
|
||||
{
|
||||
public int? nLevelEdgeData { get; set; }
|
||||
@@ -153,8 +158,10 @@ public sealed class ArchicadRoof : ArchicadShellBase
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_shelltype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell")]
|
||||
public sealed class ArchicadShell : ArchicadShellBase
|
||||
{
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+ShellContourEdgeData")]
|
||||
public class ShellContourEdgeData : Base
|
||||
{
|
||||
public string? sideTypeName { get; set; }
|
||||
@@ -163,6 +170,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? edgeSideMaterial { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+ShellContourData")]
|
||||
public class ShellContourData : Base
|
||||
{
|
||||
public ElementShape? shellContourPoly { get; set; }
|
||||
@@ -202,6 +210,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? morphingRuleName { get; set; }
|
||||
|
||||
// Model
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+BegShapeEdge")]
|
||||
public class BegShapeEdge : Base
|
||||
{
|
||||
public string? begShapeEdgeTrimSideType { get; set; }
|
||||
@@ -210,6 +219,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? begShapeEdgeType { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+EndShapeEdge")]
|
||||
public class EndShapeEdge : Base
|
||||
{
|
||||
public string? endShapeEdgeTrimSideType { get; set; }
|
||||
@@ -218,6 +228,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? endShapeEdgeType { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+ExtrudedEdge1")]
|
||||
public class ExtrudedEdge1 : Base
|
||||
{
|
||||
public string? extrudedEdgeTrimSideType1 { get; set; }
|
||||
@@ -226,6 +237,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? extrudedEdgeType1 { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+ExtrudedEdge2")]
|
||||
public class ExtrudedEdge2 : Base
|
||||
{
|
||||
public string? extrudedEdgeTrimSideType2 { get; set; }
|
||||
@@ -234,6 +246,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? extrudedEdgeType2 { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+RevolvedEdge1")]
|
||||
public class RevolvedEdge1 : Base
|
||||
{
|
||||
public string? revolvedEdgeTrimSideType1 { get; set; }
|
||||
@@ -242,6 +255,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? revolvedEdgeType1 { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+RevolvedEdge2")]
|
||||
public class RevolvedEdge2 : Base
|
||||
{
|
||||
public string? revolvedEdgeTrimSideType2 { get; set; }
|
||||
@@ -250,6 +264,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? revolvedEdgeType2 { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+RuledEdge1")]
|
||||
public class RuledEdge1 : Base
|
||||
{
|
||||
public string? ruledEdgeTrimSideType1 { get; set; }
|
||||
@@ -258,6 +273,7 @@ public sealed class ArchicadShell : ArchicadShellBase
|
||||
public string? ruledEdgeType1 { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadShell+RuledEdge2")]
|
||||
public class RuledEdge2 : Base
|
||||
{
|
||||
public string? ruledEdgeTrimSideType2 { get; set; }
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_zonetype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadRoom")]
|
||||
public class ArchicadRoom : Room
|
||||
{
|
||||
// Element base
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
/*
|
||||
For further informations about given the variables, visit:
|
||||
https://archicadapi.graphisoft.com/documentation/api_walltype
|
||||
*/
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadWall")]
|
||||
public class ArchicadWall : Wall
|
||||
{
|
||||
[SchemaInfo("ArchicadWall", "Creates an Archicad wall.", "Archicad", "Structure")]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.AssemblySegment")]
|
||||
public class AssemblySegment : Base
|
||||
{
|
||||
public bool circleBased { get; set; }
|
||||
@@ -27,6 +28,7 @@ public class AssemblySegment : Base
|
||||
public string buildingMaterial { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.AssemblySegmentScheme")]
|
||||
public class AssemblySegmentScheme : Base
|
||||
{
|
||||
public string lengthType { get; set; }
|
||||
@@ -36,6 +38,7 @@ public class AssemblySegmentScheme : Base
|
||||
public double lengthProportion { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.AssemblySegmentCut")]
|
||||
public class AssemblySegmentCut : Base
|
||||
{
|
||||
public string cutType { get; set; }
|
||||
@@ -43,6 +46,7 @@ public class AssemblySegmentCut : Base
|
||||
public double customAngle { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.Hole")]
|
||||
public class Hole : Base
|
||||
{
|
||||
public string holeType { get; set; }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.Classification")]
|
||||
public class Classification : Base
|
||||
{
|
||||
public Classification() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ComponentProperties")]
|
||||
public class ComponentProperties : Base
|
||||
{
|
||||
public ComponentProperties() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.DirectShape")]
|
||||
public class DirectShape : Base
|
||||
{
|
||||
public DirectShape() { }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Primitive;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Primitive;
|
||||
using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ElementShape")]
|
||||
public sealed class ElementShape : Base
|
||||
{
|
||||
public ElementShape() { }
|
||||
@@ -24,6 +24,7 @@ public sealed class ElementShape : Base
|
||||
/// <remarks>
|
||||
/// This class is only used for Archicad interop
|
||||
/// </remarks>
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ElementShape+PolylineSegment")]
|
||||
public sealed class PolylineSegment : Base, ICurve
|
||||
{
|
||||
public PolylineSegment() { }
|
||||
@@ -49,7 +50,8 @@ public sealed class ElementShape : Base
|
||||
|
||||
/// <remarks>
|
||||
/// This class is only used for Archicad interop
|
||||
/// </remarks>
|
||||
/// </remarks>>
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ElementShape+Polyline")]
|
||||
public sealed class Polyline : Base, ICurve
|
||||
{
|
||||
public Polyline() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.ArchicadFenestration")]
|
||||
public class ArchicadFenestration : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public string parentApplicationId { get; set; }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.Property")]
|
||||
public class Property : Base
|
||||
{
|
||||
public Property() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Archicad;
|
||||
namespace Speckle.Objects.BuiltElements.Archicad;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Archicad.PropertyGroup")]
|
||||
public class PropertyGroup : Base
|
||||
{
|
||||
public PropertyGroup() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Area")]
|
||||
public class Area : Base, IHasArea, IHasVolume, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public Area() { }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
public abstract class Baseline : Base
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Beam")]
|
||||
public class Beam : Base, IDisplayValue<IReadOnlyList<Base>>
|
||||
{
|
||||
public Beam() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Brace")]
|
||||
public class Brace : Base, IDisplayValue<IReadOnlyList<Base>>
|
||||
{
|
||||
public Brace() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.CableTray")]
|
||||
public class CableTray : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public ICurve baseCurve { get; set; }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Ceiling")]
|
||||
public class Ceiling : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public Ceiling() { }
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilAlignment")]
|
||||
public class CivilAlignment : Alignment
|
||||
{
|
||||
public string type { get; set; }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilAppliedAssembly")]
|
||||
public class CivilAppliedAssembly : Base
|
||||
{
|
||||
public CivilAppliedAssembly() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Other.Civil;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Other.Civil;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilAppliedSubassembly")]
|
||||
public class CivilAppliedSubassembly : Base
|
||||
{
|
||||
public CivilAppliedSubassembly() { }
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilBaseline")]
|
||||
public class CivilBaseline : Baseline<CivilAlignment, CivilProfile>
|
||||
{
|
||||
public CivilBaseline() { }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilBaselineRegion")]
|
||||
public class CivilBaselineRegion : Base
|
||||
{
|
||||
public CivilBaselineRegion() { }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilCalculatedLink")]
|
||||
public class CivilCalculatedLink : Base, ICivilCalculatedObject
|
||||
{
|
||||
public CivilCalculatedLink() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilCalculatedPoint")]
|
||||
public class CivilCalculatedPoint : Base, ICivilCalculatedObject
|
||||
{
|
||||
public CivilCalculatedPoint() { }
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilCalculatedShape")]
|
||||
public class CivilCalculatedShape : Base, ICivilCalculatedObject
|
||||
{
|
||||
public CivilCalculatedShape() { }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Civil;
|
||||
namespace Speckle.Objects.BuiltElements.Civil;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Civil.CivilProfile")]
|
||||
public class CivilProfile : Profile
|
||||
{
|
||||
public string type { get; set; }
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Column")]
|
||||
public class Column : Base, IDisplayValue<IReadOnlyList<Base>>
|
||||
{
|
||||
public Column() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Conduit")]
|
||||
public class Conduit : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public ICurve baseCurve { get; set; }
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Duct")]
|
||||
public class Duct : Base, IDisplayValue<IReadOnlyList<Base>>
|
||||
{
|
||||
public Duct() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Featureline")]
|
||||
public class Featureline : Base, IDisplayValue<List<Polyline>>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Floor")]
|
||||
public class Floor : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public Floor() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.GridLine")]
|
||||
public class GridLine : Base, IDisplayValue<List<Base>>
|
||||
{
|
||||
public GridLine() { }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Level")]
|
||||
public class Level : Base
|
||||
{
|
||||
//public List<Base> elements { get; set; }
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
/// <summary>
|
||||
/// Represents graph connections between built elements objects
|
||||
@@ -13,6 +10,7 @@ namespace Objects.BuiltElements;
|
||||
/// Network <see cref="elements"/> may need to be created first in native applications before they are linked.
|
||||
/// </remarks>
|
||||
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
|
||||
[SpeckleType("Objects.BuiltElements.Network")]
|
||||
public class Network : Base
|
||||
{
|
||||
public Network() { }
|
||||
@@ -31,6 +29,7 @@ public class Network : Base
|
||||
}
|
||||
|
||||
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
|
||||
[SpeckleType("Objects.BuiltElements.NetworkElement")]
|
||||
public class NetworkElement : Base
|
||||
{
|
||||
public NetworkElement() { }
|
||||
@@ -64,6 +63,7 @@ public class NetworkElement : Base
|
||||
}
|
||||
|
||||
[Obsolete("Networks are no longer used in any connector to assemble MEP systems.")]
|
||||
[SpeckleType("Objects.BuiltElements.NetworkLink")]
|
||||
public class NetworkLink : Base
|
||||
{
|
||||
public NetworkLink() { }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Opening")]
|
||||
public class Opening : Base
|
||||
{
|
||||
public Opening() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Pipe")]
|
||||
public class Pipe : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public Pipe() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Profile")]
|
||||
public class Profile : Base, IDisplayValue<Polyline>
|
||||
{
|
||||
public List<ICurve> curves { get; set; }
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements;
|
||||
namespace Speckle.Objects.BuiltElements;
|
||||
|
||||
/// <summary>
|
||||
/// A reinforcement bar group comprised of reinforcing bars of the same type and shape.
|
||||
@@ -11,7 +9,7 @@ namespace Objects.BuiltElements;
|
||||
/// <remarks>
|
||||
/// This class is not suitable for freeform rebar, which can have multiple shapes.
|
||||
/// </remarks>
|
||||
public class RebarGroup<T> : Base, IHasVolume, IDisplayValue<List<ICurve>>
|
||||
public abstract class RebarGroup<T> : Base, IHasVolume, IDisplayValue<List<ICurve>>
|
||||
where T : RebarShape
|
||||
{
|
||||
public RebarGroup() { }
|
||||
@@ -81,6 +79,7 @@ public class RebarGroup<T> : Base, IHasVolume, IDisplayValue<List<ICurve>>
|
||||
/// <summary>
|
||||
/// The shape describing the geometry and geometry parameters of a reinforcing bar
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.BuiltElements.RebarShape")]
|
||||
public class RebarShape : Base
|
||||
{
|
||||
public RebarShape() { }
|
||||
@@ -111,6 +110,7 @@ public class RebarShape : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.RebarHook")]
|
||||
public class RebarHook : Base
|
||||
{
|
||||
public RebarHook() { }
|
||||
@@ -144,6 +144,7 @@ public enum RebarType
|
||||
|
||||
#region Obsolete
|
||||
[Obsolete("Deprecated in 2.17: Use the RebarGroup class instead")]
|
||||
[SpeckleType("Objects.BuiltElements.Rebar")]
|
||||
public class Rebar : Base, IHasVolume, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public List<ICurve> curves { get; set; } = new();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.AdaptiveComponent")]
|
||||
public class AdaptiveComponent : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public AdaptiveComponent() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.BuildingPad")]
|
||||
public class BuildingPad : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public ICurve outline { get; set; }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit.Curve;
|
||||
namespace Speckle.Objects.BuiltElements.Revit.Curve;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.Curve.ModelCurve")]
|
||||
public class ModelCurve : Base
|
||||
{
|
||||
public ModelCurve() { }
|
||||
@@ -25,6 +25,7 @@ public class ModelCurve : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.Curve.DetailCurve")]
|
||||
public class DetailCurve : Base
|
||||
{
|
||||
public DetailCurve() { }
|
||||
@@ -45,6 +46,7 @@ public class DetailCurve : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.Curve.RoomBoundaryLine")]
|
||||
public class RoomBoundaryLine : Base
|
||||
{
|
||||
public RoomBoundaryLine() { }
|
||||
@@ -63,6 +65,7 @@ public class RoomBoundaryLine : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.Curve.SpaceSeparationLine")]
|
||||
public class SpaceSeparationLine : Base
|
||||
{
|
||||
public SpaceSeparationLine() { }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.DirectShape")]
|
||||
public class DirectShape : Base, IDisplayValue<List<Base>>
|
||||
{
|
||||
public DirectShape() { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
//This is an enum so that we can easily create a dropdown in GH for schema builder
|
||||
//NOTE: if edited the list in Objects.Converter.Revit.Categories should be updated too
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.FamilyInstance")]
|
||||
public class FamilyInstance : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public FamilyInstance() { }
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.FreeformElement")]
|
||||
public class FreeformElement : Base, IDisplayValue<List<Base>>
|
||||
{
|
||||
public FreeformElement() { }
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Objects.BuiltElements.Revit.Interfaces;
|
||||
namespace Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
|
||||
public interface IHasMEPConnectors
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.BuiltElements.Revit.Interfaces;
|
||||
using Objects.Other.Revit;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Objects.Other.Revit;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitMEPFamilyInstance")]
|
||||
public class RevitMEPFamilyInstance : RevitInstance, IHasMEPConnectors
|
||||
{
|
||||
public string RevitPartType { get; set; }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.Parameter")]
|
||||
public class Parameter : Base
|
||||
{
|
||||
public Parameter() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.ParameterUpdater")]
|
||||
public class ParameterUpdater : Base
|
||||
{
|
||||
[SchemaInfo("ParameterUpdater", "Updates parameters on a Revit element by id", "Revit", "Families")]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Objects.Organization;
|
||||
using Speckle.Objects.Organization;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.ProjectInfo")]
|
||||
public class ProjectInfo : BIMModelInfo
|
||||
{
|
||||
public string author { get; set; }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitBeam")]
|
||||
public class RevitBeam : Beam
|
||||
{
|
||||
public RevitBeam() { }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitBrace")]
|
||||
public class RevitBrace : Brace
|
||||
{
|
||||
public RevitBrace() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitCableTray")]
|
||||
public class RevitCableTray : CableTray, IHasMEPConnectors
|
||||
{
|
||||
public string family { get; set; }
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitCeiling")]
|
||||
public class RevitCeiling : Ceiling
|
||||
{
|
||||
public RevitCeiling() { }
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitColumn")]
|
||||
public class RevitColumn : Column
|
||||
{
|
||||
public RevitColumn() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitConduit")]
|
||||
public class RevitConduit : Conduit, IHasMEPConnectors
|
||||
{
|
||||
public string family { get; set; }
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitCurtainWallPanel")]
|
||||
public class RevitCurtainWallPanel : RevitElement { }
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.BuiltElements.Revit.Interfaces;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitDuct")]
|
||||
public class RevitDuct : Duct, IHasMEPConnectors
|
||||
{
|
||||
public RevitDuct() { }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
/// <summary>
|
||||
/// A generic Revit element for which we don't have direct conversions
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitElement")]
|
||||
public class RevitElement : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public string family { get; set; }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitElementType")]
|
||||
public class RevitElementType : Base
|
||||
{
|
||||
public string family { get; set; }
|
||||
@@ -13,6 +13,7 @@ public class RevitElementType : Base
|
||||
public string category { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitMepElementType")]
|
||||
public class RevitMepElementType : RevitElementType
|
||||
{
|
||||
public string shape { get; set; }
|
||||
@@ -21,6 +22,7 @@ public class RevitMepElementType : RevitElementType
|
||||
/// <summary>
|
||||
/// Represents the FamilySymbol subclass of ElementType in Revit
|
||||
/// </summary>
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitSymbolElementType")]
|
||||
public class RevitSymbolElementType : RevitElementType, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitFloor")]
|
||||
public class RevitFloor : Floor
|
||||
{
|
||||
public RevitFloor() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitLevel")]
|
||||
public class RevitLevel : Level
|
||||
{
|
||||
public RevitLevel() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitMEPConnector")]
|
||||
public class RevitMEPConnector : Base
|
||||
{
|
||||
public double angle { get; set; }
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[Obsolete(
|
||||
"Networks are no longer used to assemble MEP systems in Revit. See the RevitCommitBuilder for MEP systems conversion."
|
||||
)]
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitNetworkElement")]
|
||||
public class RevitNetworkElement : NetworkElement
|
||||
{
|
||||
public RevitNetworkElement() { }
|
||||
@@ -27,6 +28,7 @@ public class RevitNetworkElement : NetworkElement
|
||||
[Obsolete(
|
||||
"Networks are no longer used to assemble MEP systems in Revit. See the RevitCommitBuilder for MEP systems conversion."
|
||||
)]
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitNetworkLink")]
|
||||
public class RevitNetworkLink : NetworkLink
|
||||
{
|
||||
public double height { get; set; }
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Logging;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Logging;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitOpening")]
|
||||
public class RevitOpening : Opening
|
||||
{
|
||||
public Base? parameters { get; set; }
|
||||
public string elementId { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitVerticalOpening")]
|
||||
public class RevitVerticalOpening : RevitOpening { }
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitWallOpening")]
|
||||
public class RevitWallOpening : RevitOpening
|
||||
{
|
||||
public RevitWallOpening() { }
|
||||
@@ -56,6 +58,7 @@ public class RevitWallOpening : RevitOpening
|
||||
public RevitWall? host { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitShaft")]
|
||||
public class RevitShaft : RevitOpening
|
||||
{
|
||||
public RevitShaft() { }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.BuiltElements.Revit.Interfaces;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.BuiltElements.Revit.Interfaces;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitPipe")]
|
||||
public class RevitPipe : Pipe, IHasMEPConnectors
|
||||
{
|
||||
public RevitPipe() { }
|
||||
@@ -43,6 +43,7 @@ public class RevitPipe : Pipe, IHasMEPConnectors
|
||||
public List<RevitMEPConnector> Connectors { get; set; } = new();
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitFlexPipe")]
|
||||
public class RevitFlexPipe : RevitPipe
|
||||
{
|
||||
public RevitFlexPipe() { }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRailing")]
|
||||
public class RevitRailing : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public RevitRailing() { }
|
||||
@@ -35,6 +35,7 @@ public class RevitRailing : Base, IDisplayValue<List<Mesh>>
|
||||
|
||||
// Used only to transfer parameters of the top railing
|
||||
// its display mesh will live in the main railing element
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitTopRail")]
|
||||
public class RevitTopRail : Base
|
||||
{
|
||||
//public string family { get; set; }
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Newtonsoft.Json;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRebarGroup")]
|
||||
public class RevitRebarGroup : RebarGroup<RevitRebarShape>
|
||||
{
|
||||
public RevitRebarGroup() { }
|
||||
@@ -51,6 +50,7 @@ public class RevitRebarGroup : RebarGroup<RevitRebarShape>
|
||||
public string elementId { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRebarShape")]
|
||||
public class RevitRebarShape : RebarShape
|
||||
{
|
||||
public RevitRebarShape() { }
|
||||
@@ -59,6 +59,7 @@ public class RevitRebarShape : RebarShape
|
||||
public string elementId { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRebarHook")]
|
||||
public class RevitRebarHook : RebarHook
|
||||
{
|
||||
public RevitRebarHook() { }
|
||||
@@ -71,6 +72,7 @@ public class RevitRebarHook : RebarHook
|
||||
|
||||
#region Obsolete
|
||||
[Obsolete("Deprecated in 2.17: Use RevitRebarGroup class instead")]
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRebar")]
|
||||
public class RevitRebar : Rebar
|
||||
{
|
||||
public string family { get; set; }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit.RevitRoof;
|
||||
namespace Speckle.Objects.BuiltElements.Revit.RevitRoof;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRoof.RevitRoof")]
|
||||
public class RevitRoof : Roof
|
||||
{
|
||||
public string family { get; set; }
|
||||
@@ -20,6 +20,7 @@ public class RevitRoof : Roof
|
||||
}
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRoof.RevitExtrusionRoof")]
|
||||
public class RevitExtrusionRoof : RevitRoof
|
||||
{
|
||||
public RevitExtrusionRoof() { }
|
||||
@@ -63,6 +64,7 @@ public class RevitExtrusionRoof : RevitRoof
|
||||
public Line referenceLine { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitRoof.RevitFootprintRoof")]
|
||||
public class RevitFootprintRoof : RevitRoof
|
||||
{
|
||||
public RevitFootprintRoof() { }
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitStair")]
|
||||
public class RevitStair : Base, IDisplayValue<List<Mesh>>
|
||||
{
|
||||
public string family { get; set; }
|
||||
@@ -31,6 +31,7 @@ public class RevitStair : Base, IDisplayValue<List<Mesh>>
|
||||
public List<Mesh> displayValue { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitStairRun")]
|
||||
public class RevitStairRun : Base
|
||||
{
|
||||
public string family { get; set; }
|
||||
@@ -54,6 +55,7 @@ public class RevitStairRun : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitStairLanding")]
|
||||
public class RevitStairLanding : Base
|
||||
{
|
||||
public string family { get; set; }
|
||||
@@ -68,6 +70,7 @@ public class RevitStairLanding : Base
|
||||
public string units { get; set; }
|
||||
}
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitStairSupport")]
|
||||
public class RevitStairSupport : Base
|
||||
{
|
||||
public string family { get; set; }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Objects.Geometry;
|
||||
using Objects.Utils;
|
||||
using Speckle.Core.Kits;
|
||||
using Speckle.Core.Models;
|
||||
using Speckle.Objects.Geometry;
|
||||
using Speckle.Objects.Utils;
|
||||
using Speckle.Sdk.Host;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Objects.BuiltElements.Revit;
|
||||
namespace Speckle.Objects.BuiltElements.Revit;
|
||||
|
||||
[SpeckleType("Objects.BuiltElements.Revit.RevitTopography")]
|
||||
public class RevitTopography : Topography
|
||||
{
|
||||
public RevitTopography() { }
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user