Table of Contents

Class FanucIfThen

Namespace
Hi.NcParsers.Keywords
Assembly
HiMech.dll

Fanuc Custom Macro B IF [<cond>] THEN <body> single-block conditional record. Stamped on the host block by FanucIfThenSyntax after the gate decision; produced earlier by FanucIfThenParsingSyntax as a parsing-stage sub-section (Parsing.FanucIfThen) carrying the raw captured fields plus an internal PendingAssignments sub-object harvested from the body text.

Spec: IF [bool-expr] THEN <stmt> executes <stmt> only when the condition is truthy. Unlike FanucGoto's conditional form there is no jump — the body affects the current block only, no source splice, no label scan, no iteration watchdog. The most common body shape is a single Custom Macro B assignment (#nnn = <expr>); multiple assignments in one body are also accepted and lifted together.

Condition is held as a string at parsing time so VariableEvaluatorSyntax's pass-2 tree walk can substitute it to a numeric JsonValue in place; the FanucIfThenSyntax tail then reads the resolved node polymorphically via the same ReadCondition shape used by FanucGotoSyntax.

public class FanucIfThen
Inheritance
FanucIfThen
Inherited Members
Extension Methods

Properties

Applied

Whether the body actually fired on this block. False on conditions that evaluated to zero, on conditions the evaluator could not resolve, and on bodies that did not parse as one or more assignments (a G-code-only body for example, currently unsupported and warned). The host block is preserved in either case so diagnostic readers can still see the IF-THEN call site.

public bool Applied { get; set; }

Property Value

bool

BodyText

Raw body text after the THEN keyword, retained verbatim for diagnostics and round-trip visibility. The structured sub-section actually lifted on a truthy condition lives at Parsing.FanucIfThen.PendingAssignments, populated by the parsing syntax via NcSyntaxUtil's GrabTagAssignment.

public string BodyText { get; set; }

Property Value

string

Condition

Raw boolean expression text from inside the IF [...] brackets at Parsing time; substituted to a numeric JsonValue in place by VariableEvaluatorSyntax's pass-2 tree walk when the expression evaluates successfully. The original text survives at Formula.FanucIfThen.Condition. Note: not written on the host-level stamp; the gate outcome lives at ConditionEvaluated.

public string Condition { get; set; }

Property Value

string

ConditionEvaluated

Tri-state outcome of evaluating the IF-form's boolean condition, stamped on the host block by FanucIfThenSyntax:

  • true — condition met (body fires).
  • false — condition not met (body skipped silently).
  • null — evaluator could not produce a finite truth value (vacant variable, parse error, NaN / ±∞).
The original expression text is preserved at Formula.FanucIfThen.Condition by VariableEvaluatorSyntax.
public bool? ConditionEvaluated { get; set; }

Property Value

bool?