示例#1
0
        //public BbProject semProject { get; set; }
        //BbBuilding(string name, BbProject project)
        //{
        //    ObjectBbLocalPlacement = BbLocalPlacement3D.Create(project.ObjectBbLocalPlacement, BbPosition3D.DefaultPosition);
        //    IfcSpatialStructureElement = new IfcBuilding
        //    {
        //        GlobalId = IfcGloballyUniqueId.NewGuid(),
        //        OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
        //        Name = name,
        //        //Description = "",
        //        //ObjectType = "",
        //        ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
        //        //Representation =
        //        //LongName = "",
        //        CompositionType = IfcElementCompositionEnum.ELEMENT,
        //    };
        //    semProject = project;
        //    if (true)
        //    {
        //        IfcRelAggregates = new IfcRelAggregates()
        //        {
        //            GlobalId = IfcGloballyUniqueId.NewGuid(),
        //            OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
        //            RelatingObject = semProject.IfcObject,
        //            RelatedObjects = new List<IfcObjectDefinition>() { IfcSpatialStructureElement },
        //        };
        //    }
        //}
        BbBuilding(
            string name,
            BbSite site)
        {
            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(site.ObjectBbLocalPlacement, BbHeaderSetting.Setting3D.DefaultBbPosition3D);
            IfcSpatialStructureElement = new IfcBuilding
            {
                GlobalId = IfcGloballyUniqueId.NewGuid(),

                OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                Name = name,
                //Description = "",
                //ObjectType = "",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                //Representation =
                //LongName = "",
                CompositionType = IfcElementCompositionEnum.ELEMENT,
            };
            //BbSite.AddBuilding(this);
            BbSite = site;

            if (true)
            {
                IfcRelAggregates = new IfcRelAggregates() {
                    GlobalId = IfcGloballyUniqueId.NewGuid(),
                    OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                    RelatingObject = BbSite.IfcSpatialStructureElement,
                    RelatedObjects = new List<IfcObjectDefinition>() { IfcSpatialStructureElement },
                };
            }
        }
示例#2
0
        public static BbBuilding Create(
            string name,
            BbSite bbSite)
        {
            var b = new BbBuilding(name, bbSite);

            BbInstanceDB.AddToExport(b);
            return(b);
        }
示例#3
0
        public static BbSite Create(
            string name,
            BbProject project
            )
        {
            var s = new BbSite(name, project);

            BbInstanceDB.AddToExport(s);
            return(s);
        }
示例#4
0
        /*
         * public static void RetrieveSpace(BbFloor floor)
         * {
         *  var spaces = new List<SemSpace>();
         *  if (EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelAggregates"))
         *  {
         *      var collection = EarlyBindingInstanceModel.TheModel.DataByType["IfcRelAggregates"].Values;
         *      //if (collection.Count != 1) throw new NotImplementedException();
         *      foreach (var item in collection)
         *      {
         *          var theItem = item as IfcRelAggregates;
         *          if (theItem == null) continue;
         *          if (theItem.RelatingObject.EIN == floor.IfcSpatialStructureElement.EIN)
         *          {
         *              foreach (var a in theItem.RelatedObjects)
         *              {
         *                  var space = a as IfcSpace;
         *                  if (space == null) continue;
         *                  var semSpace = new SemSpace { IfcSpace = space };
         *                  BbInstanceDB.Add(semSpace);
         *                  spaces.Add(semSpace);
         *              }
         *          }
         *      }
         *  }
         *  floor.Spaces = spaces;
         * }
         */

        //public static List<BbElement> RetrieveSpatialComponents(BbFloor floor)
        //{
        //    var spatialComponents = new List<BbElement>();
        //    //if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcRelContainedInSpatialStructure")) return null;
        //    var collection = EarlyBindingInstanceModel.GetDataByType("IfcRelContainedInSpatialStructure").Values;
        //    //if (collection.Count != 1) throw new NotImplementedException();
        //    foreach (var item in collection)
        //    {
        //        var theItem = item as IfcRelContainedInSpatialStructure;
        //        if (theItem == null) continue;
        //        if (theItem.RelatingStructure.EIN == floor.IfcSpatialStructureElement.EIN)
        //        {
        //            foreach (var a in theItem.RelatedElements)
        //            {
        //                var component = a as IfcElement;// HERE I SHOULD SEPERATE IfcElementAssembly FROM IfcColumn & IfcBeam
        //                if (component == null) continue;
        //                var spatialComponent = new BbElement { IfcElement = component };//IfcRelContainedInSpatialStructure
        //                BbInstanceDB.AddToExport(spatialComponent);
        //                spatialComponents.Add(spatialComponent);
        //            }
        //        }
        //    }
        //    return spatialComponents;
        //}



        //public void AddSpace(SemSpace semSpace)
        //{
        //    if(Spaces == null)
        //    {Spaces = new List<SemSpace>();}
        //    if (IfcRelAggregates == null)
        //    {
        //        IfcRelAggregates = new IfcRelAggregates
        //        {
        //            GlobalId = IfcGloballyUniqueId.NewGuid(),
        //            OwnerHistory = _ifcBuildingStorey.OwnerHistory,
        //            RelatingObject = _ifcBuildingStorey,
        //            RelatedObjects = new List<IfcObjectDefinition>(),
        //        };
        //    }
        //    Spaces.Add(semSpace);
        //    IfcRelAggregates.RelatedObjects.Add(semSpace.IfcSpace);
        //}

        //public void AddToFloor(BbElement floorItem)
        //{
        //    if (IfcRelContainedInSpatialStructure == null)
        //    {
        //        IfcRelContainedInSpatialStructure = new IfcRelContainedInSpatialStructure
        //        {
        //            GlobalId = IfcGloballyUniqueId.NewGuid(),
        //            OwnerHistory = _ifcBuildingStorey.OwnerHistory,
        //            RelatingStructure = _ifcBuildingStorey,
        //            RelatedElements =  new List<IfcProduct>(),
        //        };
        //    }

        //    if(SpatialComponents == null)
        //    {
        //        SpatialComponents = new List<BbElement>();
        //    }
        //    SpatialComponents.Add(floorItem);
        //}


        public static BbFloor CreateSingleStoreyProject(
            string projectName,
            string siteName,
            string buildingName,
            string floorName,
            double floorLevel)
        {
            var project  = BbProject.Create(projectName);
            var site     = BbSite.Create(siteName, project);
            var building = BbBuilding.Create(buildingName, site);
            var floor    = BbFloor.Create(floorName, floorLevel, building);

            return(floor);
        }
