예제 #1
0
 public void QueryingNestedPropFunction()
 {
     // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
     XbimModel model = new XbimModel();
     model.Open(SourceModelFileName, XbimDBAccess.Read);
     var chkCnt = model.Query("select @12275.Representation.Representations");
     Assert.AreEqual(3, ((IEnumerable<object>)chkCnt).Count());
     model.Close();
 }
예제 #2
0
        public void QueryingSelectAllModel()
        {
            // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
            using (XbimModel model = new XbimModel())
            {
                model.Open(SourceModelFileName, XbimDBAccess.Read);
                var cnt = model.Query(@"select @*");
                Assert.IsNotNull(cnt);

                dynamic doors = model.Query(@"select @IfcDoor.Where(@OverallHeight==2090)");
                Assert.IsNotNull(doors);
                Assert.AreEqual(36, doors.Count);

                doors = model.Query(@"select @IfcDoor.Where(@OverallHeight==2090 && @OverallWidth==790)");
                Assert.IsNotNull(doors);
                Assert.AreEqual(4, doors.Count);

                model.Close();
            }
        }
예제 #3
0
        public void ModelRootBasicQuery()
        {
            // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
            XbimModel model = new XbimModel();
            model.Open(SourceModelFileName, XbimDBAccess.Read);
            var cnt = model.Instances.OfType("IfcWall", false).Count();
            var chkCnt = model.Query("select @ifcWall");
            var c2 = chkCnt as IEnumerable<IPersistIfcEntity>;
            int cnt2 = c2.Count();
            Assert.AreEqual(cnt, cnt2);

            model.Close();
        }
예제 #4
0
 public void QueryingSelectFunction()
 {
     // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
     XbimModel model = new XbimModel();
     model.Open(SourceModelFileName, XbimDBAccess.Read);
     var cnt = model.Instances.OfType("IfcWall", false).Count();
     var chkCnt = model.Query("select @ifcWall.Count()");
     Assert.AreEqual(cnt.ToString(), chkCnt.ToString());
     model.Close();
 }
예제 #5
0
 public void QueryingSelectContextualWhere()
 {
     // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
     using (XbimModel model = new XbimModel())
     {
         model.Open(SourceModelFileName, XbimDBAccess.Read);
         var cnt = model.Query(@"select @12275.Representation.Representations.Where(@RepresentationIdentifier==""Body"")") as List<Object>;
         Assert.IsNotNull(cnt);
         Assert.AreEqual(1, cnt.Count());
         model.Close();
     }
 }
예제 #6
0
        public void QueryingSelectWhere()
        {
            // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
            using (XbimModel model = new XbimModel())
            {
                model.Open(SourceModelFileName, XbimDBAccess.Read);
                var cnt = model.Query("select @12275.Representation.Representations.Where(true)") as List<Object>;
                Assert.IsNotNull(cnt);
                Assert.AreEqual(3, cnt.Count());

                cnt = model.Query("select @12275.Representation.Representations.Where(false)") as List<Object>;
                Assert.IsNotNull(cnt);
                Assert.AreEqual(0, cnt.Count());

                cnt = model.Query("select @12275.Representation.Representations.Where(1<2)") as List<Object>;
                Assert.IsNotNull(cnt);
                Assert.AreEqual(3, cnt.Count());

                model.Close();
            }
        }
예제 #7
0
        public void QueryingSelectProp()
        {
            // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
            using (XbimModel model = new XbimModel())
            {
                model.Open(SourceModelFileName, XbimDBAccess.Read);
                var chkCnt = model.Query("select @12275.Representation");
                Assert.IsInstanceOfType(chkCnt, typeof(IfcProductDefinitionShape));

                model.Close();
            }
        }
예제 #8
0
 public void QueryingSelectNestedPropRange()
 {
     // DirectoryInfo d = new DirectoryInfo("."); // to find folder location
     using (XbimModel model = new XbimModel())
     {
         model.Open(SourceModelFileName, XbimDBAccess.Read);
         var cnt = model.Query("select @12275.Representation.Representations.Range(1,1)") as List<Object>;
         IPersistIfcEntity ent = cnt.FirstOrDefault() as IPersistIfcEntity;
         Assert.AreEqual(12266, Math.Abs(ent.EntityLabel));
         model.Close();
     }
 }