diff --git a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs index e71083bb48..f59a67d3b9 100644 --- a/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs +++ b/Objects/Converters/ConverterRevit/ConverterRevitShared/PartialClasses/ConvertDirectShape.cs @@ -239,25 +239,35 @@ public ApplicationObject DirectShapeToNative(DirectShape speckleDs, ToNativeMesh return appObj; } - private DirectShape DirectShapeToSpeckle(DB.DirectShape revitAc) + private void ProcessGeometry(IEnumerable geometryObjects, Document revitDoc, List geometries) { - var cat = ((BuiltInCategory)revitAc.Category.Id.IntegerValue).ToString(); - var category = Categories.GetSchemaBuilderCategoryFromBuiltIn(cat); - var element = revitAc.get_Geometry(new Options()); - - var geometries = new List(); - foreach (var obj in element) + foreach (var obj in geometryObjects) { switch (obj) { case DB.Mesh mesh: - geometries.Add(MeshToSpeckle(mesh, revitAc.Document)); + geometries.Add(MeshToSpeckle(mesh, revitDoc)); break; case Solid solid: // TODO Should be replaced with 'BrepToSpeckle' when it works. - geometries.AddRange(ConvertSolidsByRenderMaterial(new[] { solid }, revitAc.Document)); + geometries.AddRange(ConvertSolidsByRenderMaterial(new[] { solid }, revitDoc)); + break; + case GeometryInstance gi: + var instanceGeometryElement = gi.GetSymbolGeometry(gi.Transform); + ProcessGeometry(instanceGeometryElement, revitDoc, geometries); break; } } + } + + private DirectShape DirectShapeToSpeckle(DB.DirectShape revitAc) + { + var cat = ((BuiltInCategory)revitAc.Category.Id.IntegerValue).ToString(); + var category = Categories.GetSchemaBuilderCategoryFromBuiltIn(cat); + var element = revitAc.get_Geometry(new Options()); + + var geometries = new List(); + + ProcessGeometry(element, revitAc.Document, geometries); var speckleAc = new DirectShape(revitAc.Name, category, geometries);