示例#5
0
        public static bool Phase2Reader(string filename)
        {
            BbInstanceDB.Reset();

            EarlyBindingInstanceModel.Reset();

            if (!EarlyBindingInstanceModel.Read(RegisteredSchema.IFC2X3, filename))
            {
                return(false);
            }

            BbHeaderSetting.Retrieve();
            BbProject.Retrieve();
            BbSite.Retrieve();
            BbBuilding.Retrieve();
            BbFloor.Retrieve();


            return(false);
        }
示例#6
0
        //public BbProject semProject { get; set; }


        //BbBuilding(string name, BbProject project)
        //{
        //    ObjectBbLocalPlacement = BbLocalPlacement3D.Create(project.ObjectBbLocalPlacement, BbPosition3D.DefaultPosition);
        //    IfcSpatialStructureElement = new IfcBuilding
        //    {
        //        GlobalId = IfcGloballyUniqueId.NewGuid(),

        //        OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
        //        Name = name,
        //        //Description = "",
        //        //ObjectType = "",
        //        ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
        //        //Representation =
        //        //LongName = "",
        //        CompositionType = IfcElementCompositionEnum.ELEMENT,
        //    };
        //    semProject = project;


        //    if (true)
        //    {
        //        IfcRelAggregates = new IfcRelAggregates()
        //        {
        //            GlobalId = IfcGloballyUniqueId.NewGuid(),
        //            OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
        //            RelatingObject = semProject.IfcObject,
        //            RelatedObjects = new List<IfcObjectDefinition>() { IfcSpatialStructureElement },
        //        };
        //    }
        //}

        BbBuilding(
            string name,
            BbSite site)
        {
            ObjectBbLocalPlacement     = BbLocalPlacement3D.Create(site.ObjectBbLocalPlacement, BbHeaderSetting.Setting3D.DefaultBbPosition3D);
            IfcSpatialStructureElement = new IfcBuilding
            {
                GlobalId = IfcGloballyUniqueId.NewGuid(),

                OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                Name         = name,
                //Description = "",
                //ObjectType = "",
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                //Representation =
                //LongName = "",
                CompositionType = IfcElementCompositionEnum.ELEMENT,
            };
            //BbSite.AddBuilding(this);
            BbSite = site;


            if (true)
            {
                IfcRelAggregates = new IfcRelAggregates()
                {
                    GlobalId       = IfcGloballyUniqueId.NewGuid(),
                    OwnerHistory   = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                    RelatingObject = BbSite.IfcSpatialStructureElement,
                    RelatedObjects = new List <IfcObjectDefinition>()
                    {
                        IfcSpatialStructureElement
                    },
                };
            }
        }
