public IEnumerable <ComparisonResult> Compare <T>(Xbim.IO.XbimModel baseline, Xbim.IO.XbimModel revised) where T : Ifc2x3.Kernel.IfcRoot { foreach (var b in baseline.Instances.OfType <T>()) { yield return(Compare <T>(b, revised)); } yield return(GetResidualsFromRevision <T>(revised)); }
void Process(object w, DoWorkEventArgs args) { var worker = w as BackgroundWorker; var dir = ((dynamic)args.Argument).Dir as String; var AutoAdjustWCS = (((dynamic)args.Argument).AutoAdjust as Boolean?).Value; var dirInfo = new DirectoryInfo(dir); var Results = new List<Result>(); var xbims = dirInfo.EnumerateFiles("*.*").Where(s => s.Extension == ".xbim"); foreach (var f in xbims) { worker.ReportProgress(0, String.Format("Starting Processing of {0}", f.Name)); using (var m = new Xbim.IO.XbimModel()) { m.Open(f.FullName, Xbim.XbimExtensions.XbimDBAccess.ReadWrite, worker.ReportProgress); var m3d = new Xbim.ModelGeometry.Scene.Xbim3DModelContext(m); if (!m3d.IsGenerated) { m3d.CreateContext(XbimGeometry.Interfaces.XbimGeometryType.PolyhedronBinary, worker.ReportProgress, adjustWCS: AutoAdjustWCS); } var region = m3d.GetLargestRegion(); Results.Add(new Result(f.Name, region)); } worker.ReportProgress(0, String.Format("Completed Processing of {0}", f.Name)); } foreach (var f in dirInfo.EnumerateFiles("*.*").Where(s => s.Extension == ".ifc" || s.Extension == ".ifczip")) { if (File.Exists(System.IO.Path.ChangeExtension(f.FullName, ".xbim"))) continue; worker.ReportProgress(0, String.Format("Starting Processing of {0}", f.Name)); using (var m = new Xbim.IO.XbimModel()) { m.CreateFrom(f.FullName, System.IO.Path.ChangeExtension(f.FullName, ".xbim"), worker.ReportProgress, true, true); var m3d = new Xbim.ModelGeometry.Scene.Xbim3DModelContext(m); m3d.CreateContext(XbimGeometry.Interfaces.XbimGeometryType.PolyhedronBinary, worker.ReportProgress, adjustWCS: AutoAdjustWCS); var region = m3d.GetLargestRegion(); Results.Add(new Result(f.Name, region)); } worker.ReportProgress(0, String.Format("Completed Processing of {0}", f.Name)); } worker.ReportProgress(100, "Processing Complete."); args.Result = Results; }