diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/ArcGISFieldUtils.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/ArcGISFieldUtils.cs index 5e48fb6de..af9e0e55b 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/ArcGISFieldUtils.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/ArcGISFieldUtils.cs @@ -132,7 +132,7 @@ public List GetFieldsFromSpeckleLayer(VectorLayer target) foreach (var baseObj in target) { // get all members by default, but only Dynamic ones from the basic geometry - Dictionary members = new(); + Dictionary members = baseObj.GetMembers(DynamicBaseMemberType.Dynamic); members["Speckle_ID"] = baseObj.id; // to use for unique color values // leave out until we decide which properties to support on Receive @@ -191,14 +191,56 @@ List fieldAdded // Currently we are not sending any rhino user strings. // TODO: add support for attributes of type `Dictionary` } + else if (field.Value is Dictionary attributeDict) + { + // only traverse Base if it's Rhino userStrings, or Revit parameter, or Base containing Revit parameters + //if (field.Key == "properties") + //{ + foreach (KeyValuePair attributField in attributeDict) + { + if ( + attributField.Value is Dictionary + || attributField.Key == "applicationId" + || attributField.Key == "id" + ) + { + KeyValuePair newAttributField = new($"{field.Key}.{attributField.Key}", attributField.Value); + Func functionAdded = x => (function(x) as Dictionary)?[attributField.Key]; + TraverseAttributes(newAttributField, functionAdded, fieldsAndFunctions, fieldAdded); + } + else if (attributField.Value is IList attributeDictList) + { + int count = 0; + foreach (var attributeDictField in attributeDictList) + { + KeyValuePair newAttributeField = new($"{field.Key}[{count}]", attributeDictField); + Func functionAdded = x => (function(x) as List)?[count]; + TraverseAttributes(newAttributeField, functionAdded, fieldsAndFunctions, fieldAdded); + count += 1; + } + } + else + { + KeyValuePair newAttributeField = + new($"{field.Key}.{attributField.Key}", attributField.Value); + Func functionAdded = x => (function(x) as Dictionary)?[attributField.Key]; + TryAddField(newAttributeField, functionAdded, fieldsAndFunctions, fieldAdded); + } + } + //} + //else + //{ + // for now, ignore all other properties of Dictionnary type + //} + } else if (field.Value is IList attributeList) { int count = 0; - foreach (var attributField in attributeList) + foreach (var attributeField in attributeList) { - KeyValuePair newAttributField = new($"{field.Key}[{count}]", attributField); + KeyValuePair newAttributeField = new($"{field.Key}[{count}]", attributeField); Func functionAdded = x => (function(x) as List)?[count]; - TraverseAttributes(newAttributField, functionAdded, fieldsAndFunctions, fieldAdded); + TraverseAttributes(newAttributeField, functionAdded, fieldsAndFunctions, fieldAdded); count += 1; } }