static private IfcStore ProcessModels(XBimFederation xFedModel) { IfcStore fedModel = IfcStore.Create(null, IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel); using (var txn = fedModel.BeginTransaction()) { var project = fedModel.Instances.New <Xbim.Ifc4.Kernel.IfcProject>(); //project.Name = "Default Project Name"; project.Name = xFedModel.FederationName; project.LongName = xFedModel.FederationName + " - Federation"; project.Description = xFedModel.FederationDescription; project.Initialize(ProjectUnits.SIUnitsUK); txn.Commit(); } var informUser = true; for (var i = 0; i < xFedModel.GetMemberModelList().Count; i++) { var fileName = xFedModel.GetMemberModelList()[i].ModelFileName; if (!addReferencedModel(fileName, fedModel, i, informUser, out informUser)) { break; // The process is being cancelled by user } } return(fedModel); }
static private IfcStore LoadFederatedModelDef(string fileName) { XBimFederation xFedModel = JsonConvert.DeserializeObject <XBimFederation>(File.ReadAllText(fileName)); xFedModel.fedFilePath = fileName; IfcStore fedModel = ProcessModels(xFedModel); return(fedModel); }
public void Remove(string modelFile) { string model = modelFile; if (!MemberModels.ContainsKey(model)) { if (UseRelativePath) { model = XBimFederation.relativePath(Path.GetDirectoryName(fedFilePath), model); if (!MemberModels.ContainsKey(model)) { return; } } } MemberModels.Remove(model); }