Table of Contents

Class ParameterizedFlagSyntax

Namespace
Hi.NcParsers.ParsingSyntaxs
Assembly
HiMech.dll

Syntax for flags with attached parameters (e.g., G54.1P1, G10L2P1). This is essentially a combination of main flag matching (like NumberedFlagSyntax) plus scoped TagSetupSyntax for the parameters after the main flag. Note that the ParameterizedFlagSyntax often should be applied before NumberedFlagSyntax since NumberedFlagSyntax may eat the text that ParameterizedFlagSyntax should handle.

public class ParameterizedFlagSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
ParameterizedFlagSyntax
Implements
Inherited Members
Extension Methods

Remarks

Parameters can be stored as typed values via FloatParamPrefixes and IntParamPrefixes (set via property initializer):

Examples:
  • G54.1P1 → {"G54.1": {"P": "1"}} (text)
  • G68.2 X0 I180 → {"G68.2": {"X": 0.0, "I": 180.0}} (float via property initializer)
  • G54.1P#1 → {"G54.1": {"P": "#1"}} (Fanuc variable, kept as string)
  • G54.1PQ1 → {"G54.1": {"P": "Q1"}} (Heidenhain variable)

Constructors

ParameterizedFlagSyntax(IEnumerable<string>, IEnumerable<string>, IEnumerable<string>, string, IEnumerable<string>)

Creates a new ParameterizedFlagSyntax instance. Use property initializers for FloatParamPrefixes and IntParamPrefixes to enable typed parameter storage.

public ParameterizedFlagSyntax(IEnumerable<string> categoryPath, IEnumerable<string> codePrefixes, IEnumerable<string> paramPrefixes, string varPrefix, IEnumerable<string> terminateWords = null)

Parameters

categoryPath IEnumerable<string>

JSON path for storing matched codes.

codePrefixes IEnumerable<string>

Full code prefixes to match (e.g., [“G54.1”, “G10”]).

paramPrefixes IEnumerable<string>

Parameter prefixes to extract (e.g., [“P”, “L”]).

varPrefix string

Variable prefix (e.g., “#” for Fanuc, “Q” for Heidenhain).

terminateWords IEnumerable<string>

Words that stop parameter extraction.

ParameterizedFlagSyntax(XElement)

public ParameterizedFlagSyntax(XElement src)

Parameters

src XElement

Properties

CategoryPath

Category path for storing matched codes in JSON.

public List<string> CategoryPath { get; set; }

Property Value

List<string>

CodePrefixes

Full code prefixes to match (e.g., [“G54.1”, “G10”]).

public List<string> CodePrefixes { get; set; }

Property Value

List<string>

FloatParamPrefixes

Parameter prefixes stored as double when parseable, string otherwise (for variable references). Set via property initializer for typed G-code parameters.

public List<string> FloatParamPrefixes { get; set; }

Property Value

List<string>

IntParamPrefixes

Parameter prefixes stored as int when parseable, string otherwise (for variable references). Set via property initializer for typed G-code parameters.

public List<string> IntParamPrefixes { get; set; }

Property Value

List<string>

Name

public string Name { get; }

Property Value

string

ParamPrefixes

Parameter prefixes to extract as text string (e.g., [“P”, “L”, “H”]). Multiple parameters can be attached to one code.

public List<string> ParamPrefixes { get; set; }

Property Value

List<string>

TerminateWords

Words that terminate parameter extraction (e.g., [“G”, “M”, “X”, “Y”, “Z”]). Extraction stops when encountering these prefixes followed by a number.

public List<string> TerminateWords { get; set; }

Property Value

List<string>

VarPrefix

Variable prefix for macro variables (e.g., “#” for Fanuc, “Q” for Heidenhain).

public string VarPrefix { get; set; }

Property Value

string

XName

public static string XName { get; }

Property Value

string

Methods

Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>)

Build syntax arrangement into the syntaxPieceNode in-place.

public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList)

Parameters

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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.