Ejemplo n.º 1
0
        private void OnSaveOutput(object sender, EventArgs e)
        {
            FileFormat[] formats =
            {
                FileFormat.Collada,
                FileFormat.Discreet3DS,
                FileFormat.FBX7200ASCII,
                FileFormat.FBX7200Binary,
                FileFormat.FBX7300ASCII,
                FileFormat.FBX7300Binary,
                FileFormat.FBX7400ASCII,
                FileFormat.FBX7400Binary,
                FileFormat.FBX7500ASCII,
                FileFormat.FBX7500Binary,
                FileFormat.STLASCII,
                FileFormat.STLBinary,
                FileFormat.Universal3D,
                FileFormat.WavefrontOBJ,
            };
            StringBuilder filter = new StringBuilder();

            foreach (FileFormat fmt in formats)
            {
                if (filter.Length > 0)
                {
                    filter.Append('|');
                }
                filter.AppendFormat("{0} {1} {2} (*{3})|*{3}", fmt.FileFormatType, fmt.Version, fmt.ContentType,
                                    fmt.Extension);
            }
            SaveFileDialog d = new SaveFileDialog();

            d.AddExtension = true;
            d.Filter       = filter.ToString();
            if (d.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            FileFormat outputFormat = formats[d.FilterIndex - 1];

            tbOutput.Text           = d.FileName;
            pgOutput.SelectedObject = saveOptions = outputFormat.CreateSaveOptions();
        }