예제 #1
0
 /// <summary>
 /// Exports to obj.
 /// </summary>
 /// <param name="view">
 /// The view.
 /// </param>
 /// <param name="fileName">
 /// Name of the file.
 /// </param>
 private static void ExportObj(Viewport3D view, string fileName)
 {
     using (var e = new ObjExporter(fileName))
     {
         e.Export(view);
     }
 }
예제 #2
0
        private void ExportModel(string fileName = "model.obj")
        {
            using (var exporter = new ObjExporter(fileName))
            {
                exporter.Export(this.Model);
            }

            Process.Start("explorer.exe", "/select,\"" + fileName + "\"");
        }
예제 #3
0
        /// <summary>
        /// Exports to an obj file.
        /// </summary>
        /// <param name="view">
        /// The viewport.
        /// </param>
        /// <param name="fileName">
        /// Name of the file.
        /// </param>
        private static void ExportObj(this Viewport3D view, string fileName)
        {
            var e = new ObjExporter {
                TextureFolder = System.IO.Path.GetDirectoryName(fileName)
            };

            using (var stream = File.Create(fileName))
            {
                e.Export(view, stream);
            }
        }
예제 #4
0
        /// <summary>
        /// Exports to an obj file.
        /// </summary>
        /// <param name="view">
        /// The viewport.
        /// </param>
        /// <param name="path">
        /// Name of the file.
        /// </param>
        private static void ExportObj(this Viewport3D view, string path)
        {
            var dir      = System.IO.Path.GetDirectoryName(path) ?? ".";
            var filename = System.IO.Path.GetFileName(path);
            var e        = new ObjExporter
            {
                TextureFolder = dir,
                FileCreator   = f => File.Create(System.IO.Path.Combine(dir, f))
            };

            using (var stream = File.Create(path))
            {
                e.MaterialsFile = System.IO.Path.ChangeExtension(filename, ".mtl");
                e.Export(view, stream);
            }
        }
예제 #5
0
        private void FileExportRaw()
        {
            var path = FileDialogService.SaveFileDialog(null, null, Exporters.Filter, ".png");
            if (path == null)
                return;
            //HelixView.Export(path);
            ///*
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();

            var ext = Path.GetExtension(path).ToLowerInvariant();
            switch (ext)
            {
                case ".png":
                case ".jpg":
                    HelixView.Export(path);
                    break;
                case ".xaml":
                    {
                        var e = new XamlExporter(path);
                        e.Export(CurrentModel);
                        e.Close();
                        break;
                    }

                case ".xml":
                    {
                        var e = new KerkytheaExporter(path);
                        e.Export(HelixView.Viewport);
                        e.Close();
                        break;
                    }
                case ".obj":
                    {
                        var patient = new Patient();
                        var e = new SmileObjExporter(path);
                        //e.Export(CurrentModel);
                            ((SmileObjExporter)e).rawVisual = RawVisual;
                            ((SmileObjExporter)e).Export(RawVisual, patient);
                        e.Close();
                        break;
                    }
                case ".objz":
                    {
                        var tmpPath = Path.ChangeExtension(path, ".obj");
                        var e = new ObjExporter(tmpPath);
                        e.Export(CurrentModel);
                        e.Close();
                        GZipHelper.Compress(tmpPath);
                        break;
                    }
                case ".x3d":
                    {
                        var e = new X3DExporter(path);
                        e.Export(CurrentModel);
                        e.Close();
                        break;
                    }
            }
            showStatus(stopWatch, "Exported");
            //*/
        }
        /// <summary>
        /// Export the completed mesh to a .obj file
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void Export_Model_Click(object sender, RoutedEventArgs e)
        {
            //function from Helix Toolkit
            string fileName = Model_Name.Text + ".obj";

            using (var exporter = new ObjExporter(fileName))
            {
                exporter.Export(this.modelGroup);
            }

            // test code for seeing depth frame values
            Process.Start("explorer.exe", "/select,\"" + fileName + "\"");

            string fileName2 = "depth.txt";

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(fileName2))
            {
                //file.Write(string.Join(",", this.Depth));
                file.Write(greatestDepth);
            }
        }