Example #1
0
        public void Should_Return_Spaces()
        {
            using (XbimModel model = new XbimModel())
            {
                model.Open(SourceFile, XbimDBAccess.ReadWrite);
                COBieContext cobieContext = new COBieContext();
                cobieContext.Model = model;

                COBieQueries cobieEngine = new COBieQueries(cobieContext);

                var spaces = cobieEngine.GetCOBieSpaceSheet();

                Assert.AreEqual(22, spaces.Rows.Count);

                FormatRows(spaces);
            }
        }
Example #2
0
        //[TestMethod]
        public void Time_On_All()
        {
            _cobieEngine = new COBieQueries(_cobieContext);

                ContactTime();
                FacilityTime();
                FloorTime();
                SpaceTime();
                ZoneTime();
                TypeTime();
                ComponentTime();
                SystemTime();
                AssemblyTime();
                ConnectionTime();
                SpareTime();
                ResourceTime();
                JobTime();
                ImpactTime();
                DocumentTime();
                AttributeTime();
                //CoordinateTime();
                IssueTime();
        }
Example #3
0
        private void Initialise()
        {
            if (Context == null)
            {
                throw new InvalidOperationException("COBieReader can't initialise without a valid Context.");
            }
            if (Context.Model == null)
            {
                throw new ArgumentException("COBieReader context must contain a models.");
            }

            //set default date for this run, if not manually overridden
            if (!Context.RunDateManuallySet)
            {
                Context.SetRunDate(DateTime.Now);
            }

            // set all the properties
            COBieQueries cq = new COBieQueries(Context);

            //create pick list from the template sheet
            COBieSheet <COBiePickListsRow> CobiePickLists = null;

            if ((!string.IsNullOrEmpty(Context.TemplateFileName)) &&
                File.Exists(Context.TemplateFileName)
                )
            {
                COBieXLSDeserialiser deSerialiser = new COBieXLSDeserialiser(Context.TemplateFileName, Constants.WORKSHEET_PICKLISTS);
                COBieWorkbook        wbook        = deSerialiser.Deserialise();
                if (wbook.Count > 0)
                {
                    CobiePickLists = (COBieSheet <COBiePickListsRow>)wbook.FirstOrDefault();
                }
            }


            //fall back to xml file if not in template
            string pickListFileName = "PickLists.xml";

            if ((CobiePickLists == null) &&
                File.Exists(pickListFileName)
                )
            {
                CobiePickLists = cq.GetCOBiePickListsSheet(pickListFileName);// create pick lists from xml
            }
            if (Context.ExcludeFromPickList)
            {
                SetExcludeComponentTypes(CobiePickLists);
                SetExcludeObjTypeTypes(CobiePickLists);
            }
            //start the Cache
            Context.Model.CacheStart();

            //contact sheet first as it will fill contact information lookups for other sheets
            Workbook.Add(cq.GetCOBieContactSheet());
            Workbook.Add(cq.GetCOBieFacilitySheet());
            Workbook.Add(cq.GetCOBieFloorSheet());
            Workbook.Add(cq.GetCOBieSpaceSheet());
            Workbook.Add(cq.GetCOBieZoneSheet());
            Workbook.Add(cq.GetCOBieTypeSheet());
            Workbook.Add(cq.GetCOBieComponentSheet());
            Workbook.Add(cq.GetCOBieSystemSheet(Workbook[Constants.WORKSHEET_COMPONENT].Indices)); //pass component names
            Workbook.Add(cq.GetCOBieAssemblySheet());
            Workbook.Add(cq.GetCOBieConnectionSheet());
            Workbook.Add(cq.GetCOBieSpareSheet());
            Workbook.Add(cq.GetCOBieResourceSheet());
            Workbook.Add(cq.GetCOBieJobSheet());
            Workbook.Add(cq.GetCOBieImpactSheet());
            Workbook.Add(cq.GetCOBieDocumentSheet());
            Workbook.Add(cq.GetCOBieAttributeSheet());//we need to fill attributes here as it is populated by Components, Type, Space, Zone, Floors, Facility etc
            //#if GEOMETRY_IMPLEMENTED
            Workbook.Add(cq.GetCOBieCoordinateSheet());
            //#endif
            Workbook.Add(cq.GetCOBieIssueSheet());
            if (CobiePickLists != null)
            {
                Workbook.Add(CobiePickLists);
            }
            else
            {
                Workbook.Add(new COBieSheet <COBiePickListsRow>(Constants.WORKSHEET_PICKLISTS)); //add empty pick list
            }
            //clear sheet session values from context
            Context.EMails.Clear();
        }
