コード例 #1
0
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
 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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
        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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
        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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
 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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
 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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
        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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
        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
ファイル: RuntimeTests.cs プロジェクト: bnaand/xBim-Toolkit
 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();
     }
 }