public override Result Execute(ExternalCommandData data, ref string message, ElementSet elements) { if (!DirectShape.IsSupportedDocument(data.Application.ActiveUIDocument.Document)) { message = "Active document can't support DirectShape functionality."; return(Result.Failed); } using ( var openFileDialog = new OpenFileDialog() { Filter = "Rhino 3D models (*.3dm)|*.3dm", FilterIndex = 1, RestoreDirectory = true } ) { switch (openFileDialog.ShowDialog(ModalForm.OwnerWindow)) { case DialogResult.OK: return(Import3DMFile ( openFileDialog.FileName, data.Application.ActiveUIDocument.Document, CommandGrasshopperBake.ActiveBuiltInCategory )); case DialogResult.Cancel: return(Result.Cancelled); } } return(Result.Failed); }