Hello, I'm in the process of writing a postprocessor for a machine that has 2 tools: a laser and a pen. My goal is to apply an offset to X and Y depending on which tool is used. The delta X and delta Y are known between the 2 tools and doesn't change. I've tried both G10 L2 and G92 without success. Which one is best suited for this application? I've read that G92 is deprecated. Here's one attempt with G92, what am I doing wrong? function onSection() { ... var OFFSETX; // offset to be applied in G92 call var OFFSETY; // offset to be applied in G92 call switch (tool.type) { case TOOL_WATER_JET: // pen switch (properties.toolzero) { case 1: // laser was zeroed OFFSETX = properties.offsetX; OFFSETY = properties.offsetY; break; case 2: // pen was zeroed OFFSETX = 0.0; OFFSETY = 0.0; break; } // properties.toolzero break; case TOOL_LASER_CUTTER: // laser switch (properties.toolzero) { case 1: // laser was zeroed OFFSETX = 0.0; OFFSETY = 0.0; break; case 2: // pen was zeroed OFFSETX = -properties.offsetX; OFFSETY = -properties.offsetY; break; } // properties.toolzero break; default: error(localize("The CNC does not support the required tool.")); return; } writeBlock("G92.1", "; delete tool offset"); //writeBlock(gAbsIncModal.format(91), "; Relative Positioning for offset"); writeBlock(gFormat.format(92), xOutput.format(OFFSETX), yOutput.format(OFFSETY), "; apply tool offset"); //writeBlock(gAbsIncModal.format(90), "; Absolute Positioning after offset"); ... I've even considered applying the offsets directly to the X and Y g codes, but I'm trying to avoid that. Thanks, wolfgang
I would use G54 and G55 work coordinate systems say G54 for the pen and G55 for the laser User sets G54 mode and then sets 0,0,0 WCS a MACRO (not part of post) can now autoset the G55 relative to G54 something like G54 G0 x0 y0 G10 L20 P2 X[xoffset] Y[yoffset] now the post can output a G54 for pen moves and G55 for laser moves, no knowledge of offsets needed at all though of course the onOpen could do the offset 'macro' if you really wanted to.
Use two different WCS? G54 for laser, G55 for pen. So you have a G10 L20 P0 for laser and P1 for pen. You'd only need to zero one of them, G-code could set the other in the header lines.
Ha! Didn't even see that, that's funny. Definitely the way to do it though. Ohh, yeah, P0 is "active WCS", which isn't very helpful in a situation like this, but this isn't usually how I'm using G10 L20. Good call.
I like the macro solution rather than building it into the post because I would want to check before the code runs. I have not crashed into anything in a long time, because I CHECK incessantly (-: If only GRBL had a 'single block' mode.
Since most of my programs only run once or twice, very much agree! I'm getting better about that as I go, but sometimes I'll still use an old TLO or fat-finger an accidental X/Y offset somewhere because I'm looking at the machine and not the control. Gonna build some proper controls at some point for the mill and M4 for the exact reason he explained- I hate not being able to drive by feel or having too many easily-pressed buttons in one spot. Keyboard shortcuts in LinuxCNC are pretty nice and logical- F1, F2, ctrl-Home to startup, XYZ-> End, Z-> ctrl-End for zeroing and toolsetting, number row for feed override, etc etc. but you're always quite close to doing something you don't wanna do. I'm constantly checking my TLO coords to make sure XY are zero and my modals in MDI now. Better to build a hardwired control panel interfacing with the UI and not have to worry about keyboards so much.
Thank you very much David the swarfer and Rob Taylor! I've got it doing what I need now using G54 and G55 like you recommended. Here's what I got: function onOpen() { if(properties.writeMachine){ writeBlock(";", description); writeBlock(";", vendor); writeBlock(";", vendorUrl); writeBlock(";", legal); } // properties.writeMachine if (programName) { writeBlock(";", programName, programComment ? "(" + programComment + ")" : ""); } // programName writeBlock(gUnitModal.format(unit_int), ";", unit_str + "-mode"); writeBlock(gUnitModal.format(54), "; Work Coordinates"); writeBlock(gAbsIncModal.format(90), gMotionModal.format(0), xOutput.format(0), yOutput.format(0), "; Absolute Positioning, rapid to zero"); var sign; switch (properties.toolzero) { case 1: // pen was zeroed sign = 1; break; case 2: // laser was zeroed sign = -1; break; } // properties.toolzero writeBlock(gFormat.format(10), lFormat.format(20), pFormat.format(2), xOutput.format(sign*properties.offsetX), yOutput.format(sign*properties.offsetY), "; offset G55"); writeBlock("\n"); } // onOpen function onSection() { <...> switch (tool.type) { case TOOL_WATER_JET: // pen writeBlock(gUnitModal.format(54), "; switch to pen coordinate system"); break; case TOOL_LASER_CUTTER: // laser writeBlock(gUnitModal.format(55), "; switch to laser coordinate system"); break; default: error(localize("The CNC does not support the required tool.")); return; } // tool.type
When you say "MACRO", what does this mean? Where would this macro be defined? (I've never used or heard of a macro before in the CAM/post process). Thanks, Wolfgang
macro: (googles definition) noun: macro; plural noun: macros; noun: macro instruction; plural noun: macros instruction; plural noun: macro instructions 1. Computing a single instruction that expands automatically into a set of instructions to perform a particular task. In our case a macro is a short segment of Gcode that does a job (often used) for us, that is stored and attached to a macro button. Different GUI's do it their own way, bCNC looks like this The 12 items in that section are user assignable buttons, the red dots have not yet been assigned. OpenbuildsCONTROL has a macro tab and there are 2 defined macros. CONTROL accepts macros in either Gcode or Javascript. I have defined the laser offset macro I described as follows This bit of Gcode tells the machine to go to X0 Y0 using the G54 Work Coordinate System Then it sets the G55 offset (P2) to be offset by 55.2 and 23.7 (millimeters assumed, the macro should have a G21 at the start to make sure GRBL is in the right mode) Different laser installations will have different offsets, obviously. To use this macro one would set up the router bit and set X, Y and Z zero (with G54 active) for that tool according to what the job needs. The user then presses the macro button and the G55 WCS is set relative to the 0,0,0 the user has set (one might need to set the Z offset as well, to stay in focus). Now the user can run the router file which was generated with G54 as the WCS (WCS=1 in Fusion360), and then run the laser file which was generated with G55 (WCS=2 in Fusion360). For production one could use a text editor to join the 2 files together so they run as 1 job. The order of the files does not matter unless the laser operations rely on something cut by the router.
I think this is what I'm needing for a registration laser for X/Y on my Workbee. I'm new to all this and not following. I just need to create an offset from where I will mount the laser pointer so when I zero X/Y it will cut from where the laser pointer indicated it would. I use OpenBuilds CONTROL, any help would be greatly appreciated.
so the laser is just a pointer for setting X and Y, right? How are you setting Z? since you have to set Z with the current tool you may as well just set X and Y with it as well, surely? anyhow, to answer the question.... We have the laser mounted to the left and forward of the spindle by the amounts in the drawing above. Process: load the Gcode file jog the laser to the XY Work co-ordinate system 0,0 for this part SetZero for X and Y using the buttons in OBControl. Click the LaserOffset macro button (which you have to create). set Z zero! Click the Run button Content of the 'LaserOffset' macro Code: G21 G90 G17 ; set some modes so we get what we expect G0 X-60 Y-30 ; move spindle left and forward G10 L20 P0 X0 Y0 ; do what the SetZero buttons do for X and Y