示例#7
0
 public static BbSite Create(
     string name,
     BbProject project
 )
 {
     var s = new BbSite(name, project);
     BbInstanceDB.AddToExport(s);
     return s;
 }
示例#8
0
        public static bool ReadTestV02(string filename)
        {
            BbInstanceDB.Reset();

            EarlyBindingInstanceModel.Reset();

            if (!EarlyBindingInstanceModel.Read(RegisteredSchema.IFC2X3, filename))
            {
                return(false);
            }

            BbHeaderSetting.Retrieve();
            BbProject.Retrieve();
            BbSite.Retrieve();
            BbBuilding.Retrieve();
            BbFloor.Retrieve();

//            var sites = BbSite.Retrieve(project);
//
//
//
//
//            ////retrieve SEMs out of sites
//            var semBuildings = new List<BbBuilding>();
//            foreach (var theSite in sites)
//            {
//                var buildings = BbBuilding.Retrieve(theSite);
//                foreach(var building in buildings)
//                { semBuildings.Add(building); }
//            }
//
//            ////retrieve SEMs out of buildings
//            var semFloors = new List<BbFloor>();
//            foreach (var theBuilding in semBuildings)
//            {
//                var floors = BbFloor.Retrieve(theBuilding);
//                foreach (var floor in floors)
//                { semFloors.Add(floor); }
//            }
//
//            ////retrieve SEMs out of floors
//            var semAssemblies = new List<BbAssembly>();
//            foreach (var theFloor in semFloors)
//            {
//                var assemblies = BbAssembly.Retrieve(theFloor);
//                foreach(var assem in assemblies)
//                { semAssemblies.Add(assem); }
//            }
//
//            ////retrieve SEMs out of Assemblies
//            var semElements = new List<BbMainPiece>();
//            foreach (var assembly in semAssemblies)
//            {
//                var semPaintFinishes = assembly.PaintFinishes;
//                //BbQuantityRequired
//                var elements = BbMainPiece.Retrieve(assembly);// all related SEMs are retrieved inside
//                foreach (var element in elements)
//                { semElements.Add(element); }
//                // Retrieve DiscreteAccessory
//            }
//
//            ////retrieve SEMs out of MainPieces
//            foreach (var mainPiece in semElements)
//            {
//                var beamType = SemBeamSemType.Retrieve(mainPiece);
//                var material = BbMaterial.Retrieve(mainPiece);
//                var pFinishPatches = mainPiece.PaintFinishes; // all related SEMs are retrieved inside
//                var annotation = SemAnnotation.Retrieve(mainPiece);
//                var skewedEnds = BbSkewedEnd.Retrieve(mainPiece); // all related SEMs are retrieved inside
//                var semCutCopes = BbCutCope.Retrieve(mainPiece); // all related SEMs are retrieved inside
//                var semDrillHoles = BbDrillHoles.Retrieve(mainPiece); // all related SEMs are retrieved inside
//                var semSlottedHoles = BbSlottedHole.Retrieve(mainPiece); // all related SEMs are retrieved inside
//
//                var welds = Weld.Retrieve(mainPiece);
//                foreach (var weld in welds)
//                {
//                    var weldType = SemWeldSemType.Retrieve(weld); // Q1: check if SemWeldType exist or not before adding to DB
//                    // Q2: semWeldType.DefinedElements inside SemWeldSemType
//
//                    var weldProp = BbWeldProperties.Retrieve(weld);
//
//                    var clipAngle = BbClipAngle.Retrieve(weld);// Q3: DiscreteAccessory vs. ClipAngle
//                    /////////////////////////////// G1 //////// alternative solution for retrieving profile of clipAngle
//                    var extGeometry = clipAngle.BbElementGeometry as BbExtrudedGeometry;
//                    var profile = BbMainPiece.RetrieveProfile(extGeometry);// Q8: Can't put retrieveProfile in any other place + clipAngle
//                    clipAngle.Profile = profile;
//
//                    var angleDrillHoles = BbDrillHoles.Retrieve(clipAngle);
//                    var AngleSlottedHoles = BbSlottedHole.Retrieve(clipAngle);
//                    // Q4 : add clipAngle to mainPiece to retrieve holes? retriving holes should be done seperately (mainPiece & clipAngle) now
//                    // Q5 : inside MainPiece.RetrieveProfile
//                    // Q6 : inside MainPiece, under extrudedGeometry
//                    // Q7 : inside MainPiece, under profile
//                    // Q9 : inside BbWeldProperties
//
//                }
//            }


            // SemConnectedElements

            // BbCoordinate2D, SemCoordinate3D, BbDirection3D

            // BbSingleProperty ...



            //foreach (var assem in assemblies)
            //{
            //    Console.WriteLine(assem.ToString());
            //}

            //return BbInstanceDB.Read(filename);
            return(false);
        }
