Hello @fredsi
The kinematic definition in the Fusion 360 post processors went thru several iterations.
It was driven by the capabilities of the software, the introduction of new functions, in the soft, or the post engine and so on.
One of the earliest methods had been handling a 4th axis definition.
This was frequently implemented using a post property for selecting either the axis direction (positive/negative), or the centerline direction (around X, around Y).
This is what is used in the vanilla Brother post.
function onOpen() {
if (getProperty("useRadius")) {
maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC
}
gRotationModal.format(69); // Default to G69 Rotation Off
if (getProperty("hasAAxis")) { // note: setup your machine here
var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-360, 360], preference:1});
//var cAxis = createAxis({coordinate:2, table:false, axis:[0, 0, 1], range:[-360, 360], preference:1});
machineConfiguration = new MachineConfiguration(aAxis);
setMachineConfiguration(machineConfiguration);
optimizeMachineAngles2(1); // TCP mode
}
We have here a boolean property "hasAAxis", and when set to true, we define the axis and the machine configuration in the code inside the onOpen function.
Another method, used in the Brother M140, can define multi axis kinematics.
In that example, a piece of code allows to define the axis, direction, limits, and TCP support.
We are not using properties for that. Defining all the different combinations in the list would be cumbersome, with A, B or C axis on the head or the table….
function onOpen() {
turningAngle = getProperty("turningAngle") * -1; // turning rotation is in opposite direction of C-axis rotation
turningAngle = turningAngle < 0 ? turningAngle + 360 : turningAngle;
if (turningAngle < 0 || turningAngle > 360) {
error(localize("TurningAngle must be between 0 and 360 degrees."));
}
saveTurningAngle = turningAngle;
if (getProperty("useRadius")) {
maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC
}
gRotationModal.format(69); // Default to G69 Rotation Off
showSequenceNumbers = getProperty("showSequenceNumbers");
if (true) { // note: setup your machine here
var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-30, 120], preference:1});
var cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, 1]});
machineConfiguration = new MachineConfiguration(aAxis, cAxis);
setMachineConfiguration(machineConfiguration);
optimizeMachineAngles2(1); // TCP mode disabled
}
Inside the "if (true)" conditional statement, we are defining our axis and configuration for a multi axis machine.
We don't rely on an external post property.
You can note that it's using some of the functions previously used in the 4th axis schema.
The speedio post is a mix between these first two solutions. But it does not used the same properties, and add his own ones.
function onOpen() {
if (getProperty("useRadius")) {
maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC
}
gRotationModal.format(69); // Default to G69 Rotation Off
if (getProperty("useTrunnion")) {
var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-30, 120], preference:1});
var cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, 1], cyclic:true});
machineConfiguration = new MachineConfiguration(aAxis, cAxis);
setMachineConfiguration(machineConfiguration);
optimizeMachineAngles2(1); // TCP mode disabled
} else if (getProperty("hasAAxis")) { // note: setup your machine here
var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-360, 360], preference:1});
machineConfiguration = new MachineConfiguration(aAxis);
setMachineConfiguration(machineConfiguration);
optimizeMachineAngles2(1); // TCP mode disabled
}
Either the "useTrunnion" property, or the "hasAAxis" will be used.
The first one taking precedence. I am using their internal name, externally theyr are "Use AC-trunnion" and "Use A-axis"
Another solution, actually not implement in the Brother post, can be found in the Fanuc post.
It’s a mix between solution 2 and our newest method.
If a machine configuration file is associated to the wcs in Fusion, then the kinematic is provided by this file.
But we can eventually also define the kinematic in the post, using the create axis functions.
Let's start in the onOpen function:
function onOpen() {
// define and enable machine configuration
receivedMachineConfiguration = machineConfiguration.isReceived();
if (typeof defineMachine == "function") {
defineMachine(); // hardcoded machine configuration
}
activateMachine(); // enable the machine optimizations and settings
We check if a machine configuration had been provided, before using it, or else the kinematic can be defined in the defineMachine functions.
function defineMachine() {
var useTCP = true;
if (false) { // note: setup your machine here
var aAxis = createAxis({coordinate:0, table:true, axis:[1, 0, 0], range:[-120, 120], preference:1, tcp:useTCP});
var cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, 1], range:[-360, 360], preference:0, tcp:useTCP});
machineConfiguration = new MachineConfiguration(aAxis, cAxis);
setMachineConfiguration(machineConfiguration);
if (receivedMachineConfiguration) {
warning(localize("The provided CAM machine configuration is overwritten by the postprocessor."));
receivedMachineConfiguration = false; // CAM provided machine configuration is overwritten
}
}
To enable the definition from the post, the "if (false)" MUST be changed to "if (true)".
And you should not assign a machine configuration file in the wcs. (or it will be overwritten by the post)
Regards.
______________________________________________________________
If my post answers your question, please click the "Accept Solution" button. This helps everyone find answers more quickly!