Class SpindleSpeedSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
Consumes S (spindle speed) and M03/M04/M05 (spindle direction) from Parsing. Both are modal — persist across blocks via backward node lookback. Writes resolved state to a ISpindleSpeedDef section. Direction is converted from ISO M-codes to the conventional SpindleDirection enum at this layer.
public class SpindleSpeedSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SpindleSpeedSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
New S + M03 (CW) — both consumed; SpindleSpeed section
written with the converted direction enum string:
#BeforeBuild:
{ "Parsing": { "Flags": ["M03"], "S": 2000 } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 2000, "Direction": "CW" } }
M04 (CCW) only — RPM inherited from #Previous:; direction
updated to the new CCW state:
#Previous:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1500, "Direction": "CW" } }
#BeforeBuild:
{ "Parsing": { "Flags": ["M04"] } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1500, "Direction": "CCW" } }
M05 (STOP) only — RPM still carried from #Previous: for
bidirectional round-tripping; downstream consumers gate on
Direction == STOP rather than RPM == 0:
#Previous:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1500, "Direction": "CW" } }
#BeforeBuild:
{ "Parsing": { "Flags": ["M05"] } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1500, "Direction": "STOP" } }
Constructors
SpindleSpeedSyntax()
Initializes a new instance with default settings.
public SpindleSpeedSyntax()
SpindleSpeedSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public SpindleSpeedSyntax(XElement src)
Parameters
srcXElementSource XML element.
Properties
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name used to register this syntax with XFactory.
public static string XName { get; }
Property Value
Methods
Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)
Build syntax arrangement into the
syntaxPieceNode in-place.
public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)
Parameters
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory