Class StepVariable
- Namespace
- Hi.MachiningProcs
- Assembly
- HiNc.dll
A step variable the project defines: a per-step indicator a C# formula computes from the step whenever it is read — for a chart, the tool-path colors, Step Properties, a step file — and that is never stored on the step. Saved in the project file (StepVariableList) and registered in StepPropertyAccessDictionary every time the registry is built, so it is listed from the project's load on and in every session, where a script's RegisterStepVariable(string, string, string, string, Func<MachiningStep, object>) lasts for its session. After editing the list, call RefreshStepVariables(IProgress<IMessage>).
public class StepVariable : IMakeXmlSource
- Inheritance
-
StepVariable
- Implements
- Inherited Members
- Extension Methods
Constructors
StepVariable()
Default constructor.
public StepVariable()
StepVariable(XElement)
Constructor from XML: <StepVariable Key Name Unit Format><Body>…</Body></StepVariable>.
An absent attribute keeps its default. A unit that is not a PhysicsUnit name
(one a newer version knows, say) reads as none and is kept as written, so it is reported
when the project's step variables are compiled and saved back unchanged.
public StepVariable(XElement src)
Parameters
srcXElementXML element; null keeps the defaults.
Fields
DefaultFormat
The display format a step variable has unless it names one.
public const string DefaultFormat = "G4"
Field Value
Properties
Body
The formula: the body of a C# lambda whose parameter is step
(MachiningStep) and whose value is a double? — one
expression such as step.MaxAbsForce_N / step.YieldingStressRatio, or one block in
braces that returns the value, with no preprocessor directive. It has no script globals: it
reads the step it is given and what the step reaches (the steps around it through
step.Host.ClStrip); it runs on whichever thread reads the step — the render and
sequencing threads among them — so it should not call into the session. It is full-trust
C#, as a mission's script is, and runs whenever a step is read, with no mission played.
Compiled by StepVariableCompiler.
public string Body { get; set; }
Property Value
Format
The .NET numeric format of the shown value; null or empty shows DefaultFormat.
public string Format { get; set; }
Property Value
Key
The key the registry lists it under, and a chart or a color guide picks it by.
public string Key { get; set; }
Property Value
Name
The name shown; null or empty shows Key.
public string Name { get; set; }
Property Value
Unit
The physical unit of the value. Setting it drops an unknown unit name read from a file.
public PhysicsUnit Unit { get; set; }
Property Value
UnknownUnitName
The unit name read from a file that is not a PhysicsUnit name, kept to be reported and written back; null otherwise. Unit reads as none meanwhile.
public string UnknownUnitName { get; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
MakeXmlSource(string, string, bool)
Writes the variable. A character an XML file cannot hold is written as a space — C# reads a form feed or a vertical tab as white space — so a formula never keeps the project file from being saved (the compiler refuses such a formula, and says so).
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)