Table of Contents

Class NcSyntaxUtil

Namespace
Hi.NcParsers.Syntaxs
Assembly
HiMech.dll

JSON serialization settings and grab/set helpers for NC block JsonObject trees.

public static class NcSyntaxUtil
Inheritance
NcSyntaxUtil
Inherited Members

Properties

AxisTagList

tag list for the motion axis tags.

public static List<string> AxisTagList { get; set; }

Property Value

List<string>

Remarks

Must be initialized before MixedNcSyntaxList to avoid static initialization cycle.

FloatTagList

tag list for the float number tags.

public static List<string> FloatTagList { get; set; }

Property Value

List<string>

Remarks

Must be initialized before MixedNcSyntaxList to avoid static initialization cycle.

Methods

GrabTagAssignment(ref string, IEnumerable<string>, string, IEnumerable<string>, ExpressionPrefixParser)

Get Tag Assignments with = sign. ex. Siemens: R1=100.5, Z=V1+V2, Z=V1 - V3 * V2 F200 Heidenhain: Q1 = Q2 + 100 Fanuc: #1=#2+#3

public static List<TagValue> GrabTagAssignment(ref string unparsedText, IEnumerable<string> targetTags, string varPrefix, IEnumerable<string> terminateWords = null, ExpressionPrefixParser rhsPrefixParser = null)

Parameters

unparsedText string

The NC text to parse and modify.

targetTags IEnumerable<string>

candidate target tags to extract values for

varPrefix string

variable index code prefix.

terminateWords IEnumerable<string>

words that terminate expression (e.g., F, G, M, S). These are different from varPrefix - they signal end of expression, not variables.

rhsPrefixParser ExpressionPrefixParser

Optional longest-valid-prefix expression parser (see ExpressionPrefixParser). When provided and a prefix parses, it supersedes both the lexical boundary and the terminateWords cut for that match — the grammar itself ends the RHS (R26=R64-14/2 R23=2, Z=R63 + 150 X100); the lexical machinery remains the per-match fallback when no prefix parses.

Returns

List<TagValue>

List of extracted tag assignments.

GrabTagEqualsValue(ref string, IEnumerable<string>, ExpressionPrefixParser)

Get tag values written in the Siemens address=value form (an explicit = between a single-letter tag and its value). ex. Siemens: X=100, Z=R63+150, C=R61, F=R103, Z=_Z_HOME

public static List<TagValue> GrabTagEqualsValue(ref string unparsedText, IEnumerable<string> targetTags, ExpressionPrefixParser rhsPrefixParser = null)

Parameters

unparsedText string

The NC text to parse and modify.

targetTags IEnumerable<string>

candidate target tags to extract values for

rhsPrefixParser ExpressionPrefixParser

Optional longest-valid-prefix expression parser delimiting each RHS (see ExpressionPrefixParser).

Returns

List<TagValue>

List of extracted tag values.

Remarks

Without rhsPrefixParser, the value is captured as the following non-whitespace run, so arithmetic expressions without embedded spaces (R63+150) and named-variable references (_Z_HOME) survive as strings for the evaluation stage; numeric literals are typed later by the caller's converter (e.g. ToFloat(string)). With rhsPrefixParser (parser-delimited capture), the value is the longest valid expression prefix after the = — spaced arithmetic (R63 + 150), balanced call parentheses (DC(47.296)) and glued following words (X=100Y50) all delimit correctly; the lexical \S+ run stays as the per-match fallback when no prefix parses.

GrabTagValue(ref string, IEnumerable<string>, string)

Get tag values. Concatenated tag-value syntax (no = sign). The syntax is for assignment with space or no separation. ex. Heidenhain: L X Q2 Y33.4 FQ1 Heidenhain: L X Q2 Y33.4 F+Q1 ISO: X100.3Y3.3 Fanuc Macro: X[#1+#2] Y[#1*2+100]

public static List<TagValue> GrabTagValue(ref string unparsedText, IEnumerable<string> targetTags, string varPrefix)

Parameters

unparsedText string

The NC text to parse and modify.

targetTags IEnumerable<string>

candidate target tags to extract values for

varPrefix string

variable index code prefix. ex. Fanuc # for #123; Heidenhain Q for Q123.

Returns

List<TagValue>

List of extracted tag values.