Exemplo n.º 1
0
 public IfMaterial(IfModel ifModel, IfColor color, double specularColor = .5, double SpecularHighlight = 65, double transparency = 0)
 {
     IfColor           = color;
     IfModel           = ifModel;
     IfElements        = new List <IfElement>();
     SpecularColor     = specularColor;
     SpecularHighlight = specularColor;
     Transparency      = transparency;
     if (IfModel == null)
     {
         return;
     }
     New();
 }
Exemplo n.º 2
0
        public static List <IfBuilding> GetBuildings(IfModel ifModel)
        {
            List <IfBuilding> ifBuildings = new List <IfBuilding>();
            IfBuilding        ifBuidling;

            foreach (var building in ifModel.IfcStore.Instances.OfType <IIfcBuilding>())
            {
                ifBuidling = new IfBuilding(ifModel)
                {
                    IfcBuilding = building,
                    IfModel     = ifModel
                };
                ifBuildings.Add(ifBuidling);
            }

            return(ifBuildings);
        }
Exemplo n.º 3
0
        public static IfModel New(string projectName, string buildingName, bool save, string filepath = "Untitled")
        {
            //first we need to set up some credentials for ownership of data in the new model
            var credentials = new XbimEditorCredentials
            {
                ApplicationDevelopersName = "ITI ",
                ApplicationFullName       = " ",
                ApplicationIdentifier     = " ",
                ApplicationVersion        = "1.0",
                EditorsFamilyName         = "ITI ",
                EditorsGivenName          = "ITI ",
                EditorsOrganisationName   = " ITI"
            };
            //now we can create an IfcStore, it is in Ifc4 format and will be held in memory rather than in a database
            //database is normally better in performance terms if the model is large >50MB of Ifc or if robust transactions are required

            var     model   = IfcStore.Create(credentials, IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel);
            IfModel ifModel = new IfModel(model);

            //Begin a transaction as all changes to a model are ACID
            using (var txn = model.BeginTransaction("Initialise Model"))
            {
                //create a project
                var project = model.Instances.New <IfcProject>();

                //set the units to SI (mm and metres)
                project.Initialize(ProjectUnits.SIUnitsUK);
                project.Name = projectName;
                //now commit the changes, else they will be rolled back at the end of the scope of the using statement
                txn.Commit();
            }
            if (save)
            {
                model.SaveAs(filepath);
            }

            ifModel.IfBuildings.Add(IfBuilding.New(ifModel, buildingName));

            return(ifModel);
        }
Exemplo n.º 4
0
        public static IfBuilding New(IfModel ifModel, string name)
        {
            IfBuilding ifBuilding = new IfBuilding();
            var        model      = ifModel.IfcStore;

            using (var txn = model.BeginTransaction("Create Building"))
            {
                var building = model.Instances.New <IfcBuilding>();
                building.Name            = name;
                building.CompositionType = IfcElementCompositionEnum.ELEMENT;
                var localPlacement = model.Instances.New <IfcLocalPlacement>();
                building.ObjectPlacement = localPlacement;
                var placement = model.Instances.New <IfcAxis2Placement3D>();
                localPlacement.RelativePlacement = placement;
                placement.Location = model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(0, 0, 0));
                var project = model.Instances.OfType <IfcProject>().FirstOrDefault();
                project?.AddBuilding(building);
                txn.Commit();
                //set the Ifcbuilding
                ifBuilding.IfcBuilding = building;
            }
            return(ifBuilding);
        }
Exemplo n.º 5
0
 public IfWall(IfModel ifModel, IIfcWall ifcWall) : base(ifModel)
 {
     IfcWall = ifcWall;
     Initialize();
 }
Exemplo n.º 6
0
 public IfUnit(IfModel ifModel)
 {
     IfModel = ifModel;
     Initialize();
     IfModel.Instances.Add(this);
 }
Exemplo n.º 7
0
 public IfElement(IfModel ifModel)
 {
     IfModel = ifModel ?? new IfModel();
     IfModel.Instances.Add(this);
 }
Exemplo n.º 8
0
 public IfVersion(IfModel ifModel)
 {
     IfModel = ifModel;
     Initialize();
 }
Exemplo n.º 9
0
 public IfMaterial(IfModel ifModel, IfColor color) : this(ifModel, color, .5, 65, 0)
 {
 }
Exemplo n.º 10
0
 public IfFloor(IfModel ifModel, IIfcSlab ifcSlab) : base(ifModel)
 {
     IfcSlab = ifcSlab;
     Initialize();
 }
Exemplo n.º 11
0
 public IfBuilding(IfModel ifModel) : base(ifModel)
 {
     Intialize();
 }