Table of Contents

Step Present Preference Page

The model UserService is from its parent component. The UserConfig is rapidly used.

The model of Candidate Keys Panel is CandidateStepPresentKeyList. The model of Displayed Keys Panel is DisplayedStepPresentKeyList.

Layout

  • Step Present Preference Page (or window)
    • Candidate Keys Panel
      • Category A Panel
        • Key a ToggleButton
        • Key b ToggleButton
        • ...
      • Category B Panel
        • ...
      • ...
      • Category Other Panel
    • Displayed Keys Panel
      • Key 1
      • Key 2
      • ...

The categories are not defined for programming logic but only for user experience. So decide and define the categories in the GUI here only.

Since the Keys are not all come from the properties of MachiningStep, a category panel (Category Other Panel) for the uncategoried keys is required.

The keys in the Displayed Keys Panel is in sequence of DisplayedStepPresentKeyList. User tune the sequence and remove key by the Displayed Keys Panel. User add and remove the key from the ToggleButtons in Candidate Keys Panel. Those UI control items are required.

To both Candidate Keys Panel and Displayed Keys Panel: Apply PresentAttribute.Name as Key label by StepPresentAccessDictionary. Apply the key to the button tooltip.

The resx of MachiningStep contains the translation of PresentAttribute.Name, apply the translation to the GUI. If the translation not existed, use the original value.

Categories

Categories are a GUI-level grouping of keys. The seven canonical categories are hard-coded on both the WPF window and the webservice backend, and share the same nameof(MachiningStep.*) switch so that adding a new property requires one change in one place (ResolveStepPresentCategory(key)). The current category order is:

  1. File (NcName, NcLineNumber, …).
  2. Time (AccumulatedTime, StepTime, …).
  3. Tool (ToolId, CutterName, …).
  4. Coordinate (Position, Coordinate, Orientation, …).
  5. Motion (Feedrate, SpindleSpeed, Move, …).
  6. Cutting / Chip (CuttingGeom, ChipThickness, CuspHeight, …).
  7. Physics (Force, Power, Temperature, …) — visible only when UserService.EnablePhysics is true.

Keys whose property is not declared on MachiningStep (for example keys contributed by physics add-ons) fall into a catch-all “Other” category at the end of the panel.

Refer to the code to apply PresentAttribute:

internal static void ShowStepPresent(
    UserService userEnv, MachiningStep machiningStep)
{
    foreach (var entry in userEnv.DisplayedStepPresentAccessList)
    {
        var present = entry.Value.Present;
        var valueText = string.Format("{0:" + present.DataFormatString + "}", entry.Value.GetValueFunc.Invoke(machiningStep));
        Console.WriteLine($"{present.ShortName}: {valueText} {present.TailUnitString} ({present.Name} [{entry.Key}])");
    }
}

Source Code Path

See this page for git repository.

WPF Application Source Code Path

  • Preference/StepPresentPreferenceWindow

Web Page Application Source Code Path

Current (Quasar CLI SPA):

  • wwwroot-src/src/pages/StepPresentPreferencePage.vue — two-pane editor (Candidate Keys grouped by the seven canonical categories / Displayed Keys drag-and-drop list) with Reload / Reset / Cancel / Save toolbar.
  • wwwroot-src/src/api/preference.ts — getStepPresentKeys / setStepPresentKeys / resetStepPresentKeys + STEP_PRESENT_CATEGORY_ORDER.
  • wwwroot-src/src/router/routes.ts — /preference/step-present entry.
  • Environments/PreferenceController.cs — GetStepPresentKeys / UpdateStepPresentKeys (persists through UserService.SaveUserConfig()) / ResetStepPresentKeys + ResolveStepPresentCategory helper (shares the exact nameof(MachiningStep.*) switch with the WPF window).