Example #4
0
		private void Initialise()
        {
			if (Context == null) { throw new InvalidOperationException("COBieReader can't initialise without a valid Context."); }
			if (Context.Model == null) { throw new ArgumentException("COBieReader context must contain a models."); }

            //set default date for this run
            Context.RunDate = DateTime.Now.ToString(Constants.DATE_FORMAT);

            // set all the properties
            COBieQueries cq = new COBieQueries(Context);

            //create pick list from the template sheet
            COBieSheet<COBiePickListsRow> CobiePickLists = null;
            if ((!string.IsNullOrEmpty(Context.TemplateFileName)) &&
                File.Exists(Context.TemplateFileName)
                )
            {
                COBieXLSDeserialiser deSerialiser = new COBieXLSDeserialiser(Context.TemplateFileName, Constants.WORKSHEET_PICKLISTS);
                COBieWorkbook wbook = deSerialiser.Deserialise();
                if (wbook.Count > 0) CobiePickLists = (COBieSheet<COBiePickListsRow>)wbook.FirstOrDefault();

                
            }

            
            //fall back to xml file if not in template
            string pickListFileName = "PickLists.xml";
            if ((CobiePickLists == null) &&
                File.Exists(pickListFileName)
                )
                CobiePickLists = cq.GetCOBiePickListsSheet(pickListFileName);// create pick lists from xml
            if (Context.ExcludeFromPickList)
            {
                SetExcludeComponentTypes(CobiePickLists);
                SetExcludeObjTypeTypes(CobiePickLists);
            }
            //start the Cache
            Context.Model.CacheStart();
                
            //contact sheet first as it will fill contact information lookups for other sheets
            Workbook.Add(cq.GetCOBieContactSheet());
            Workbook.Add(cq.GetCOBieFacilitySheet()); 
            Workbook.Add(cq.GetCOBieFloorSheet());
            Workbook.Add(cq.GetCOBieSpaceSheet());
            Workbook.Add(cq.GetCOBieZoneSheet()); 
            Workbook.Add(cq.GetCOBieTypeSheet());
            Workbook.Add(cq.GetCOBieComponentSheet());
            Workbook.Add(cq.GetCOBieSystemSheet(Workbook[Constants.WORKSHEET_COMPONENT].Indices)); //pass component names 
            Workbook.Add(cq.GetCOBieAssemblySheet());
            Workbook.Add(cq.GetCOBieConnectionSheet());
            Workbook.Add(cq.GetCOBieSpareSheet());
            Workbook.Add(cq.GetCOBieResourceSheet());
            Workbook.Add(cq.GetCOBieJobSheet());
            Workbook.Add(cq.GetCOBieImpactSheet());
            Workbook.Add(cq.GetCOBieDocumentSheet());
            Workbook.Add(cq.GetCOBieAttributeSheet());//we need to fill attributes here as it is populated by Components, Type, Space, Zone, Floors, Facility etc
            //#if GEOMETRY_IMPLEMENTED
            Workbook.Add(cq.GetCOBieCoordinateSheet());
            //#endif
            Workbook.Add(cq.GetCOBieIssueSheet());
            if (CobiePickLists != null)
                Workbook.Add(CobiePickLists);
            else
                Workbook.Add(new COBieSheet<COBiePickListsRow>(Constants.WORKSHEET_PICKLISTS)); //add empty pick list
           
            //clear sheet session values from context
            Context.EMails.Clear();
            

        }
Example #5
0
 public void Time_On_Component()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(ComponentTime() < new TimeSpan(0, 0, 25));
 }
Example #6
0
 public void Time_On_Attribute()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(AttributeTime() < new TimeSpan(0, 0, 7));
 }
Example #7
0
 public void Time_On_Assembly()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(AssemblyTime() < new TimeSpan(0, 0, 1));
 }
Example #8
0
 public void Time_On_Zone()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(ZoneTime() < new TimeSpan(0, 0, 2));
 }
Example #9
0
 public void Time_On_Type()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(TypeTime() < new TimeSpan(0, 0, 10));
 }
Example #10
0
 public void Time_On_System()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(SystemTime() < new TimeSpan(0, 0, 3));
 }
Example #11
0
 public void Time_On_Resource()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(ResourceTime() < new TimeSpan(0, 0, 1));
 }
Example #12
0
 public void Time_On_Document()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(DocumentTime() < new TimeSpan(0, 0, 1));
 }
Example #13
0
 public void Time_On_Connection()
 {
     _cobieEngine = new COBieQueries(_cobieContext);
     Assert.IsTrue(ConnectionTime() < new TimeSpan(0, 0, 1));
 }