private void exportButton_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string theFilter = "STandard for the Exchange of Product (*.step)|*.step|" + "Initial Graphics Exchange Specification (*.iges)|*.iges"; saveFileDialog1.Filter = theFilter; saveFileDialog1.AddExtension = true; saveFileDialog1.CheckPathExists = true; var result = saveFileDialog1.ShowDialog(); if (result.Value) { WriteFileAsync wfa = null; WriteParams dataParams = null; switch (saveFileDialog1.FilterIndex) { case 1: dataParams = new WriteParamsWithMaterials(model1); wfa = new WriteOBJ((WriteParamsWithMaterials)dataParams, saveFileDialog1.FileName); break; case 2: dataParams = new WriteParams(model1); wfa = new WriteSTL(dataParams, saveFileDialog1.FileName); break; case 3: dataParams = null; wfa = new WriteLAS(model1.Entities.Where(x => x is FastPointCloud).FirstOrDefault() as FastPointCloud, saveFileDialog1.FileName); break; case 4: dataParams = new WriteParamsWithMaterials(model1); wfa = new WriteWebGL((WriteParamsWithMaterials)dataParams, model1.DefaultMaterial, saveFileDialog1.FileName); break; #if NURBS case 5: dataParams = new WriteParamsWithUnits(model1); wfa = new WriteSTEP((WriteParamsWithUnits)dataParams, saveFileDialog1.FileName); break; case 6: dataParams = new WriteParamsWithUnits(model1); wfa = new WriteIGES((WriteParamsWithUnits)dataParams, saveFileDialog1.FileName); break; #endif } model1.StartWork(wfa); openButton.IsEnabled = false; saveButton.IsEnabled = false; importButton.IsEnabled = false; exportButton.IsEnabled = false; } }
//导出 private void exportButton_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string theFilter = "WaveFront OBJ (*.obj)|*.obj|" + "Stereolithography (*.stl)|*.stl|" + "Laser LAS (*.las)|*.las|" + "WebGL (*.html)|*.html"; theFilter += "|STandard for the Exchange of Product (*.step)|*.step|" + "Initial Graphics Exchange Specification (*.iges)|*.iges"; saveFileDialog1.Filter = theFilter; saveFileDialog1.AddExtension = true; saveFileDialog1.CheckPathExists = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { WriteFileAsync wfa = null; WriteParams dataParams; switch (saveFileDialog1.FilterIndex) { case 1: dataParams = new WriteParamsWithMaterials(model); wfa = new WriteOBJ((WriteParamsWithMaterials)dataParams, saveFileDialog1.FileName); break; case 2: dataParams = new WriteParams(model); wfa = new WriteSTL(dataParams, saveFileDialog1.FileName); break; case 3: dataParams = null; wfa = new WriteLAS(model.Entities.Where(x => x is FastPointCloud).FirstOrDefault() as FastPointCloud, saveFileDialog1.FileName); break; case 4: dataParams = new WriteParamsWithMaterials(model); wfa = new WriteWebGL((WriteParamsWithMaterials)dataParams, model.DefaultMaterial, saveFileDialog1.FileName); break; case 5: dataParams = new WriteParamsWithUnits(model); wfa = new WriteSTEP((WriteParamsWithUnits)dataParams, saveFileDialog1.FileName); break; case 6: dataParams = new WriteParamsWithUnits(model); wfa = new WriteIGES((WriteParamsWithUnits)dataParams, saveFileDialog1.FileName); break; } model.StartWork(wfa); } }
private void exportObjButton_Click(object sender, RoutedEventArgs e) { string objFile = "chair.obj"; var ws = new WriteOBJ(new WriteParamsWithMaterials(model1), objFile); ws.DoWork(); string fullPath = String.Format(@"{0}\{1}", System.Environment.CurrentDirectory, objFile); MessageBox.Show(String.Format("File saved in {0}", fullPath)); }