示例#9
0
 protected BbBuilding(BbSite site, IfcBuilding building, IfcRelAggregates ifcRelAggregates)
 {
     BbSite = site;
     IfcSpatialStructureElement = building;
     IfcRelAggregates = ifcRelAggregates;
 }
示例#10
0
        public static ICollection<BbBuilding> Retrieve(BbSite site)
        {
            /*
            var ret = new List<BbBuilding>();
            if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcBuilding")) return null;
            var collection = EarlyBindingInstanceModel.TheModel.DataByType["IfcBuilding"].Values;

            foreach (var item in collection)
            {
                var theItem = item as IfcBuilding;
                if (theItem == null) continue;
                foreach (var building in site.Buildings)
                {
                    if (building.IfcSpatialStructureElement.EIN == theItem.EIN)
                    {
                        var semBuilding = new BbBuilding { _ifcBuilding = theItem };
                        var floor = RetrieveFloors(semBuilding);
                        semBuilding.Floors = floor;

                        BbInstanceDB.Add(semBuilding);
                        ret.Add(semBuilding);
                    }
                }
            }
            return ret;
             * */

            var refed = EarlyBindingInstanceModel.GetReferencedEntities(site.IfcSpatialStructureElement.EIN);
            //if (refed.Count <= 0) throw new InvalidDataException();

            var ret = new List<BbBuilding>();
            foreach (var p21Instance in refed)
            {
                if (p21Instance.Value.GetType() != typeof(IfcRelAggregates)) continue;
                var agg = p21Instance.Value as IfcRelAggregates;
                if (agg == null) continue;

                foreach (var instance in agg.RelatedObjects)
                {
                    if (instance.GetType() != typeof(IfcBuilding)) continue;
                    var building = instance as IfcBuilding;
                    if (building == null) continue;
                    var semBuilding = new BbBuilding(site, building, agg);
                    ret.Add(semBuilding);
                    BbInstanceDB.AddToExport(semBuilding);
                }
            }
            return ret;
        }
示例#11
0
 public static BbBuilding Create(
     string name,
     BbSite bbSite)
 {
     var b = new BbBuilding(name, bbSite);
     BbInstanceDB.AddToExport(b);
     return b;
 }
示例#12
0
        public static ICollection <BbBuilding> Retrieve(BbSite site)
        {
            /*
             * var ret = new List<BbBuilding>();
             * if (!EarlyBindingInstanceModel.TheModel.DataByType.ContainsKey("IfcBuilding")) return null;
             * var collection = EarlyBindingInstanceModel.TheModel.DataByType["IfcBuilding"].Values;
             *
             * foreach (var item in collection)
             * {
             *  var theItem = item as IfcBuilding;
             *  if (theItem == null) continue;
             *  foreach (var building in site.Buildings)
             *  {
             *      if (building.IfcSpatialStructureElement.EIN == theItem.EIN)
             *      {
             *          var semBuilding = new BbBuilding { _ifcBuilding = theItem };
             *          var floor = RetrieveFloors(semBuilding);
             *          semBuilding.Floors = floor;
             *
             *          BbInstanceDB.Add(semBuilding);
             *          ret.Add(semBuilding);
             *      }
             *  }
             * }
             * return ret;
             * */


            var refed = EarlyBindingInstanceModel.GetReferencedEntities(site.IfcSpatialStructureElement.EIN);
            //if (refed.Count <= 0) throw new InvalidDataException();

            var ret = new List <BbBuilding>();

            foreach (var p21Instance in refed)
            {
                if (p21Instance.Value.GetType() != typeof(IfcRelAggregates))
                {
                    continue;
                }
                var agg = p21Instance.Value as IfcRelAggregates;
                if (agg == null)
                {
                    continue;
                }

                foreach (var instance in agg.RelatedObjects)
                {
                    if (instance.GetType() != typeof(IfcBuilding))
                    {
                        continue;
                    }
                    var building = instance as IfcBuilding;
                    if (building == null)
                    {
                        continue;
                    }
                    var semBuilding = new BbBuilding(site, building, agg);
                    ret.Add(semBuilding);
                    BbInstanceDB.AddToExport(semBuilding);
                }
            }
            return(ret);
        }
示例#13
0
 protected BbBuilding(BbSite site, IfcBuilding building, IfcRelAggregates ifcRelAggregates)
 {
     BbSite = site;
     IfcSpatialStructureElement = building;
     IfcRelAggregates           = ifcRelAggregates;
 }