private void PartitionButton_Click(object sender, EventArgs e) { //Do in a copy to allow undo Polymodel newModel = new Polymodel(model); PolymodelBuilder builder = new PolymodelBuilder(); try { builder.RebuildModel(newModel); } catch (ArgumentException exc) { MessageBox.Show(exc.Message, "Error partitioning model"); return; } ModelReplaceTransaction transaction = new ModelReplaceTransaction("Load model", (object)model, newModel, modelID, tabPage); transactionManager.ApplyTransaction(transaction); Update(newModel, modelID); }
private void btnImportModel_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { string traceto = ""; if (bool.Parse(StandardUI.options.GetOption("TraceModels", bool.FalseString))) { string bareFilename = Path.GetFileName(openFileDialog1.FileName); traceto = StandardUI.options.GetOption("TraceDir", ".") + Path.DirectorySeparatorChar + Path.ChangeExtension(bareFilename, "txt"); } Stream stream = File.OpenRead(openFileDialog1.FileName); Polymodel newmodel = POFReader.ReadPOFFile(stream); stream.Close(); stream.Dispose(); newmodel.ExpandSubmodels(); //datafile.ReplaceModel(ElementNumber, model); ModelReplaceTransaction transaction = new ModelReplaceTransaction("Load model", (object)model, newmodel, modelID, tabPage); transactionManager.ApplyTransaction(transaction); Update(model, modelID); } }