Class SpindleDirectionFallbackSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
The spindle-direction fallback. A block that commands a feed motion while
the modal spindle state carries an S greater than zero and no direction
ever issued (no M03 / M04 / M05, no machine-declared code) has its
SpindleSpeed section stamped CW
and reports the SpindleDirection–AssumedCw validation warning.
Once is structural, not stateful: the stamped CW propagates modally
through SpindleSpeedSyntax's lookback, so later blocks no
longer lack a direction.
Ordered after the motion writers, so the trigger is the cut, not the S
word. TOOL CALL 5 Z S5000 with M3 on a later block — the
control's own shape — and an S1200 a block ahead of its M03
report nothing, and the rapids between them run with the spindle
standing, as on the machine. A rapid, a dwell or a non-motion block never
triggers it; a canned cycle does, through the feed items of its compound
motion. An explicit M05 is a real direction and is never overridden.
The trade-off is the one a parse-layer fallback always carries: a
genuinely forgotten M03 is normalized into plausible physics from the
first cut on instead of flagged per step; the warning is the signal, and
it points at the machine's M-code map
(ISpindleControlConfig) as the real fix.
public class SpindleDirectionFallbackSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SpindleDirectionFallbackSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
A feed move with a speed and no direction — CW is assumed here (and the
one-shot SpindleDirection–AssumedCw warning is emitted):
#BeforeBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670 }, "MotionEvent": { "Form": "McLinear" } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670, "Direction": "CW" }, "MotionEvent": { "Form": "McLinear" } }
A rapid with the same state — nothing is assumed, the spindle stands: #BeforeBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670 }, "MotionEvent": { "Form": "McLinear", "IsRapid": true } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670 }, "MotionEvent": { "Form": "McLinear", "IsRapid": true } }
A feed move whose direction was issued — untouched: #BeforeBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670, "Direction": "CCW" }, "MotionEvent": { "Form": "McLinear" } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 1670, "Direction": "CCW" }, "MotionEvent": { "Form": "McLinear" } }
A canned cycle's compound motion carries a feed item — CW is assumed on the cycle block: #BeforeBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 800 }, "CompoundMotion": { "Term": "G81", "Items": [ { "MotionEvent": { "Form": "McLinear", "IsRapid": true } }, { "MotionEvent": { "Form": "McLinear", "Feedrate_mmds": 2 } } ] } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 800, "Direction": "CW" }, "CompoundMotion": { "Term": "G81", "Items": [ { "MotionEvent": { "Form": "McLinear", "IsRapid": true } }, { "MotionEvent": { "Form": "McLinear", "Feedrate_mmds": 2 } } ] } }
A feed move with the spindle at 0 — no speed, nothing to assume: #BeforeBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 0 }, "MotionEvent": { "Form": "McLinear" } }
#AfterBuild:
{ "SpindleSpeed": { "SpindleSpeed_rpm": 0 }, "MotionEvent": { "Form": "McLinear" } }
Constructors
SpindleDirectionFallbackSyntax()
Initializes a new instance with default settings.
public SpindleDirectionFallbackSyntax()
SpindleDirectionFallbackSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public SpindleDirectionFallbackSyntax(XElement src)
Parameters
srcXElementSource XML element.
Fields
AssumedCwId
Id of the validation warning the fallback reports.
public const string AssumedCwId = "SpindleDirection--AssumedCw"
Field Value
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