示例#1
0
        public void ImportModel(IE_WinForms.ModelFormat format)
        {
            int theformat = 10;

            System.Windows.Forms.OpenFileDialog openDialog = new OpenFileDialog();

            string DataDir = ((Environment.GetEnvironmentVariable("CASROOT")) + "\\..\\data");

            string filter = "";

            switch (format)
            {
            case ModelFormat.BREP:
                openDialog.InitialDirectory = (DataDir + "\\occ");
                theformat = 0;
                filter    = "BREP Files (*.brep *.rle)|*.brep; *.rle";
                break;

            case ModelFormat.CSFDB:
                theformat = 1;
                filter    = "CSFDB Files (*.csfdb)|*.csfdb";
                break;

            case IE_WinForms.ModelFormat.STEP:
                openDialog.InitialDirectory = (DataDir + "\\step");
                theformat = 2;
                filter    = "STEP Files (*.stp *.step)|*.stp; *.step";
                break;

            case IE_WinForms.ModelFormat.IGES:
                openDialog.InitialDirectory = (DataDir + "\\iges");
                theformat = 3;
                filter    = "IGES Files (*.igs *.iges)|*.igs; *.iges";
                break;

            default:
                break;
            }
            openDialog.Filter = filter + "|All files (*.*)|*.*";
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                string filename = openDialog.FileName;
                if (filename == "")
                {
                    return;
                }
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                if (!myOCCTProxy.TranslateModel(filename, theformat, true))
                {
                    MessageBox.Show("Cann't read this file", "Error!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
            this.myOCCTProxy.ZoomAllView();
        }
示例#2
0
文件: Form1.cs 项目: sticwin/OCCT
        private void ExportImage_Click(object sender, System.EventArgs e)
        {
            Form2 curForm = (Form2)this.ActiveMdiChild;

            if (curForm == null)
            {
                return;
            }
            this.myModelFormat = IE_WinForms.ModelFormat.IMAGE;
            curForm.ExportModel(this.myModelFormat);
        }
示例#3
0
文件: Form1.cs 项目: sticwin/OCCT
        private void ImportStep_Click(object sender, System.EventArgs e)
        {
            Form2 curForm = (Form2)this.ActiveMdiChild;

            if (curForm == null)
            {
                return;
            }
            this.myModelFormat = IE_WinForms.ModelFormat.STEP;
            curForm.ImportModel(this.myModelFormat);
        }
示例#4
0
文件: Form1.cs 项目: sticwin/OCCT
        private void tBarImpt_Click(object sender, EventArgs e)
        {
            Form2 curForm = (Form2)this.ActiveMdiChild;

            if (curForm == null)
            {
                return;
            }
            this.myModelFormat = IE_WinForms.ModelFormat.IGES;
            curForm.ImportModel(this.myModelFormat);
        }
示例#5
0
 private void ImportStep_Click(object sender, System.EventArgs e)
 {
     Form2 curForm = (Form2)this.ActiveMdiChild;
       if (curForm == null)
     return;
       this.myModelFormat = IE_WinForms.ModelFormat.STEP;
       curForm.ImportModel(this.myModelFormat);
 }
示例#6
0
 private void ExportVrml_Click(object sender, System.EventArgs e)
 {
     Form2 curForm = (Form2)this.ActiveMdiChild;
       if (curForm == null)
     return;
       this.myModelFormat = IE_WinForms.ModelFormat.VRML;
       curForm.ExportModel(this.myModelFormat);
 }