public override bool Execute(UICommandContext ctx) { var dlg = new OpenFileDialog(); dlg.Filter = "IGES Files(*.iges;*.igs)|*.iges;*.igs"; if (dlg.ShowDialog() == DialogResult.OK) { var shape = IgesIO.Open(dlg.FileName); if (shape != null) { var transaction = new UndoTransaction(ctx.Document); transaction.Start(this.Name); var shapeElement = new ShapeElement(); shapeElement.SetName(ImportStepCommand.ExtractName(dlg.SafeFileName)); ctx.Document.AddElement(shapeElement); shapeElement.SetMaterialId(ctx.DefaultMaterialId); shapeElement.SetShape(shape); ctx.ShowElement(shapeElement); transaction.Commit(); ctx.RequestUpdate(); } } return(true); }
private void igesToolStripMenuItem1_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "IGES (*.igs;*.iges)|*.igs;*.iges"; if (dialog.ShowDialog() != DialogResult.OK) { return; } var shape = IgesIO.Open(dialog.FileName); if (shape == null) { return; } mRenderView.ShowShape(shape, new Vector3(0.8f)); mRenderView.ZoomAll(); }