Class ControllerPresetWriter
Writes the built-in brand controller presets out as standalone SoftNcRunner resource files.
A controller resource file is one serialized SoftNcRunner — the
whole pipeline (dependencies, segmenter, initializers, syntaxes, semantics)
that decides how a brand's NC code is interpreted. The shipped copies live
under Resource/Controller/ so the Object Management Load
browser starts populated; they are regenerable snapshots, not the source of
truth — the brand properties on SoftNcRunner are.
Writing needs no XFactory registration. Reading a file back
does: call Reg(XFactory) first, otherwise
XFactory.GenListSkippingUnloadable drops every unregistered pipeline
entry and hands back a silently hollow runner.
public static class ControllerPresetWriter
- Inheritance
-
ControllerPresetWriter
- Inherited Members
Fields
FileExtension
Canonical extension of a serialized SoftNcRunner — named after
the controller it describes rather than the class that implements it. The
Controller tree's Object Management menu filters on it, so a file written
here is visible in its Load browser; the older .SoftNcRunner
extension stays loadable there for assets already saved under it.
public const string FileExtension = ".Controller"
Field Value
ResourceCategoryFolder
Resource category folder the presets are shipped under, relative to the
resource root (i.e. Resource/Controller).
public const string ResourceCategoryFolder = "Controller"
Field Value
Properties
BrandNames
Brand tokens CreateBrandPreset(string) understands, in the order WriteAllBrandPresetFiles(string) writes them.
public static IReadOnlyList<string> BrandNames { get; }
Property Value
Methods
CreateBrandPreset(string)
Gets a fresh brand preset runner, or null when
brand is not one of BrandNames.
public static SoftNcRunner CreateBrandPreset(string brand)
Parameters
brandstringOne of the CncBrandDependency brand tokens.
Returns
Remarks
Each brand property builds a new instance per read, so the returned runner is safe to mutate before writing.
GetBrandPresetFileName(string)
Builds the file name a brand preset is shipped under, e.g.
Fanuc.default.Controller — the ResourceDefaultMarker
token declares the file system-owned, so the resource seeder may refresh
it on version updates. The runner carries no name of its own, so the
file name is the only identity a resource browser can show.
public static string GetBrandPresetFileName(string brand)
Parameters
brandstringOne of the CncBrandDependency brand tokens.
Returns
WriteAllBrandPresetFiles(string)
Writes every brand preset in BrandNames into
targetDirectory and returns the written file paths.
public static IReadOnlyList<string> WriteAllBrandPresetFiles(string targetDirectory)
Parameters
targetDirectorystringDirectory to write into, e.g. an absolute path ending in
Resource/Controller.
Returns
WriteBrandPresetFile(string, string)
Writes one brand preset into targetDirectory and returns
the written file path. Missing directories are created.
public static string WriteBrandPresetFile(string brand, string targetDirectory)
Parameters
brandstringOne of the CncBrandDependency brand tokens.
targetDirectorystringDirectory to write into, e.g. an absolute path ending in
Resource/Controller.
Returns
Exceptions
- ArgumentException
brandis not a known brand.- ArgumentNullException
targetDirectoryis null or blank.