コード例 #1
0
        private void button_Run_Click(object sender, RoutedEventArgs e)
        {
            BIMRLDiffOptions options = new BIMRLDiffOptions();

            options.CheckNewAndDeletedObjects      = checkBox_NewDelObjects.IsChecked.Value;
            options.CheckGeometriesDiffBySignature = checkBox_CheckGeometryBySignature.IsChecked.Value;
            double tol;

            if (double.TryParse(textBox_Tolerance.Text, out tol))
            {
                options.GeometryCompareTolerance = tol;
            }
            options.CheckTypeAndTypeAssignments   = checkBox_CheckTypeAssignments.IsChecked.Value;
            options.CheckContainmentRelationships = checkBox_CheckContainmentRelations.IsChecked.Value;
            options.CheckOwnerHistory             = checkBox_CheckOwnerHistory.IsChecked.Value;
            options.CheckProperties = checkBox_CheckProperties.IsChecked.Value;
            options.CheckMaterials  = checkBox_CheckMaterials.IsChecked.Value;
            options.CheckClassificationAssignments = checkBox_Classifications.IsChecked.Value;
            options.CheckGroupMemberships          = checkBox_CheckGroupMemberships.IsChecked.Value;
            options.CheckAggregations        = checkBox_CheckAggregations.IsChecked.Value;
            options.CheckConnections         = checkBox_CheckConnections.IsChecked.Value;
            options.CheckElementDependencies = checkBox_CheckElementDependencies.IsChecked.Value;
            options.CheckSpaceBoundaries     = checkBox_CheckSpaceBoundaries.IsChecked.Value;

            string userName  = textBox_Username.Text;
            string pwd       = textBox_Password.Text;
            string dbconnect = textBox_DBConnect.Text;

            try
            {
                DBOperation.ConnectToDB(userName, pwd, dbconnect);
                BIMRLDiffModels diffModels = new BIMRLDiffModels(modelIDNew, modelIDRef, BIMRLCommonRef);
                diffModels.RunDiff(outputFileName, options: options);
            }
            catch (Exception ex)
            {
                textBox_Message.Text = ex.Message + "\n" + BIMRLCommonRef.ErrorMessages;
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            if (args.Count() == 0 || args[0].Equals("-h"))
            {
                Console.WriteLine("Usage:");
                Console.WriteLine(" - The option below will load both model to BIMRL DB and compare them afterward:");
                Console.WriteLine("      BIMRLDiffModelCmd <DB connect string> -o <report json file> <the IFC file (New)> <the IFC file (Reference)> [<option file>]");
                Console.WriteLine(" - The option below will load the new model to BIMRL DB and compare it with the existing reference:");
                Console.WriteLine("      BIMRLDiffModelCmd <DB connect string> -o <report json file> -r <reference BIMRL model ID> <the IFC file (New)> [<option file>]");
                Console.WriteLine("  Supported file types: *.ifc|*.ifcxml|*.ifczip|*.xbimf");
                return;
            }

            if (!args[1].Equals("-o") && args.Length < 5)
            {
                Console.WriteLine("Usage: BIMRLDiffModelCmd <DB connect string> -o <report json file> <the IFC file(New)> <the IFC file(Reference)>");
                Console.WriteLine("   or: BIMRLDiffModelCmd <DB connect string> -o <report json file> -r <reference BIMRL model ID> <the IFC file (New)>");
                return;
            }

            string dbConnectStr = args[0];

            string[] conn = dbConnectStr.Split(new char[] { '/', '@' });
            if (conn.Count() < 3)
            {
                Console.WriteLine("%Error: Connection string is not in the right format. Use: <username>/<password>@<db>. For example: bimrl/bimrlpwd@pdborcl");
                return;
            }
            try
            {
                DBOperation.ConnectToDB(conn[0], conn[1], conn[2]);
            }
            catch
            {
                Console.WriteLine("%Error: Connection to DB Error");
                return;
            }

            string      newModelFile       = "";
            string      outputFileName     = args[2];
            string      outputFileFullPath = Path.GetFullPath(outputFileName);
            int         refModelID         = -1;
            int         newModelID         = -1;
            BIMRLCommon bimrlCommon        = new BIMRLCommon();

            DBOperation.UIMode = false;
            string optionFile = "";

            if (args[3].Equals("-r"))
            {
                if (!int.TryParse(args[4], out refModelID))
                {
                    Console.WriteLine("%Error: Referenced Model ID must be an integer number: " + args[4]);
                    return;
                }
                if (args.Count() < 6)
                {
                    Console.WriteLine("%Error: Missing IFC file name (New)!");
                    return;
                }

                // Check ID is a valid model ID in the DB
                BIMRLQueryModel bQM       = new BIMRLQueryModel(bimrlCommon);
                DataTable       modelInfo = bQM.checkModelExists(refModelID);
                if (modelInfo.Rows.Count == 0)
                {
                    Console.WriteLine("%Error: Referenced Model ID " + refModelID.ToString() + " does not exist in the DB, load it first!");
                    return;
                }

                newModelFile = args[5];
                if (!File.Exists(newModelFile))
                {
                    Console.WriteLine("%Error: New Model file is not found!");
                    return;
                }

                if (args.Count() >= 7)
                {
                    optionFile = args[6];
                }
            }
            else
            {
                string refModelFile = args[4];
                if (!File.Exists(refModelFile))
                {
                    Console.WriteLine("%Error: Referenced Model file is not found!");
                    return;
                }
                newModelFile = args[3];
                if (!File.Exists(newModelFile))
                {
                    Console.WriteLine("%Error: New Model file is not found!");
                    return;
                }

                // Load the referenced Model
                IfcStore refModel = LoadModel.OpenModel(refModelFile);
                if (refModel != null)
                {
                    refModelID = LoadModel.LoadModelToBIMRL(refModel);
                }

                if (refModel == null || refModelID == -1)
                {
                    Console.WriteLine("%Error: Load referenced Model " + refModelFile + " failed!");
                    return;
                }

                if (args.Count() >= 6)
                {
                    optionFile = args[5];
                }
            }

            // Load the new model
            IfcStore newModel = LoadModel.OpenModel(newModelFile);

            if (newModel != null)
            {
                newModelID = LoadModel.LoadModelToBIMRL(newModel);
            }

            if (newModel == null || newModelID == -1)
            {
                Console.WriteLine("%Error: Load referenced Model " + newModelFile + " failed!");
                return;
            }

            // Compare
            BIMRLDiffOptions options = new BIMRLDiffOptions();

            if (File.Exists(optionFile))
            {
                options = JsonConvert.DeserializeObject <BIMRLDiffOptions>(File.ReadAllText(optionFile));
                if (options == null)
                {
                    options = BIMRLDiffOptions.SelectAllOptions();
                }
            }
            else
            {
                options = BIMRLDiffOptions.SelectAllOptions();
            }

            // For the purpose of Model Diff, no enhanced BIMRL data processing is needed. This saves time and space.
            //   If the model requires the enhanced data, it can be done either load the model beforehand, or run the enhancement using BIMRL_ETLMain.XplorerPlugin UI
            DBOperation.OnepushETL = false;

            BIMRLDiffModels diffModels = new BIMRLDiffModels(newModelID, refModelID, bimrlCommon);

            diffModels.RunDiff(outputFileFullPath, options: options);
        }
コード例 #3
0
        private void Button_OK_Click(object sender, RoutedEventArgs e)
        {
            string DBUserID       = TextBox_DBUserID.Text.ToUpper();
            string DBPassword     = TextBox_DBPassword.Text;
            string DBConnecstring = TextBox_DBConn.Text;

            _bimrlCommon.resetAll();

            // Connect to Oracle DB
            DBOperation.refBIMRLCommon = _bimrlCommon;      // important to ensure DBoperation has reference to this object!!
            try
            {
                DBOperation.ConnectToDB(DBUserID, DBPassword, DBConnecstring);
            }
            catch
            {
                if (!string.IsNullOrEmpty(DBOperation.refBIMRLCommon.ErrorMessages))
                {
                    Error_Dialog errorDlg = new Error_Dialog(DBOperation.refBIMRLCommon.ErrorMessages);
                    errorDlg.ShowDialog();
                }
            }

            // For object selections for Space Boundary
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_BeamSB.Content.ToString().ToUpper(), CB_BeamSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_ColumnSB.Content.ToString().ToUpper(), CB_ColumnSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_CurtainWallSB.Content.ToString().ToUpper(), CB_CurtainWallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_CoveringSB.Content.ToString().ToUpper(), CB_CoveringSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_DoorSB.Content.ToString().ToUpper(), CB_DoorSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_MemberSB.Content.ToString().ToUpper(), CB_MemberSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_OpeningSB.Content.ToString().ToUpper(), CB_OpeningSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_PlateSB.Content.ToString().ToUpper(), CB_PlateSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_RailingSB.Content.ToString().ToUpper(), CB_RailingSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCRAMP", CB_RampSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCRAMPFLIGHT", CB_RampSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_RoofSB.Content.ToString().ToUpper(), CB_RoofSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_SlabSB.Content.ToString().ToUpper(), CB_SlabSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_SpaceSB.Content.ToString().ToUpper(), CB_SpaceSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCSTAIR", CB_StairSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCSTAIRFLIGHT", CB_StairSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCWALL", CB_WallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, "IFCWALLSTANDARDCASE", CB_WallSB.IsChecked.Value);
            registerObjectType(DBOperation.objectForSpaceBoundary, CB_WindowSB.Content.ToString().ToUpper(), CB_WindowSB.IsChecked.Value);

            // For object selections for Connection (e.g. Envelop)
            registerObjectType(DBOperation.objectForConnection, CB_BeamConn.Content.ToString().ToUpper(), CB_BeamConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_ColumnConn.Content.ToString().ToUpper(), CB_ColumnConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_CurtainWallConn.Content.ToString().ToUpper(), CB_CurtainWallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_CoveringConn.Content.ToString().ToUpper(), CB_CoveringConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_DoorConn.Content.ToString().ToUpper(), CB_DoorConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_MemberConn.Content.ToString().ToUpper(), CB_MemberConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_OpeningConn.Content.ToString().ToUpper(), CB_OpeningConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_PlateConn.Content.ToString().ToUpper(), CB_PlateConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_RailingConn.Content.ToString().ToUpper(), CB_RailingConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCRAMP", CB_RampConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCRAMPFLIGHT", CB_RampConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_RoofConn.Content.ToString().ToUpper(), CB_RoofConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_SlabConn.Content.ToString().ToUpper(), CB_SlabConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_SpaceConn.Content.ToString().ToUpper(), CB_SpaceConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCSTAIR", CB_StairConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCSTAIRFLIGHT", CB_StairConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCWALL", CB_WallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, "IFCWALLSTANDARDCASE", CB_WallConn.IsChecked.Value);
            registerObjectType(DBOperation.objectForConnection, CB_WindowConn.Content.ToString().ToUpper(), CB_WindowConn.IsChecked.Value);

            Close();
        }