Class TextNCWord
"TextNCWord", or in other words "Register", is an object that helps you quickly and conveniently convert string values to a text format that the CNC machine understands.
Optionally, TextNCWord can also help you to filter the output. It contains two values - current v and previous v0 (which has already been output earlier). If both of these values are the same, then re-output the value can be skipped automatically.
Inherited Members
Namespace: SprutTechnology.SCPostprocessor
Assembly: SCPostprocessor.dll
Syntax
public class TextNCWord : NCWord
Constructors
TextNCWord(String)
Creates a new instance of a TextNCWord and initializes its state.
Declaration
public TextNCWord(string defaultValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | defaultValue | Default value for the TextNCWord. |
TextNCWord(String, NCWordTextCase)
Creates a new instance of a TextNCWord and initializes its state.
Declaration
public TextNCWord(string defaultValue, NCWordTextCase textCase)
Parameters
Type | Name | Description |
---|---|---|
System.String | defaultValue | Default value for the TextNCWord. |
NCWordTextCase | textCase | Determines whether or not to convert the case of characters. |
TextNCWord(String, String, String)
Creates a new instance of a TextNCWord and initializes its state.
Declaration
public TextNCWord(string address, string defaultValue, string tailString)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | First part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the Address is "< X >". An expression in curly braces is a part automatically formed from the value. |
System.String | defaultValue | Default value for the TextNCWord. |
System.String | tailString | Final part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the TailString is "< /X >". An expression in curly braces is a part automatically formed from the value. |
TextNCWord(String, String, String, NCWordTextCase)
Creates a new instance of a TextNCWord and initializes its state.
Declaration
public TextNCWord(string address, string defaultValue, string tailString, NCWordTextCase textCase)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | First part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the Address is "< X >". An expression in curly braces is a part automatically formed from the value. |
System.String | defaultValue | Default value for the TextNCWord. |
System.String | tailString | Final part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the TailString is "< /X >". An expression in curly braces is a part automatically formed from the value. |
NCWordTextCase | textCase | Determines whether or not to convert the case of characters. |
TextNCWord(String, String, String, NCWordTextCase, Boolean)
Creates a new instance of a TextNCWord and initializes its state.
Declaration
public TextNCWord(string address, string defaultValue, string tailString, NCWordTextCase textCase, bool autoUpdateState)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | First part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the Address is "< X >". An expression in curly braces is a part automatically formed from the value. |
System.String | defaultValue | Default value for the TextNCWord. |
System.String | tailString | Final part of the NCWord's output string that will output directly without any changes. For example, if the NCWord has a format like "< X >{v}< /X >", then the TailString is "< /X >". An expression in curly braces is a part automatically formed from the value. |
NCWordTextCase | textCase | Determines whether or not to convert the case of characters. |
System.Boolean | autoUpdateState | The "AutoUpdateState" property determines whether the NCWord State should be automatically updated when the current v or previous v0 value changes. |
Fields
defaultValue
Default value for the TextNCWord.
Declaration
protected string defaultValue
Field Value
Type | Description |
---|---|
System.String |
Properties
DefaultValue
Default value for the TextNCWord.
Declaration
public string DefaultValue { get; set; }
Property Value
Type | Description |
---|---|
System.String |
TextCase
Determines whether or not to convert the case of characters.
Declaration
public NCWordTextCase TextCase { get; set; }
Property Value
Type | Description |
---|---|
NCWordTextCase |
Unstable
Returns "True" if the TextNCWord is in the so-called "Unstable" state after the call of Reset() method. Actually it checks that the previous v0 value is equal to the "undefined" value ("null" for the TextNCWord). This state means that the TextNCWord will NOT output on the next call of Out() or Form(). But it will output just after the first change of the current v value.
Declaration
public override bool Unstable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
v
Current value of the TextNCWord. When you set the value it usually automatically updates the State depend on equality with the previous v0 value.
Declaration
public string v { get; set; }
Property Value
Type | Description |
---|---|
System.String |
v0
Previous value of the TextNCWord that has already been output. When you set the previous value it usually automatically updates the State depend on equality with the current v value.
Declaration
public string v0 { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ValuesDiffer
The property is "True" only if the current value v and the previous value v0 form a different output string.
Declaration
public override bool ValuesDiffer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
ValuesSame
The property is "True" only if the current value v and the previous value v0 form a completely identical output string.
Declaration
public override bool ValuesSame { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Methods
Hide(String)
Switches the TextNCWord to the Unchanged state and assigns the specified value to the current v value. It means that the TextNCWord will NOT output on the next call of Out() or Form() but it will contain the specified value.
It doesn't change the previous v0 value of the TextNCWord.
Later you can use the UpdateState() method to restore the changed-unchanged state depend on equality ot the v and v0.
Declaration
public void Hide(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to assign to the current v value of the TextNCWord |
Init()
This method initializes an internal state of the TextNCWord just after creation.
Declaration
protected override void Init()
Overrides
Reset()
Switches the TextNCWord to the Unchanged state and changes the previous v0 value to an undefined value ("null" for the TextNCWord). It means that the TextNCWord will NOT output on the next call of Out() or Form(). But it will output just after the first change of the current v value.
It is the so-called "Unstable" state.
It doesn't change the current v value of the TextNCWord.
Later you can use the UpdateState() method to restore the changed-unchanged state depend on equality ot the v and v0.
Declaration
public override void Reset()
Overrides
Reset(String)
Switches the TextNCWord to the Unchanged state and changes the previous v0 value to an undefined value ("null" for the TextNCWord). It means that the TextNCWord will NOT output on the next call of Out() or Form(). But it will output just after the first change of the current v value.
It is the so-called "Unstable" state.
The current v value of the TextNCWord will contain the value you specifiad as the SprutTechnology.SCPostprocessor.TextNCWord.value parameter.
Later you can use the UpdateState() method to restore the changed-unchanged state depend on equality ot the v and v0.
Declaration
public void Reset(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to assign to the current v value of the TextNCWord |
RestoreDefaultValue(Boolean)
Assigns the DefaultValue of the TextNCWord to its current v and previous v0 values. Depend on
the specified show
parameter it switches the state to Unchanged or Changed value.
Declaration
public override void RestoreDefaultValue(bool show)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | show | You need to specify "true" if you want to show the TextNCWord on the next call of Out() or Form(). Otherwise you need to specify "false" and it will hide the TextNCWord from the next output. |
Overrides
Show(String)
Switches the TextNCWord to the Changed state and assigns the specified value to the current v value. It means that the NCWord will output on the next call of Out() or Form().
It doesn't change the previous v0 value of the NCWord.
Declaration
public void Show(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value to assign to the current v value of the TextNCWord |
ToString()
Converts the current v value of the TextNCWord to the output string using all the rules of formatting like in calls of Out() or Form(). But this method does not check the State of the TextNCWord (changed it or not), so you will get the output string anyway.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | Returns the current v value with all the formatting rules defined for the TextNCWord (Address, TailString, TextCase, etc.) |
Overrides
ToString(String)
Converts the specified value to the output string using all the rules of formatting like in calls of Out() or Form(). But this method does not check the State of the TextNCWord (changed it or not), so you will get the output string anyway.
Declaration
public string ToString(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value you need to format by the rules of the TextNCWord. |
Returns
Type | Description |
---|---|
System.String | Returns the specified value with all the formatting rules defined for the TextNCWord (Address, TailString, TextCase, etc.). |
UpdateState()
Switches the State of the TextNCWord to Changed or Unchanged depend on the current v and previous v0 values. If the values are same then the state will "Unchanged", otherwise it will "Changed".
If the TextNCWord is Disabled or has the AutoUpdateState=false then the method does nothing.
Declaration
public override void UpdateState()
Overrides
Operators
Implicit(TextNCWord to String)
Converts automatically the TextNCWord to its current value.
Declaration
public static implicit operator string (TextNCWord tw)
Parameters
Type | Name | Description |
---|---|---|
TextNCWord | tw |
Returns
Type | Description |
---|---|
System.String |