//this is where the logic of the command is defined protected override Result RunCommand(RhinoDoc doc, RunMode mode) { string filterStr; using (GetString getter = new GetString()) { getter.AcceptString(true); getter.SetCommandPrompt("Enter the boolean filter statement (in quotes)"); if (getter.Get() != GetResult.String) { RhinoApp.WriteLine("Invalid Input for tag"); return(getter.CommandResult()); } filterStr = getter.StringResult(); } Stopwatch watch = new Stopwatch(); watch.Start(); List <Guid> filtered = TagUtil.Evaluate(filterStr, ref doc); Debug.WriteLine(watch.ElapsedMilliseconds, "Time"); watch.Stop(); doc.Objects.UnselectAll(); doc.Objects.Select(filtered); doc.Views.Redraw(); return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { if (Panel_TagManager.CurrentFilter == null) { #if RhinoV5 Rhino.UI.Dialogs.ShowMessageBox("Current filter is not set.", "Cannot Save Filter"); #elif RhinoV6 Rhino.UI.Dialogs.ShowMessage("Current filter is not set.", "Cannot Save Filter"); #endif return(Result.Nothing); } string filterName; using (GetString getter = new GetString()) { getter.AcceptString(true); getter.SetCommandPrompt("Enter a name for the current filter"); if (getter.Get() != GetResult.String) { RhinoApp.WriteLine("Invalid Input"); return(getter.CommandResult()); } filterName = getter.StringResult(); } string filterText = Panel_TagManager.CurrentFilter.ToString(); if (Panel_TagManager.SavedFilters.ContainsKey(filterName)) { Panel_TagManager.SavedFilters[filterName] = filterText; } else { Panel_TagManager.SavedFilters.Add(filterName, filterText); } TagUtil.AddSavedFiltersToDocument(doc); doc.Modified = true; return(Result.Success); }