Пример #1
0
        //导入
        private void importButton_Click(object sender, EventArgs e)
        {
            using (var importFileDialog1 = new OpenFileDialog())
                using (var importFileAddOn = new ImportFileAddOn())
                {
                    string theFilter = "All compatible file types (*.*)|*.asc;*.stl;*.obj;*.las;*.3ds";
                    theFilter += ";*.igs;*.iges;*.stp;*.step";
                    theFilter += "|Points (*.asc)|*.asc|" + "WaveFront OBJ (*.obj)|*.obj|" + "Stereolithography (*.stl)|*.stl|" + "Laser LAS (*.las)|*.las|" + "3D Studio Max (*.3ds)|*.3ds";
                    theFilter += "|IGES (*.igs; *.iges)|*.igs; *.iges|" + "STEP (*.stp; *.step)|*.stp; *.step";

                    importFileDialog1.Filter = theFilter;

                    importFileDialog1.Multiselect     = false;
                    importFileDialog1.AddExtension    = true;
                    importFileDialog1.CheckFileExists = true;
                    importFileDialog1.CheckPathExists = true;

                    if (importFileDialog1.ShowDialog(importFileAddOn, this) == DialogResult.OK)
                    {
                        model.Clear();
                        ReadFileAsync rfa = getReader(importFileDialog1.FileName);

                        if (rfa != null)
                        {
                            model.StartWork(rfa);
                            setFileButtonEnabled(false);
                        }
                    }
                }
        }
Пример #2
0
        private void importButton_OnClick(object sender, EventArgs e)
        {
            using (var importFileDialog = new System.Windows.Forms.OpenFileDialog())
                using (var importFileAddOn = new ImportFileAddOn())
                {
                    importFileDialog.Filter          = "CAD drawings (*.dwg)|*.dwg|Drawing Exchange Format (*.dxf)|*.dxf|All compatible file types (*.*)|*.dwg;*.dxf";
                    importFileDialog.Multiselect     = false;
                    importFileDialog.AddExtension    = true;
                    importFileDialog.CheckFileExists = true;
                    importFileDialog.CheckPathExists = true;

                    if (importFileDialog.ShowDialog(importFileAddOn, null) == System.Windows.Forms.DialogResult.OK)
                    {
                        model1.Clear();
                        _yAxisUp = importFileAddOn.YAxisUp;

                        EnableControls(false);
#if SETUP
                        ReadFileAsync ra = _helper.GetReadAutodesk(model1, importFileDialog.FileName);
#else
                        ReadAutodesk ra = new ReadAutodesk(importFileDialog.FileName);
#endif
                        model1.StartWork(ra);
                    }
                }
        }
Пример #3
0
        private void importButton_Click(object sender, EventArgs e)
        {
            using (var importFileDialog1 = new OpenFileDialog())
                using (var importFileAddOn = new ImportFileAddOn())
                {
                    string theFilter = "All compatible file types (*.*)|*.asc;*.stl;*.obj;*.las;*.3ds"
#if NURBS
                                       + ";*.igs;*.iges;*.stp;*.step"
#endif

#if SOLID
                                       + ";*.ifc;*.ifczip"
#endif
                                       + "|Points (*.asc)|*.asc|" + "WaveFront OBJ (*.obj)|*.obj|" + "Stereolithography (*.stl)|*.stl|" + "Laser LAS (*.las)|*.las|" + "3D Studio Max (*.3ds)|*.3ds";
#if NURBS
                    theFilter += "|IGES (*.igs; *.iges)|*.igs; *.iges|" + "STEP (*.stp; *.step)|*.stp; *.step";
#endif

#if SOLID
                    theFilter += "|IFC (*.ifc; *.ifczip)|*.ifc; *.ifczip";
#endif
                    importFileDialog1.Filter = theFilter;

                    importFileDialog1.Multiselect     = false;
                    importFileDialog1.AddExtension    = true;
                    importFileDialog1.CheckFileExists = true;
                    importFileDialog1.CheckPathExists = true;

                    if (importFileDialog1.ShowDialog(importFileAddOn, null) == System.Windows.Forms.DialogResult.OK)
                    {
                        assemblyTreeView1.ClearTree();
                        if (model1.Entities.IsOpenCurrentBlockReference)
                        {
                            model1.Entities.CloseCurrentBlockReference();
                        }
                        model1.Clear();

                        _yAxisUp = importFileAddOn.YAxisUp;
                        ReadFileAsync rfa = getReader(importFileDialog1.FileName);

                        if (rfa != null)
                        {
                            model1.StartWork(rfa);

                            model1.SetView(viewType.Trimetric, true, model1.AnimateCamera);

                            openButton.IsEnabled   = false;
                            saveButton.IsEnabled   = false;
                            importButton.IsEnabled = false;
                            exportButton.IsEnabled = false;
                        }
                    }
                }
        }