diff --git a/src/RhinoInside.Revit.GH/Types/GeometricElement.cs b/src/RhinoInside.Revit.GH/Types/GeometricElement.cs index 4face554b..caa1a46b2 100644 --- a/src/RhinoInside.Revit.GH/Types/GeometricElement.cs +++ b/src/RhinoInside.Revit.GH/Types/GeometricElement.cs @@ -778,9 +778,7 @@ ARDB.GeometryElement geometryElement if (idMap.TryGetValue(element.Id, out var modelContent)) return modelContent as ModelInstanceDefinition; - var geometryElementContent = geometryElement.ToArray(); - if (geometryElementContent.Length < 1) - return null; + var geometryElementContent = geometryElement?.ToArray() ?? Array.Empty(); if ( @@ -905,31 +903,28 @@ internal override ModelContent ToModelContent(IDictionary i if (Value is ARDB.FamilySymbol element) { - using (var options = new ARDB.Options() { DetailLevel = ARDB.ViewDetailLevel.Fine }) + var active = element.IsActive; + using (var scope = active ? null : element.Document.RollBackScope()) { - using (var context = GeometryDecoder.Context.Push()) + if (!active) { - context.Element = element; - context.Category = element.Category; - context.Material = element.Category?.Material; + element.Activate(); + element.Document.Regenerate(); + } - using (var geometry = element.GetGeometry(options)) + using (var options = new ARDB.Options() { DetailLevel = ARDB.ViewDetailLevel.Fine }) + { + using (var context = GeometryDecoder.Context.Push()) { - if (geometry is ARDB.GeometryElement geometryElement) - return GeometricElement.ToModelInstanceDefinition(idMap, Transform.Identity, element, geometryElement); + context.Element = element; + context.Category = element.Category; + context.Material = element.Category?.Material; + + using (var geometry = element.GetGeometry(options)) + return GeometricElement.ToModelInstanceDefinition(idMap, Transform.Identity, element, geometry); } } }