3 using System.Collections;
4 using System.ComponentModel;
5 using System.Windows.Forms;
11 /// Summary description for Form1.
13 public class Form1 : System.Windows.Forms.Form
15 private System.Windows.Forms.MainMenu mainMenu1;
16 private System.Windows.Forms.MenuItem FileNew;
17 private System.Windows.Forms.MenuItem FileClose;
18 private System.Windows.Forms.MenuItem FileExport;
19 private System.Windows.Forms.MenuItem FileImport;
20 private System.Windows.Forms.MenuItem ImportBRep;
21 private System.Windows.Forms.MenuItem ExportImage;
22 private System.Windows.Forms.MenuItem File;
23 private System.Windows.Forms.MenuItem Window;
24 private System.Windows.Forms.ToolBarButton New;
25 private System.Windows.Forms.ImageList imageList1;
26 private System.Windows.Forms.ToolBarButton About;
27 private System.Windows.Forms.StatusBar myStatusBar;
28 private System.Windows.Forms.MenuItem ImportIges;
29 private System.Windows.Forms.MenuItem ImportStep;
30 private System.Windows.Forms.MenuItem ExportBRep;
31 private System.Windows.Forms.MenuItem ExportIges;
32 private System.Windows.Forms.MenuItem ExportStep;
33 private System.Windows.Forms.MenuItem ExportStl;
34 private System.Windows.Forms.MenuItem ExportVrml;
35 private System.ComponentModel.IContainer components;
36 private System.Windows.Forms.MenuItem menuItem1;
37 private System.Windows.Forms.MenuItem menuItem2;
38 private System.Windows.Forms.MenuItem menuItem3;
39 private System.Windows.Forms.MenuItem View;
40 private System.Windows.Forms.MenuItem Help;
41 private System.Windows.Forms.MenuItem HelpAbout;
42 private System.Windows.Forms.MenuItem ViewToolbar;
43 private System.Windows.Forms.MenuItem ViewStatusBar;
44 private System.Windows.Forms.MenuItem menuItem4;
45 private System.Windows.Forms.MenuItem WindowCascade;
46 private System.Windows.Forms.MenuItem WindowTile;
48 protected IE.ModelFormat myModelFormat;
49 private System.Windows.Forms.ToolBarButton wireframe;
50 private System.Windows.Forms.ToolBarButton shading;
51 private System.Windows.Forms.ToolBarButton toolBarButton1;
52 private System.Windows.Forms.ToolBarButton color;
53 private System.Windows.Forms.ToolBarButton transparency;
54 private System.Windows.Forms.ToolBarButton delete;
55 private System.Windows.Forms.ToolBarButton material;
56 private System.Windows.Forms.ToolBarButton ZoomAll;
57 private System.Windows.Forms.ToolBarButton ZoomWin;
58 private System.Windows.Forms.ToolBarButton ZoomProg;
59 private System.Windows.Forms.ToolBarButton Pan;
60 private System.Windows.Forms.ToolBarButton PanGlo;
61 private System.Windows.Forms.ToolBarButton Front;
62 private System.Windows.Forms.ToolBarButton Back;
63 private System.Windows.Forms.ToolBarButton TOP;
64 private System.Windows.Forms.ToolBarButton BOTTOM;
65 private System.Windows.Forms.ToolBarButton RIGHT;
66 private System.Windows.Forms.ToolBarButton LEFT;
67 private System.Windows.Forms.ToolBarButton Axo;
68 private System.Windows.Forms.ToolBarButton Rot;
69 private System.Windows.Forms.ToolBarButton Reset;
70 private System.Windows.Forms.ToolBarButton HlrOn;
71 private System.Windows.Forms.ToolBarButton HlrOff;
72 private System.Windows.Forms.ToolBar toolBarTool;
73 private System.Windows.Forms.ToolBar toolBarView;
74 protected static int myNbOfChildren;
79 // Required for Windows Form Designer support
81 InitializeComponent();
84 // TODO: Add any constructor code after InitializeComponent call
86 IE.Form1.myNbOfChildren=0;
90 /// Clean up any resources being used.
92 protected override void Dispose( bool disposing )
96 if (components != null)
101 base.Dispose( disposing );
104 #region Windows Form Designer generated code
106 /// Required method for Designer support - do not modify
107 /// the contents of this method with the code editor.
109 private void InitializeComponent()
111 this.components = new System.ComponentModel.Container();
112 System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
113 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
114 this.mainMenu1 = new System.Windows.Forms.MainMenu();
115 this.File = new System.Windows.Forms.MenuItem();
116 this.FileNew = new System.Windows.Forms.MenuItem();
117 this.FileExport = new System.Windows.Forms.MenuItem();
118 this.ImportBRep = new System.Windows.Forms.MenuItem();
119 this.ImportIges = new System.Windows.Forms.MenuItem();
120 this.ImportStep = new System.Windows.Forms.MenuItem();
121 this.FileImport = new System.Windows.Forms.MenuItem();
122 this.ExportBRep = new System.Windows.Forms.MenuItem();
123 this.ExportIges = new System.Windows.Forms.MenuItem();
124 this.ExportStep = new System.Windows.Forms.MenuItem();
125 this.ExportStl = new System.Windows.Forms.MenuItem();
126 this.ExportVrml = new System.Windows.Forms.MenuItem();
127 this.menuItem3 = new System.Windows.Forms.MenuItem();
128 this.ExportImage = new System.Windows.Forms.MenuItem();
129 this.FileClose = new System.Windows.Forms.MenuItem();
130 this.menuItem2 = new System.Windows.Forms.MenuItem();
131 this.menuItem1 = new System.Windows.Forms.MenuItem();
132 this.View = new System.Windows.Forms.MenuItem();
133 this.ViewToolbar = new System.Windows.Forms.MenuItem();
134 this.ViewStatusBar = new System.Windows.Forms.MenuItem();
135 this.Window = new System.Windows.Forms.MenuItem();
136 this.menuItem4 = new System.Windows.Forms.MenuItem();
137 this.WindowCascade = new System.Windows.Forms.MenuItem();
138 this.WindowTile = new System.Windows.Forms.MenuItem();
139 this.Help = new System.Windows.Forms.MenuItem();
140 this.HelpAbout = new System.Windows.Forms.MenuItem();
141 this.toolBarTool = new System.Windows.Forms.ToolBar();
142 this.New = new System.Windows.Forms.ToolBarButton();
143 this.About = new System.Windows.Forms.ToolBarButton();
144 this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
145 this.wireframe = new System.Windows.Forms.ToolBarButton();
146 this.shading = new System.Windows.Forms.ToolBarButton();
147 this.color = new System.Windows.Forms.ToolBarButton();
148 this.material = new System.Windows.Forms.ToolBarButton();
149 this.transparency = new System.Windows.Forms.ToolBarButton();
150 this.delete = new System.Windows.Forms.ToolBarButton();
151 this.imageList1 = new System.Windows.Forms.ImageList(this.components);
152 this.myStatusBar = new System.Windows.Forms.StatusBar();
153 this.toolBarView = new System.Windows.Forms.ToolBar();
154 this.ZoomAll = new System.Windows.Forms.ToolBarButton();
155 this.ZoomWin = new System.Windows.Forms.ToolBarButton();
156 this.ZoomProg = new System.Windows.Forms.ToolBarButton();
157 this.Pan = new System.Windows.Forms.ToolBarButton();
158 this.PanGlo = new System.Windows.Forms.ToolBarButton();
159 this.Front = new System.Windows.Forms.ToolBarButton();
160 this.Back = new System.Windows.Forms.ToolBarButton();
161 this.TOP = new System.Windows.Forms.ToolBarButton();
162 this.BOTTOM = new System.Windows.Forms.ToolBarButton();
163 this.LEFT = new System.Windows.Forms.ToolBarButton();
164 this.RIGHT = new System.Windows.Forms.ToolBarButton();
165 this.Axo = new System.Windows.Forms.ToolBarButton();
166 this.Rot = new System.Windows.Forms.ToolBarButton();
167 this.Reset = new System.Windows.Forms.ToolBarButton();
168 this.HlrOn = new System.Windows.Forms.ToolBarButton();
169 this.HlrOff = new System.Windows.Forms.ToolBarButton();
170 this.SuspendLayout();
174 this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
183 this.File.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
190 this.File.Text = "&File";
191 this.File.Popup += new System.EventHandler(this.File_Popup);
195 this.FileNew.Index = 0;
196 this.FileNew.Text = "&New";
197 this.FileNew.Click += new System.EventHandler(this.menuItem2_Click);
201 this.FileExport.Index = 1;
202 this.FileExport.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
206 this.FileExport.Text = "&Import";
207 this.FileExport.Visible = false;
211 this.ImportBRep.Index = 0;
212 this.ImportBRep.Text = "&BRep ...";
213 this.ImportBRep.Click += new System.EventHandler(this.ImportBRep_Click);
217 this.ImportIges.Index = 1;
218 this.ImportIges.Text = "&Iges ...";
219 this.ImportIges.Click += new System.EventHandler(this.ImportIges_Click);
223 this.ImportStep.Index = 2;
224 this.ImportStep.Text = "&Step ...";
225 this.ImportStep.Click += new System.EventHandler(this.ImportStep_Click);
229 this.FileImport.Index = 2;
230 this.FileImport.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
238 this.FileImport.Text = "&Export";
239 this.FileImport.Visible = false;
240 this.FileImport.Popup += new System.EventHandler(this.FileImport_Popup);
244 this.ExportBRep.Enabled = false;
245 this.ExportBRep.Index = 0;
246 this.ExportBRep.Text = "&BRep ...";
247 this.ExportBRep.Click += new System.EventHandler(this.ExportBRep_Click);
251 this.ExportIges.Enabled = false;
252 this.ExportIges.Index = 1;
253 this.ExportIges.Text = "&Iges ...";
254 this.ExportIges.Click += new System.EventHandler(this.ExportIges_Click);
258 this.ExportStep.Enabled = false;
259 this.ExportStep.Index = 2;
260 this.ExportStep.Text = "&Step ...";
261 this.ExportStep.Click += new System.EventHandler(this.ExportStep_Click);
265 this.ExportStl.Enabled = false;
266 this.ExportStl.Index = 3;
267 this.ExportStl.Text = "&Stl ...";
268 this.ExportStl.Click += new System.EventHandler(this.ExportStl_Click);
272 this.ExportVrml.Enabled = false;
273 this.ExportVrml.Index = 4;
274 this.ExportVrml.Text = "&Vrml ...";
275 this.ExportVrml.Click += new System.EventHandler(this.ExportVrml_Click);
279 this.menuItem3.Index = 5;
280 this.menuItem3.Text = "-";
284 this.ExportImage.Index = 6;
285 this.ExportImage.Text = "Image ...";
286 this.ExportImage.Click += new System.EventHandler(this.ExportImage_Click);
290 this.FileClose.Enabled = false;
291 this.FileClose.Index = 3;
292 this.FileClose.Text = "&Close";
293 this.FileClose.Click += new System.EventHandler(this.menuItem3_Click);
297 this.menuItem2.Index = 4;
298 this.menuItem2.Text = "-";
302 this.menuItem1.Index = 5;
303 this.menuItem1.Text = "&Quit";
304 this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
309 this.View.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
311 this.ViewStatusBar});
312 this.View.Text = "&View";
316 this.ViewToolbar.Checked = true;
317 this.ViewToolbar.Index = 0;
318 this.ViewToolbar.Text = "&Toolbar";
319 this.ViewToolbar.Click += new System.EventHandler(this.ViewToolbar_Click);
323 this.ViewStatusBar.Checked = true;
324 this.ViewStatusBar.Index = 1;
325 this.ViewStatusBar.Text = "&Statusbar";
326 this.ViewStatusBar.Click += new System.EventHandler(this.ViewStatusBar_Click);
330 this.Window.Index = 2;
331 this.Window.MdiList = true;
332 this.Window.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
336 this.Window.Text = "&Window";
337 this.Window.Visible = false;
341 this.menuItem4.Index = 0;
342 this.menuItem4.Text = "&New 3d View";
343 this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
347 this.WindowCascade.Index = 1;
348 this.WindowCascade.Text = "&Cascade";
349 this.WindowCascade.Click += new System.EventHandler(this.WindowCascade_Click);
353 this.WindowTile.Index = 2;
354 this.WindowTile.Text = "&Tile";
355 this.WindowTile.Click += new System.EventHandler(this.WindowTile_Click);
360 this.Help.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
362 this.Help.Text = "&Help";
366 this.HelpAbout.Index = 0;
367 this.HelpAbout.Shortcut = System.Windows.Forms.Shortcut.F1;
368 this.HelpAbout.Text = "&About";
369 this.HelpAbout.Click += new System.EventHandler(this.HelpAbout_Click);
373 this.toolBarTool.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar;
374 this.toolBarTool.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
384 this.toolBarTool.DropDownArrows = true;
385 this.toolBarTool.ImageList = this.imageList1;
386 this.toolBarTool.Location = new System.Drawing.Point(0, 0);
387 this.toolBarTool.Name = "toolBarTool";
388 this.toolBarTool.ShowToolTips = true;
389 this.toolBarTool.Size = new System.Drawing.Size(560, 28);
390 this.toolBarTool.TabIndex = 1;
391 this.toolBarTool.Enter += new System.EventHandler(this.menuItem3_Click);
392 this.toolBarTool.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
393 this.toolBarTool.MouseHover += new System.EventHandler(this.toolBar1_MouseHover);
394 this.toolBarTool.MouseLeave += new System.EventHandler(this.toolBar1_MouseLeave);
398 this.New.ImageIndex = 0;
399 this.New.ToolTipText = "New";
400 this.New.Visible = ((bool)(configurationAppSettings.GetValue("New.Visible", typeof(bool))));
404 this.About.ImageIndex = 1;
405 this.About.ToolTipText = "About(F1)";
406 this.About.Visible = ((bool)(configurationAppSettings.GetValue("About.Visible", typeof(bool))));
410 this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
414 this.wireframe.Enabled = ((bool)(configurationAppSettings.GetValue("wireframe.Enabled", typeof(bool))));
415 this.wireframe.ImageIndex = 2;
416 this.wireframe.Pushed = ((bool)(configurationAppSettings.GetValue("wireframe.Pushed", typeof(bool))));
417 this.wireframe.ToolTipText = "Wireframe";
418 this.wireframe.Visible = ((bool)(configurationAppSettings.GetValue("wireframe.Visible", typeof(bool))));
422 this.shading.Enabled = ((bool)(configurationAppSettings.GetValue("shading.Enabled", typeof(bool))));
423 this.shading.ImageIndex = 3;
424 this.shading.Pushed = ((bool)(configurationAppSettings.GetValue("shading.Pushed", typeof(bool))));
425 this.shading.ToolTipText = "Shading";
426 this.shading.Visible = ((bool)(configurationAppSettings.GetValue("shading.Visible", typeof(bool))));
430 this.color.Enabled = ((bool)(configurationAppSettings.GetValue("color.Enabled", typeof(bool))));
431 this.color.ImageIndex = 4;
432 this.color.ToolTipText = "Color";
433 this.color.Visible = ((bool)(configurationAppSettings.GetValue("color.Visible", typeof(bool))));
437 this.material.Enabled = ((bool)(configurationAppSettings.GetValue("material.Enabled", typeof(bool))));
438 this.material.ImageIndex = 5;
439 this.material.ToolTipText = "Material";
440 this.material.Visible = ((bool)(configurationAppSettings.GetValue("material.Visible", typeof(bool))));
444 this.transparency.Enabled = ((bool)(configurationAppSettings.GetValue("transparency.Enabled", typeof(bool))));
445 this.transparency.ImageIndex = 6;
446 this.transparency.ToolTipText = "Transparency";
447 this.transparency.Visible = ((bool)(configurationAppSettings.GetValue("transparency.Visible", typeof(bool))));
451 this.delete.Enabled = ((bool)(configurationAppSettings.GetValue("delete.Enabled", typeof(bool))));
452 this.delete.ImageIndex = 7;
453 this.delete.ToolTipText = "Delete";
454 this.delete.Visible = ((bool)(configurationAppSettings.GetValue("delete.Visible", typeof(bool))));
458 this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
459 this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
460 this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
464 this.myStatusBar.AccessibleRole = System.Windows.Forms.AccessibleRole.StatusBar;
465 this.myStatusBar.Location = new System.Drawing.Point(0, 363);
466 this.myStatusBar.Name = "myStatusBar";
467 this.myStatusBar.Size = new System.Drawing.Size(560, 22);
468 this.myStatusBar.TabIndex = 3;
472 this.toolBarView.AccessibleRole = System.Windows.Forms.AccessibleRole.ToolBar;
473 this.toolBarView.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
490 this.toolBarView.DropDownArrows = true;
491 this.toolBarView.ImageList = this.imageList1;
492 this.toolBarView.Location = new System.Drawing.Point(0, 28);
493 this.toolBarView.Name = "toolBarView";
494 this.toolBarView.ShowToolTips = true;
495 this.toolBarView.Size = new System.Drawing.Size(560, 28);
496 this.toolBarView.TabIndex = 5;
497 this.toolBarView.Visible = false;
498 this.toolBarView.Wrappable = false;
499 this.toolBarView.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBarView_ButtonClick);
500 this.toolBarView.MouseHover += new System.EventHandler(this.toolBarView_MouseHover);
501 this.toolBarView.MouseLeave += new System.EventHandler(this.toolBarView_MouseLeave);
505 this.ZoomAll.ImageIndex = 8;
506 this.ZoomAll.ToolTipText = "FitAll";
510 this.ZoomWin.ImageIndex = 9;
511 this.ZoomWin.ToolTipText = "Zoom Window";
515 this.ZoomProg.ImageIndex = 10;
516 this.ZoomProg.ToolTipText = "Dynamic Zooming";
520 this.Pan.ImageIndex = 11;
521 this.Pan.ToolTipText = "Dynamic Panning";
525 this.PanGlo.ImageIndex = 12;
526 this.PanGlo.ToolTipText = "GlobalPanning";
530 this.Front.ImageIndex = 13;
531 this.Front.ToolTipText = "Front";
535 this.Back.ImageIndex = 14;
536 this.Back.ToolTipText = "Back";
540 this.TOP.ImageIndex = 15;
541 this.TOP.ToolTipText = "Top";
545 this.BOTTOM.ImageIndex = 16;
546 this.BOTTOM.ToolTipText = "Bottom";
550 this.LEFT.ImageIndex = 17;
551 this.LEFT.ToolTipText = "Left";
555 this.RIGHT.ImageIndex = 18;
556 this.RIGHT.ToolTipText = "Right";
560 this.Axo.ImageIndex = 19;
561 this.Axo.ToolTipText = "Axo";
565 this.Rot.ImageIndex = 20;
566 this.Rot.ToolTipText = "Dynamic Rotation";
570 this.Reset.ImageIndex = 21;
571 this.Reset.ToolTipText = "Reset";
575 this.HlrOn.ImageIndex = 22;
576 this.HlrOn.Pushed = true;
577 this.HlrOn.ToolTipText = "Hidden On";
581 this.HlrOff.ImageIndex = 23;
582 this.HlrOff.ToolTipText = "Hidden Off";
586 this.AccessibleRole = System.Windows.Forms.AccessibleRole.Application;
587 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
588 this.ClientSize = new System.Drawing.Size(560, 385);
589 this.Controls.Add(this.toolBarView);
590 this.Controls.Add(this.myStatusBar);
591 this.Controls.Add(this.toolBarTool);
592 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
593 this.IsMdiContainer = true;
594 this.Menu = this.mainMenu1;
596 this.Text = "Sample Import / Export";
597 this.Activated += new System.EventHandler(this.Form1_Activated);
598 this.ResumeLayout(false);
604 /// The main entry point for the application.
609 Application.Run(new Form1());
612 private void menuItem2_Click(object sender, System.EventArgs e)
615 this.Cursor=System.Windows.Forms.Cursors.WaitCursor;
619 private void menuItem3_Click(object sender, System.EventArgs e)
621 if ( this.MdiChildren.Length > 0 )
622 this.ActiveMdiChild.Close();
626 private void ImportBRep_Click(object sender, System.EventArgs e)
629 Form2 curForm = (Form2) this.ActiveMdiChild;
632 this.myModelFormat=ModelFormat.BREP;
633 curForm.ImportModel(this.myModelFormat);
637 private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
640 Form2 curForm = (Form2) this.ActiveMdiChild;
641 switch(toolBarTool.Buttons.IndexOf(e.Button))
644 this.Cursor=System.Windows.Forms.Cursors.WaitCursor;
648 AboutDialog myDlg = new AboutDialog();
649 myDlg.ShowDialog(this);
652 case 2: //just separator
657 curForm.SetDisplayMode(0); //wireframe
658 this.wireframe.Enabled=false;
659 this.shading.Enabled=true;
660 this.transparency.Enabled=false;
665 curForm.SetDisplayMode(1); //shading
666 this.shading.Enabled=false;
667 this.wireframe.Enabled=true;
668 this.transparency.Enabled=true;
673 curForm.ChangeColor(true);
678 MaterialDialog m = new MaterialDialog();
680 m.ShowDialog(curForm);
685 IE.TransparencyDialog t = new TransparencyDialog();
687 t.ShowDialog(curForm);
692 curForm.DeleteObjects();
699 private void toolBar1_MouseHover(object sender, System.EventArgs e)
701 this.myStatusBar.Text="Document toolbar";
704 private void toolBar1_MouseLeave(object sender, System.EventArgs e)
706 this.myStatusBar.Text="";
709 private void ImportCsfdb_Click(object sender, System.EventArgs e)
711 Form2 curForm = (Form2) this.ActiveMdiChild;
714 this.myModelFormat=IE.ModelFormat.CSFDB;
715 curForm.ImportModel(this.myModelFormat);
718 private void ImportIges_Click(object sender, System.EventArgs e)
720 Form2 curForm = (Form2) this.ActiveMdiChild;
723 this.myModelFormat=IE.ModelFormat.IGES;
724 curForm.ImportModel(this.myModelFormat);
727 private void ImportStep_Click(object sender, System.EventArgs e)
729 Form2 curForm = (Form2) this.ActiveMdiChild;
732 this.myModelFormat=IE.ModelFormat.STEP;
733 curForm.ImportModel(this.myModelFormat);
736 private void ExportBRep_Click(object sender, System.EventArgs e)
738 Form2 curForm = (Form2) this.ActiveMdiChild;
741 this.myModelFormat=IE.ModelFormat.BREP;
742 curForm.ExportModel(this.myModelFormat);
745 private void ExportCsfdb_Click(object sender, System.EventArgs e)
747 Form2 curForm = (Form2) this.ActiveMdiChild;
750 this.myModelFormat=IE.ModelFormat.CSFDB;
751 curForm.ExportModel(this.myModelFormat);
754 private void ExportIges_Click(object sender, System.EventArgs e)
756 Form2 curForm = (Form2) this.ActiveMdiChild;
759 this.myModelFormat=IE.ModelFormat.IGES;
760 curForm.ExportModel(this.myModelFormat);
763 private void ExportStep_Click(object sender, System.EventArgs e)
765 Form2 curForm = (Form2) this.ActiveMdiChild;
768 this.myModelFormat=IE.ModelFormat.STEP;
769 curForm.ExportModel(this.myModelFormat);
772 private void ExportStl_Click(object sender, System.EventArgs e)
774 Form2 curForm = (Form2) this.ActiveMdiChild;
777 this.myModelFormat=IE.ModelFormat.STL;
778 curForm.ExportModel(this.myModelFormat);
781 private void ExportVrml_Click(object sender, System.EventArgs e)
783 Form2 curForm = (Form2) this.ActiveMdiChild;
786 this.myModelFormat=IE.ModelFormat.VRML;
787 curForm.ExportModel(this.myModelFormat);
790 private void ExportImage_Click(object sender, System.EventArgs e)
792 Form2 curForm = (Form2) this.ActiveMdiChild;
795 this.myModelFormat=IE.ModelFormat.IMAGE;
796 curForm.ExportModel(this.myModelFormat);
799 private void HelpAbout_Click(object sender, System.EventArgs e)
801 AboutDialog myDlg = new AboutDialog();
802 myDlg.ShowDialog(this);
805 private void ViewToolbar_Click(object sender, System.EventArgs e)
808 if (this.ViewToolbar.Checked)
810 if (this.MdiChildren.Length > 0)
812 this.New.Visible=false;
813 this.About.Visible=false;
816 this.toolBarTool.Hide();
817 this.ViewToolbar.Checked=false;
821 if (this.MdiChildren.Length > 0)
823 this.New.Visible=true;
824 this.About.Visible=true;
827 this.toolBarTool.Show();
828 this.ViewToolbar.Checked=true;
833 private void ViewStatusBar_Click(object sender, System.EventArgs e)
835 if (this.ViewStatusBar.Checked)
837 this.myStatusBar.Hide();
838 this.ViewStatusBar.Checked=false;
842 this.myStatusBar.Show();
843 this.ViewStatusBar.Checked=true;
847 public void OnNewFile()
849 Form2 newForm = new Form2();
850 newForm.MdiParent=this;
851 IE.Form1.myNbOfChildren=IE.Form1.myNbOfChildren+1;
852 string str = System.String.Format(newForm.Text+" {0}:{1}", IE.Form1.myNbOfChildren, 1);
857 this.FileExport.Visible=true;
858 this.FileImport.Visible=true;
859 this.Window.Visible=true;
860 this.wireframe.Visible=true;
861 this.shading.Visible=true;
862 this.color.Visible=true;
863 this.material.Visible=true;
864 this.transparency.Visible=true;
865 this.delete.Visible=true;
866 this.Cursor=System.Windows.Forms.Cursors.Default;
867 this.toolBarView.Visible=true;
870 private void FileImport_Popup(object sender, System.EventArgs e)
872 IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild;
875 if ( curForm.View.IsObjectSelected())
877 this.ExportBRep.Enabled=true;
878 this.ExportIges.Enabled=true;
879 this.ExportStep.Enabled=true;
880 this.ExportVrml.Enabled=true;
881 this.ExportStl.Enabled=true;
886 private void menuItem1_Click(object sender, System.EventArgs e)
891 private void File_Popup(object sender, System.EventArgs e)
893 if (this.MdiChildren.Length > 0 )
894 this.FileClose.Enabled=true;
897 this.FileClose.Enabled=false;
898 this.FileExport.Visible=false;
899 this.FileImport.Visible=false;
903 private void menuItem4_Click(object sender, System.EventArgs e)
905 IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild;
906 IE.Form2 newView = new Form2();
907 newView.MdiParent=this;
910 newView.SetContext(curForm.View);
911 newView.View.CreateNewView(newView.Handle);
912 string title = curForm.Text;
913 System.Text.StringBuilder bld= new System.Text.StringBuilder(title);
914 char c = bld[title.Length-1];
915 string s=c.ToString();
916 int NbOfView = newView.View.CharToInt(s);
918 bld.Remove(title.Length-1, 1);
919 bld.Append(NbOfView);
920 newView.Text=bld.ToString();
923 private void WindowCascade_Click(object sender, System.EventArgs e)
925 this.LayoutMdi(System.Windows.Forms.MdiLayout.Cascade);
928 private void WindowTile_Click(object sender, System.EventArgs e)
930 this.LayoutMdi(System.Windows.Forms.MdiLayout.TileVertical);
933 public void SelectionChanged()
935 if (this.MdiChildren.Length == 0 )
937 IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild;
938 if ( curForm == null )
940 switch (curForm.View.DisplayMode())
943 this.shading.Enabled=false;
944 this.wireframe.Enabled=false;
947 this.wireframe.Enabled=false;
948 this.shading.Enabled=true;
949 this.transparency.Enabled=false;
952 this.wireframe.Enabled=true;
953 this.shading.Enabled=false;
954 this.transparency.Enabled=true;
957 this.wireframe.Enabled=true;
958 this.shading.Enabled=true;
959 this.transparency.Enabled=true;
964 bool IsSelected = curForm.View.IsObjectSelected();
967 this.color.Enabled=true;
968 this.material.Enabled=true;
969 this.delete.Enabled=true;
973 this.color.Enabled=false;
974 this.material.Enabled=false;
975 this.transparency.Enabled=false;
976 this.delete.Enabled=false;
978 if (curForm.DegenerateMode)
980 this.HlrOff.Pushed=false;
981 this.HlrOn.Pushed=true;
985 this.HlrOff.Pushed=true;
986 this.HlrOn.Pushed=false;
988 if (curForm.Mode == IE.CurrentAction3d.CurAction3d_WindowZooming)
989 this.ZoomWin.Pushed=false;
993 public StatusBar StatusBar
997 return this.myStatusBar;
1001 public void OnFileClose()
1003 if ( this.MdiChildren.Length <= 1)
1005 this.FileClose.Enabled=false;
1006 this.Window.Visible=false;
1007 this.wireframe.Visible=false;
1008 this.shading.Visible=false;
1009 this.color.Visible=false;
1010 this.material.Visible=false;
1011 this.transparency.Visible=false;
1012 this.delete.Visible=false;
1013 this.toolBarView.Visible=false;
1017 private void toolBarView_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
1019 IE.Form2 curForm = (IE.Form2) this.ActiveMdiChild;
1020 if ( curForm == null )
1022 switch(toolBarView.Buttons.IndexOf(e.Button))
1025 curForm.View.ZoomAllView();
1028 curForm.Mode=CurrentAction3d.CurAction3d_WindowZooming;
1029 this.ZoomWin.Pushed=true;
1032 curForm.Mode=CurrentAction3d.CurAction3d_DynamicZooming;
1035 curForm.Mode=CurrentAction3d.CurAction3d_DynamicPanning;
1038 curForm.Zoom=curForm.View.Scale();
1039 curForm.Mode=CurrentAction3d.CurAction3d_GlobalPanning;
1042 curForm.View.FrontView();
1045 curForm.View.TopView();
1048 curForm.View.LeftView();
1051 curForm.View.BackView();
1054 curForm.View.RightView();
1057 curForm.View.BottomView();
1060 curForm.View.AxoView();
1063 curForm.Mode=CurrentAction3d.CurAction3d_DynamicRotation;
1066 curForm.View.Reset();
1069 curForm.View.SetDegenerateModeOn();
1070 curForm.DegenerateMode=true;
1071 this.HlrOff.Pushed=false;
1072 this.HlrOn.Pushed=true;
1075 curForm.View.SetDegenerateModeOff();
1076 curForm.DegenerateMode=false;
1077 this.HlrOn.Pushed=false;
1078 this.HlrOff.Pushed=true;
1085 private void Form1_Activated(object sender, System.EventArgs e)
1087 if (this.toolBarView.Visible)
1088 this.SelectionChanged();
1091 private void toolBarView_MouseHover(object sender, System.EventArgs e)
1093 this.myStatusBar.Text="View toolbar";
1096 private void toolBarView_MouseLeave(object sender, System.EventArgs e)
1098 this.myStatusBar.Text="";