Thursday 11 May 2017

Post processor modifications

Although the Newker CNC controller is (apparently) very closely based on the Fanuc M series controllers, obviously there are some areas where functions, g-codes etc differ. The post processor (PP) in Fusion 360 to select for the Newker controller seems to be the generic Fanuc milling one and so far (very early days), it seems to be compatible. Having said that, it's clear that some of the setup parameters will need to be modified for the Newker / Shiz combination. I'm still in the very early days of CNC and this is my very first attempt at getting a machine up and running. 

I'd already tried to decide if I should be aiming to get the machine to move to some sort of home position after program end - and if so, what to do about it. It seems that some machines have a "machine home position" that lifts the spindle to top position, then centres and brings the table towards the operator so the vise and workpiece are easy to reach. There seem to be several ways to do it. 

  • The G28 and G30 commands are supposed to take the tool to the home position (in absolute machine coordinates) via an intermediate (safe) point. Not all machine controllers support this. Furthermore, from what I can tell, you can't specify a position relative to the home position, only the home position itself. It's unlikely to be quite where you want it.
  • G53 is a non-modal command and also references the absolute machine coordinates. So regardless of where you are and what coordinate system you are currently using, issuing a G53 command with specified coordinates will take the tool there. That sounds like a suitable plan.
The generic Fanuc PP does a G28 at the end of the file, so I was manually editing it out on my trials, to avoid the machine disappearing off to the home position at the end of the job. Home position is a long way away from the machine vise on the Shiz.

The PP used in Fusion 360 is closely based on the HSMWorks PP. It's written in Javascript which I've never used before. I'm too old for all the thousands of versions of code these days. Most look similar enough to the stuff I've used in the past to look intelligible at first glance but are different enough to be almost impossible to do anything with in practice. 

There's a library of PPs on the Autodesk website, although most are installed with Fusion by default. And by way of introduction, there's also a short manual / tutorial to editing posts. And for people like me who have never attempted Javascript before, there are Javascript tutorials

In terms of the homing issue referred to above, there is also a rather handy Youtube video from At-Man Unlimited (Tim Dykes) that shows how to configure your PP to enable or disable G53 homing. 
Seems that Pootube robots prevent him from posting the code changes on their site (go figure) but he emailed me them instead:

At-Man recommends Notepad++ for these edits. It's pretty good for editing software code and you can tell it you are working in Javascript so it applies appropriate assistance.

Firstly, insert these lines into "user-defined properties":

// user-defined properties
properties = {
  SetHomePosition: true, //enables set home position
  HomeX: 1, //set x home position
  HomeY: 3, //set y home position
  useFilesForSubprograms: true, // specifies that one file should be generated to section
  writeMachine: true, // write machine
etc etc


Then within the onOpen function, add these:

function onOpen() {
  if (properties.useRadius) {
    maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC
  }

  if (false) { // note: setup your machine here
    var aAxis = createAxis({coordinate:0, table:false, 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, cAxis);

    setMachineConfiguration(machineConfiguration);
    optimizeMachineAngles2(0); // TCP mode
  }
        if (properties.SetHomePosition) {
machineConfiguration.setHomePositionX(HomeX);
machineConfiguration.setHomePositionY(HomeY);
}


The result of this is a couple of options in the post processor popup:
Enabling "SetHomePosition" generates the G53 command with the X and Y coordinates also specified there. Disabling it reverts to the default G28. The current X and Y values are just placeholders for now. As my machine is metric, they wouldn't result in much movement from the machine home position.

I will try out the effect of this on my machine ie see if it actually does what I want. And if so, figure out some sensible values for the X and Y coordinates.



1 comment:

  1. They're produced by the very best degree developers who will be distinguished for your polo dress creating. You'll find polo Ron Lauren inside exclusive array which include particular classes for men, women.


    notepad++ download

    ReplyDelete

Final assembly and test of the spindle nose adaptor - RESULT!!

After the recent distraction caused by the 3D scanner, resurrecting the 3D printer and buggering about with the throttle bodies for my Honda...