Example #1
0
        /// <summary>
        /// 模型预检查
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doPreCheck(object sender, DoWorkEventArgs e)
        {
            DateTime before = System.DateTime.Now;



            String modelPath = _parentWindow.GetOpenedModelFileName();

            if (modelPath == null)
            {
                MessageBox.Show("请载入模型文件", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            String normSelector = GetSelectedNorm();

            if (normSelector.Equals(""))
            {
                MessageBox.Show("请选择规则", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            normFilter(normSelector);



            Dispatcher.BeginInvoke(new Action(delegate
            {
                HashSet <string> TargetIfcSet = GenerateIfcFromRules();
                PropertyExtract extractHelper = new PropertyExtract(_parentWindow.Model, _parentWindow.GetContext());


                //通过规则生成中间文件
                IFCFile file = extractHelper.getFilterIfcProperty(TargetIfcSet);
                List <ResultRow> resultRows = new List <ResultRow>();
                foreach (var rule in preRules)
                {
                    resultRows.Add(CheckSingleRule(file, rule));
                }
                showResultForPreCheck(resultRows);

                //生成结果赋值
                result = resultRows;

                //生成总体描述
                PreCheckReportInfo report = new PreCheckReportInfo(resultRows);
                ResultSummary.Text        = report.GenerateSummary();
            }));

            DateTime after = System.DateTime.Now;
            TimeSpan ts    = after.Subtract(before);

            CheckLog.Logger("[precheck时间]" + ts);
        }
Example #2
0
        private void ConfigureFolder()
        {
            var dir = new DirectoryInfo(".");

            if (_parentWindow != null)
            {
                var openedModel = _parentWindow.GetOpenedModelFileName();
                if (!string.IsNullOrEmpty(openedModel))
                {
                    dir = new DirectoryInfo(
                        Path.Combine(
                            new FileInfo(_parentWindow.GetOpenedModelFileName()).DirectoryName,
                            "Export"
                            ));
                }
            }
            // main folder config
            TxtFolderName.Text = dir.FullName;
        }
Example #3
0
        private void ConfigureFolder()
        {
            // defaults to current directory
            var dir         = new DirectoryInfo(".");
            var openedModel = _parentWindow?.GetOpenedModelFileName();

            // if we have a model then use its direcotry
            if (!string.IsNullOrEmpty(openedModel))
            {
                var directoryName = new FileInfo(openedModel).DirectoryName;
                if (directoryName != null)
                {
                    dir = new DirectoryInfo(directoryName);
                }
            }
            // main folder config
            TxtFolderName.Text = dir.FullName;

            // configure settings for exporter
            var ass = System.Reflection.Assembly.GetAssembly(GetType());

            if (_parentWindow == null)
            {
                Log.Error("attempt to locate DiskLess assembly without a valid IXbimXplorerPluginMasterWindow.");
                return;
            }
            var assemblyFile = _parentWindow.GetAssemblyLocation(ass);

            var pluginDir = new FileInfo(assemblyFile).Directory;

            if (pluginDir == null)
            {
                Log.ErrorFormat("Failed to determine plugin folder under IXbimXplorerPluginMasterWindow.");
                return;
            }

            ConfigFile = new FileInfo(Path.Combine(pluginDir.FullName, "COBieAttributesCustom.config"));
            if (ConfigFile.Exists)
            {
                return;
            }
            AppendLog("Creating Config File");
            CreateDefaultAppConfig(ConfigFile);
            ConfigFile.Refresh();
        }
Example #4
0
        /// <summary>
        /// Same as in the windows app, but here we generate a VisInfo that is attached to the view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnAddView(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                if (Bcfier.SelectedBcf() == null)
                {
                    return;
                }
                var issue = e.Parameter as Markup;
                if (issue == null)
                {
                    MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                var dialog = new AddViewXbim(issue, Bcfier.SelectedBcf().TempPath, _xpWindow.DrawingControl)
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                };
                dialog.ShowDialog();
                if (!dialog.DialogResult.HasValue || !dialog.DialogResult.Value)
                {
                    return;
                }

                //generate and set the VisInfo
                issue.Viewpoints.Last().VisInfo = GenerateViewpoint(_xpWindow.DrawingControl);

                //get filename
                var fileName = _xpWindow.GetOpenedModelFileName();
                if (string.IsNullOrEmpty(fileName))
                {
                    fileName = "Unknown";
                }
                issue.Header[0].Filename = fileName;
                Bcfier.SelectedBcf().HasBeenSaved = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error adding a View!", "exception: " + ex);
            }
        }