コード例 #1
0
        private void StartProcessForCreateDxfFile(string pathSettingsXml)
        {
            try
            {
                var process = new Process();

                var processStartInfo = new ProcessStartInfo()
                {
                    FileName = Path.Combine(AcadTools.GetAcadLocation(),
                                            @"SectionConverterPlugin\SectionsBlueprintGenerator\SectionsBlueprintGenerator.exe"),
                    Arguments = "\"" + pathSettingsXml + "\""
                };

                process = Process.Start(processStartInfo);

                process.WaitForExit();
            }
            catch
            {
                MessageBox.Show("Failed to execute");
            }
        }
コード例 #2
0
        private void btn_ExportPoints_Click(object sender, EventArgs e)
        {
            ActiveControl = btn_ExportPoints;

            if (_dataReverted == true)
            {
                _dataReverted = false;

                MessageBox.Show(@"Invalid input");

                return;
            }

            #region Bad Blocks Cleanup
            string[] prefixes = { "axisPoint_", "heightPoint_", "redPoint_", "blackPoint_" };
            int      recordsErased;
            int      referencesErased;

            AcadTools.ClenUpDatabaseFromBadBlocks(
                prefixes,
                out recordsErased,
                out referencesErased);

            if (referencesErased != 0)
            {
                MessageBox.Show("Копий блоков удалено: " + referencesErased);
            }
            #endregion

            using (var dialog = new SaveFileDialog())
            {
                dialog.InitialDirectory = AcadTools.GetAbsolutePath();
                dialog.Title            = @"Экспортировать в...";

                string saveTime = GenerateNameForFolder();

                dialog.FileName = Path.GetFileNameWithoutExtension(AcadTools.GetAbsolutePathWithName()) +
                                  "_" + saveTime;

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string savePath = dialog.FileName.Replace(GenerateNameForFolder(), "");

                    CreateNewFolder(savePath);

                    Func <Vector3d> GetFactPossNoizeAddition = null;
                    if (_factPosEnable)
                    {
                        var randomGen = new Random();
                        var factPossNoizeAmplitude =
                            _factPosNoizeUpperBound - _factPosNoizeLowerBound / 2.0;
                        Func <double> GetNoize = () =>
                        {
                            return(_factPosNoizeLowerBound +
                                   factPossNoizeAmplitude * randomGen.NextDouble());
                        };

                        GetFactPossNoizeAddition = () => new Vector3d(GetNoize(), GetNoize(), .0);
                    }

                    GenerateDataXmlFile(savePath + "\\data.xml", GetFactPossNoizeAddition);

                    string savePathNameSettings = savePath + "\\settings.xml";

                    GenerateSettingXmlFile(
                        savePathNameSettings,
                        savePath + "\\data.xml",
                        savePath + "\\" + GenerateNameForListTsvFile(saveTime) + ".tsv",
                        Path.Combine(AcadTools.GetAcadLocation(), "SectionConverterPlugin\\SectionsBlueprintGenerator\\BlueprintTemplate" + ".dxf")
                        , savePath + "\\" + GenerateNameForDxfFile(saveTime) + ".dxf"
                        );

                    StartProcessForCreateTsvFile(savePathNameSettings);

                    StartProcessForCreateDxfFile(savePathNameSettings);
                }

                this.ActiveControl = btn_ExportPoints;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }  //button