private static IfcBuildingElementProxy ToIfc(this GeometricElement element, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var proxy = new IfcBuildingElementProxy(IfcGuid.ToIfcGuid(id), null, element.Name, $"A {element.GetType().Name} created in Hypar.", $"{element.GetType().FullName}", localPlacement, shape, null, IfcBuildingElementProxyTypeEnum.ELEMENT); return(proxy); }
private static IfcProduct ConvertElementToIfcProduct(Guid id, GeometricElement element, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { try { IfcProduct e = null; if (element is Beam) { e = ((Beam)element).ToIfc(id, localPlacement, shape); } if (element is Brace) { e = ((Brace)element).ToIfc(id, localPlacement, shape); } else if (element is Column) { e = ((Column)element).ToIfc(id, localPlacement, shape); } else if (element is StandardWall) { e = ((StandardWall)element).ToIfc(id, localPlacement, shape); } else if (element is Wall) { e = ((Wall)element).ToIfc(id, localPlacement, shape); } else if (element is Floor) { e = ((Floor)element).ToIfc(id, localPlacement, shape); } else if (element is Space) { e = ((Space)element).ToIfc(id, localPlacement, shape); } else if (element is Panel) { e = ((Panel)element).ToIfc(id, localPlacement, shape); } else if (element is Mass) { e = ((Mass)element).ToIfc(id, localPlacement, shape); } else if (element is Opening) { e = ((Opening)element).ToIfc(id, localPlacement, shape); } else { e = element.ToIfc(id, localPlacement, shape); } return(e); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine($"{element.GetType()} cannot be serialized to IFC."); } return(null); }