Пример #1
0
 protected BbSite(
     string name,
     BbProject project
     )
     : this(Guid.NewGuid(), name, project)
 {
 }
Пример #2
0
 protected BbSite(BbProject project, IfcSite site, IfcRelAggregates ifcRelAggregates)
 {
     BbProject = project;
     IfcSpatialStructureElement = site;
     IfcRelAggregates = ifcRelAggregates;
     Guid = IfcGloballyUniqueId.ConvertToGuid(site.GlobalId);
 }
Пример #3
0
 protected BbSite(BbProject project, IfcSite site, IfcRelAggregates ifcRelAggregates)
 {
     BbProject = project;
     IfcSpatialStructureElement = site;
     IfcRelAggregates           = ifcRelAggregates;
     Guid = IfcGloballyUniqueId.ConvertToGuid(site.GlobalId);
 }
Пример #4
0
        public static ICollection <BbSite> Retrieve(BbProject project)
        {
            var refed = EarlyBindingInstanceModel.GetReferencedEntities(project.IfcObject.EIN);

            if (refed.Count <= 0)
            {
                throw new InvalidDataException();
            }

            var list =
                (from agg in
                 (
                     from p21Instance in refed
                     where p21Instance.Value.GetType() == typeof(IfcRelAggregates)
                     select p21Instance.Value).OfType <IfcRelAggregates>()
                 from instance in agg.RelatedObjects
                 where instance.GetType() == typeof(IfcSite)
                 let site = instance as IfcSite
                            where site != null
                            select new BbSite(project, site, agg))
                .ToList();

            BbInstanceDB.AddToImport(list);

            return(list);
        }
Пример #5
0
 protected BbSite(
     string name,
     BbProject project
     )
     : this(Guid.NewGuid(), name, project)
 {
 }
Пример #6
0
        public static BbProject Create(Guid guid, string name, string description, string objectType, string longname, string phase)
        {
            var p = new BbProject(guid, name, description, objectType, longname, phase);

            BbInstanceDB.AddToExport(p);
            return(p);
        }
Пример #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 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);
        }
Пример #9
0
        protected BbSite(
            Guid guid, string name, string description, string longname, string compositionType, BbProject project)

        {
            Guid = guid;

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(BbHeaderSetting.Setting3D.DefaultBbPosition3D);

            IfcSpatialStructureElement = new IfcSite
            {
                GlobalId        = IfcGloballyUniqueId.ConvertToIfcGuid(guid),
                OwnerHistory    = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                Name            = name,
                Description     = description,
                LongName        = longname,
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                //                CompositionType = IfcElementCompositionEnum.ELEMENT,
            };

            if (compositionType.ToLower() == @"complex")
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.COMPLEX;
            }
            else if (compositionType.ToLower() == @"partial")
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.PARTIAL;
            }
            else
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.ELEMENT;
            }

            BbProject = project;


            if (true)
            {
                IfcRelAggregates = new IfcRelAggregates()
                {
                    GlobalId       = IfcGloballyUniqueId.NewGuid(),
                    OwnerHistory   = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                    RelatingObject = BbProject.IfcObject,
                    RelatedObjects = new List <IfcObjectDefinition>()
                    {
                        IfcSpatialStructureElement
                    },
                };
            }
        }
Пример #10
0
        protected BbSite(
            Guid guid, string name, string description, string longname, string compositionType, BbProject project)
        {
            Guid = guid;

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(BbHeaderSetting.Setting3D.DefaultBbPosition3D);

            IfcSpatialStructureElement = new IfcSite
            {
                GlobalId = IfcGloballyUniqueId.ConvertToIfcGuid(guid),
                OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                Name = name,
                Description = description,
                LongName = longname,
                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                //                CompositionType = IfcElementCompositionEnum.ELEMENT,
            };

            if (compositionType.ToLower() == @"complex")
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.COMPLEX;
            }
            else if (compositionType.ToLower() == @"partial")
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.PARTIAL;
            }
            else
            {
                IfcSpatialStructureElement.CompositionType = IfcElementCompositionEnum.ELEMENT;
            }

            BbProject = project;

            if (true)
            {
                IfcRelAggregates = new IfcRelAggregates() {
                    GlobalId = IfcGloballyUniqueId.NewGuid(),
                    OwnerHistory = BbHeaderSetting.Setting3D.IfcOwnerHistory,
                    RelatingObject = BbProject.IfcObject,
                    RelatedObjects = new List<IfcObjectDefinition>() { IfcSpatialStructureElement },
                };
            }
        }
Пример #11
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);
        }
Пример #12
0
 protected BbSite(
     Guid guid, string name, BbProject project)
     : this(guid, name, name, name, @"ELEMENT", project)
 {
 }
Пример #13
0
        public static ICollection<BbSite> Retrieve(BbProject project)
        {
            var refed = EarlyBindingInstanceModel.GetReferencedEntities(project.IfcObject.EIN);
            if (refed.Count <= 0) throw new InvalidDataException();

            var list =
                (from agg in
                     (
                         from p21Instance in refed
                         where p21Instance.Value.GetType() == typeof(IfcRelAggregates)
                         select p21Instance.Value).OfType<IfcRelAggregates>()
                 from instance in agg.RelatedObjects
                 where instance.GetType() == typeof(IfcSite)
                 let site = instance as IfcSite
                 where site != null
                 select new BbSite(project, site, agg))
                .ToList();

            BbInstanceDB.AddToImport(list);

            return list;
        }
Пример #14
0
 protected BbSite(
     Guid guid, string name, BbProject project)
     : this(guid, name, name, name, @"ELEMENT", project)
 {
 }
Пример #15
0
 public static BbSite Create(
     string name,
     BbProject project
 )
 {
     var s = new BbSite(name, project);
     BbInstanceDB.AddToExport(s);
     return s;
 }
Пример #16
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);
        }
Пример #17
0
 public static BbProject Create(Guid guid, string name, string description, string objectType, string longname, string phase)
 {
     var p = new BbProject(guid, name, description, objectType, longname, phase);
     BbInstanceDB.AddToExport(p);
     return p;
 }