Add Your Heading Text Here


What is a Python Script?
How Programmable Post-processing in RhinoCAM Works
If you refer to the flow diagram below you see that the Python script (i.e., the Programmable Post) is triggered by events emanating from the RhinoCAM Machining Job. This “event Information” includes all setup and toolpath data and the sequence, or “events” as they occur during the Machining Job. Even more importantly, the Python script has access to all RhinoCAM post-processor variables defined in a companion SPM (legacy) post-processor file.
These variable values are populated by RhinoCAM during post-processing and are derived from and are unique to each Machining Operation in the Machining Job being post-processed.

Some Example Uses for Programmable Posts
Output in Polar Coordinates
Custom Feed Rate Controls
Custom Output of Information
Drill Blocks and Programmable Posts

What is an Aggregate Drill Block?

How the Drill Block Programmable Post Works

Why are Cutting Tools Numbered?
How the Drill Block is Programmed
Description of the Drill Block
Add Your Heading Text Here
The illustration here on the right shows the Drill Block in relation to the main spindle. It shows the identification of each Drill Tool Position. We use the term Tool Position so that you do not confuse them with Tool Numbers.
There are 5 Tool Positions in the X direction and 5 Tool Positions in the Y direction, for a total of 9 Tool Positions. In this Drill Block, only the spindles along one axis can be active at one time. That is, a spindle along the Y axis cannot be turned on at the same time a spindle along the X axis is on. Note also the Tool Position values can take one of these 5 values: 1, 2, 4,8, and 16. These can be considered binary numbers and programmers will be familiar with this.

Encoding the Tool Positions in RhinoCAM
To encode which set of Tool Positions to activate for a specific Drill operation, the RhinoCAM user goes by a simple formula.
For the Tool Positions along the X axis, simply add up the Tool Position values and add this sum to 1000. As an example, if you want to activate Tool Positions B4 and B16 (see illustration above), the formula to encode this information is:
( 4 + 16 ) + 1000 = 1020
For the Tool Positions along the Y axis, a similar formula applies. Simply add up the Tool Position values and add this sum to 2000. So for instance, if you want to activate Tool Positions B2 and B8, then the formula becomes
( 2 + 8 ) + 2000 = 2010
Programming the use of the Drill Bank in RhinoCAM
In RhinoCAM if you want to use the Drill Bank in a machining operation, these are the steps to follow:
4. Create a regular drilling operation and select the point to the machine to be in the location where you would want the B1* tool position to be when machining.
5. Encode the Tool Position number value and use this value as the Tool Number** of the drill tool used in the machining operation.
6. Once the toolpath is created, then post-process using the specialized Programmable Post written specifically to handle this drill bank.
* Note that Tool Position B1 is shared by both X and Y directions, and only spindles along one axis can be activated at one time. This is by design.
**The 1000 and 2000 values are used to increase the tool number to a value that is out of the range of typical use. This assumes that a typically assigned tool number would be well below T1000.
How the Tool Numbers appear in RhinoCAM



How the Drill Block is Decoded
def OnToolChange(blockData: PostBlockData, globalData: PostGlobalData):
global gOP_TYPE, gToolNum
# Skip if not a hole operation
gToolNum = globalData.GetIntVar(“[TOOL_NUM]”)
# Get block code
blockCode = GenerateToolChangeBlock(blockData, globalData)
SetBlockData(blockData, blockCode)
return
def GenerateToolChangeBlock(blockData: PostBlockData, globalData: PostGlobalData):
global gOP_TYPE, gToolNum
newline = “\n[SEQ_PRECHAR][SEQNUM][DELIMITER]”
drillZ = “G43 H30 Z100.”
if gToolNum > 2000:
bToolNum = gToolNum – 2000
code = “[SEQ_PRECHAR][SEQNUM][DELIMITER]M89 B”
code = code + str(bToolNum)
elif gToolNum > 1000:
bToolNum = gToolNum – 1000
code = “[SEQ_PRECHAR][SEQNUM][DELIMITER]M88 B”
code = code + str(bToolNum)
elif gToolNum < 1001:
bToolNum = gToolNum
code = code + str(bToolNum) return code + drillZ
This formatted output will then be written to the posted G-code file (shown below), directing the CNC machine to utilize the Drill Block as the RhinoCAM user intended. Note that the g-code sample below is ONLY for the operation in the Machining Job named M88 B16:3mm.
O0
G17 G40 G49 G80 M92
G91 G28 Z0 M95
G17 X0 Y0
G90 G08 P1 (VERTICAL BORING ON —-)
G90 G54M23 (NO 2 SPINDLE ON)
(M88 B1: 10mm)
M88 B1
G52 X72.10 Y215.10 M21
G43 H30 Z100.
G00Z58.
X2302.979Y-835.343
Z2.5
G01Z-3.F1200.
Z2.5F9000.
G00Z58.
(VERTICAL BORING OFF ——)
M89 B0 (ALL TOOLS UP)
G91 G28 Z0 M25 (NO 2 SPINDLE OFF)
B0 G49 H0 M22 (NO 2 SPINDLE UP)
G52 X0 Y0
G00 G28 G91 Z0 M15
M12
G90 X0. Y420.
G49 G90
G08 P0
M30
%
Here we see an example of the posted G-Code utilizing the RhinoCAM Programmable Post. This is the G-Code output when the machining operation named “M88 B16: 3mm” is posted.

More Pics from Composite Solutions


David and Tina Gunn are hard at work in the Composite Solutions shop!


Production sheets right off the Selexx 4 x 8 router at Composite Solutions. RhinoCAM automatically places Bridges & Tabs to help keep the stock stabilized during machining.


Here on the left, we see more machined sheet products. On the right, we see the spindle (behind the brush guard) and the automatic tool changer on the Excitech CNC 4×8 router.