DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="0.8.2" />

 GeometryDataProvider

using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System; using System.Collections.Generic; namespace Autodesk.DesignScript.Geometry { [SupressImportIntoVM] internal class GeometryDataProvider : IContextDataProvider { private static readonly string mName = "DesignScript.Geometry"; public string Name => mName; public IContextData[] ImportData(Dictionary<string, object> connectionParameters) { List<Geometry> list = new List<Geometry>(); Geometry[] array = null; foreach (KeyValuePair<string, object> connectionParameter in connectionParameters) { string key; if ((key = connectionParameter.Key) != null && key == "SAT") array = Geometry.ImportFromSAT(Convert.ToString(connectionParameter.Value)); else if (connectionParameter.Value.GetType().IsArray) { Array data = connectionParameter.Value as Array; array = GeometryDataSerializer.CreateGeometryFromData(connectionParameter.Key, data); } if (array != null && array.Length > 0) list.AddRange(array); } int count = list.Count; if (count == 0) return null; IContextData[] array2 = new IContextData[count]; for (int i = 0; i < count; i++) { array2[i] = new GeometryData("ImportData", list[i], this); } return array2; } Dictionary<string, object> IContextDataProvider.ExportData(IContextData[] data, string filePath) { throw new NotImplementedException(); } Dictionary<string, object> IContextDataProvider.CaptureData() { throw new NotImplementedException(); } public string GetExpression(Dictionary<string, object> parameters, string variable) { object obj = parameters["Handle"]; Array array = null; array = ((!obj.GetType().IsArray) ? new object[1] { obj } : (obj as Array)); List<IGeometryEntity> list = new List<IGeometryEntity>(); foreach (object item in array) { IPersistentObject persistentObjectFromHandle = HostFactory.PersistenceManager.GetPersistentObjectFromHandle(item); if (persistentObjectFromHandle != null) list.Add(persistentObjectFromHandle.Geometry); } return GeometryExpressionBuilder.GetExpression(list.ToArray(), variable); } } }