ToolBlock Data: Difference between revisions
No edit summary |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
===Block Has Field=== | ===Block Has Field=== | ||
[[ | [[OpToolBlockHasField]]?('Key') and [[ToolHasBlock]]?(N#, 'Key') will return true if tool block on the specified tool has a defined key/value pair field with the specified key string. | ||
===Block Has Field=== | ===Block Has Field=== | ||
| Line 24: | Line 24: | ||
===Block Field as Number=== | ===Block Field as Number=== | ||
[[OpToolBlockField]]#('Key') and [[ToolBlockField]]#(N#, 'Key') will return the value of the data in the field that has the specified key. The value will be parsed and turned into a numeric value that can be used in computations. | [[OpToolBlockField]]#('Key') and [[ToolBlockField]]#(N#, 'Key') will return the value of the data in the field that has the specified key. The value will be parsed and turned into a numeric value that can be used in computations. | ||
===Block Field as String=== | |||
[[OpToolBlockField]]$('Key') and [[ToolBlockField]]$(N#, 'Key') will return the value of the data in the field that has the specified key. The value will be returned as it's raw string value and then output. | |||
| Line 30: | Line 33: | ||
The following simple example, checks to see if a block has a field, and outputs a different comment based on one field, and in another case gets another field as a number. | The following simple example, checks to see if a block has a field, and outputs a different comment based on one field, and in another case gets another field as a number. | ||
IF OpHasToolBlock? AND OpToolBlockHasField?('BlockType') | |||
IF OpToolBlockField?('BlockType', 'Simple') | |||
'( Simple Block )' EOL | |||
ELSEIF OpToolBlockField? ('BlockType', 'Complex') AND OpToolBlockHasField? ('BlockSize') | |||
'( Complex Block )' EOL | |||
'( Block Size' Output('#.###;0', OpToolBlockField#('BlockSize')) ' )' EOL | |||
IF (OpToolBlockField#('BlockSize') > 10) | |||
'( Complex Block is BIG )' EOL | |||
ELSE | |||
'( Complex Block is Small)' EOL | |||
END | |||
ELSE | |||
'( Unknown Block Type )' EOL | |||
END | |||
END | |||
[[Category:Intermediate Tooling]] | [[Category:Intermediate Tooling]] | ||
[[Category:Articles]] | [[Category:Articles]] | ||
Latest revision as of 16:10, 23 September 2016
Intermediate Tool Block Data
When using intermediate tooling blocks, it is often necessary for the post processor to be able to query non-kinematic data about a tool block, such as it's type and other properties. Many machines require special G and M codes when specific blocks are being used. To support this, GibbsCAM 11.3.8 and later includes a tool block meta-data feature that allows a tool block designer to attach key/value data pairs to any toolblock that the post can query. These key/value pairs can be used for any data needed, and are attached to block assembly.
Setting Tool Block Data
When defining tool blocks in GibbsCAM, there is a new "Posting Data" button on the tool library dialog. This button brings up the post data edit dialog. Here the tool block designer can add any number of key/value pairs. The key is a string that the post can use to access the specific value associated with it.
Accessing Tool Block Data
In the post processor, the following commands are available to access tool block data. Each command has two variants, one that uses the tool block that is associated with the current operation's tool. These commands begin with the word Op.
Commands that begin with the word Tool All take a numeric argument that defines what tool the command will use. These commands are most useful for tool lists.
Has Tool Block
OpHasToolBlock? and ToolHasBlock?(N#) will return true if the tool has an intermediate tooling block.
Block Has Field
OpToolBlockHasField?('Key') and ToolHasBlock?(N#, 'Key') will return true if tool block on the specified tool has a defined key/value pair field with the specified key string.
Block Has Field
OpToolBlockField?('Key','Value') and ToolBlockField?(N#, 'Key', 'Value') will return true if tool block on the specified tool has a defined key/value pair field with the specified key string AND if the value matches the specified value string. The comparison is not case sensitive.
Block Field as Number
OpToolBlockField#('Key') and ToolBlockField#(N#, 'Key') will return the value of the data in the field that has the specified key. The value will be parsed and turned into a numeric value that can be used in computations.
Block Field as String
OpToolBlockField$('Key') and ToolBlockField$(N#, 'Key') will return the value of the data in the field that has the specified key. The value will be returned as it's raw string value and then output.
Examples
The following simple example, checks to see if a block has a field, and outputs a different comment based on one field, and in another case gets another field as a number.
IF OpHasToolBlock? AND OpToolBlockHasField?('BlockType')
IF OpToolBlockField?('BlockType', 'Simple')
'( Simple Block )' EOL
ELSEIF OpToolBlockField? ('BlockType', 'Complex') AND OpToolBlockHasField? ('BlockSize')
'( Complex Block )' EOL
'( Block Size' Output('#.###;0', OpToolBlockField#('BlockSize')) ' )' EOL
IF (OpToolBlockField#('BlockSize') > 10)
'( Complex Block is BIG )' EOL
ELSE
'( Complex Block is Small)' EOL
END
ELSE
'( Unknown Block Type )' EOL
END
END