Esempio n. 1
0
        public ModelFactory(XbimSchemaVersion schema)
        {
            IEntityFactory factory = null;

            switch (schema)
            {
            case XbimSchemaVersion.Ifc4:
                factory = new Xbim.Ifc4.EntityFactoryIfc4();
                break;

            case XbimSchemaVersion.Ifc4x1:
                factory = new Xbim.Ifc4.EntityFactoryIfc4x1();
                break;

            case XbimSchemaVersion.Ifc2X3:
                factory = new Xbim.Ifc2x3.EntityFactoryIfc2x3();
                break;

            case XbimSchemaVersion.Cobie2X4:
            case XbimSchemaVersion.Unsupported:
            default:
                throw new ArgumentOutOfRangeException();
            }
            if (factory != null)
            {
                _models = ModelProviders.Select(p => p(factory)).ToList();
            }
        }
Esempio n. 2
0
        public static void Run()
        {
            const string   file    = "SampleModel.ifc";
            const string   db      = "sample.xbim";
            var            schema  = MemoryModel.GetSchemaVersion(file);
            IEntityFactory factory = null;

            switch (schema)
            {
            case XbimSchemaVersion.Ifc4:
                factory = new Xbim.Ifc4.EntityFactoryIfc4();
                break;

            case XbimSchemaVersion.Ifc4x1:
                factory = new Xbim.Ifc4.EntityFactoryIfc4x1();
                break;

            case XbimSchemaVersion.Ifc2X3:
                factory = new Xbim.Ifc2x3.EntityFactoryIfc2x3();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(schema));
            }
            using (var model = new EsentModel(factory))
            {
                model.CreateFrom(file, db);
                model.Close();
            }

            IfcStore.ModelProviderFactory.UseEsentModelProvider();
            using (var model = IfcStore.Open(db))
            {
                // ... do anything you need to do ...
            }
        }